Skip to content

Commit

Permalink
Merge branch 'release/0.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ledermann committed Aug 7, 2024
2 parents 2709e88 + 7f7d9a8 commit 4d36ea1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def init_sensors(env)
logger.info 'Sensor initialization started'
SENSOR_NAMES.each do |sensor_name|
var_sensor = var_for(sensor_name)
value = env.fetch(var_sensor, nil)
value = env.fetch(var_sensor, nil).presence
next unless value

validate!(sensor_name, value)
Expand Down
8 changes: 8 additions & 0 deletions spec/lib/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@
end
end

describe 'valid options (empty heatpump)' do
let(:env) { valid_env.merge('INFLUX_SENSOR_HEATPUMP_POWER' => '') }

it 'initializes successfully' do
expect(config).to be_a(described_class)
end
end

describe 'Influx methods' do
let(:env) { valid_env }

Expand Down

0 comments on commit 4d36ea1

Please sign in to comment.