Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ledermann committed Aug 7, 2024
2 parents 4d36ea1 + 7cfbecc commit f1d1353
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 12 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ INFLUX_PORT=8086
INFLUX_TOKEN=my-token # With permissions to read AND write to the bucket
INFLUX_ORG=my-org
INFLUX_BUCKET=my-bucket
INFLUX_MEASUREMENT=power-splitter
INFLUX_INTERVAL=3600

#### Sensor mapping: Map to Measurement/Field in InfluxDB
Expand Down
1 change: 0 additions & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ INFLUX_PORT=8086
INFLUX_TOKEN=my-token
INFLUX_ORG=my-org
INFLUX_BUCKET=my-bucket
INFLUX_MEASUREMENT=my_power_splitter
INFLUX_INTERVAL=5

##### Redis
Expand Down
6 changes: 4 additions & 2 deletions lib/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class Config # rubocop:disable Metrics/ClassLength
:influx_token,
:influx_org,
:influx_bucket,
:influx_measurement,
:influx_interval,
:redis_url,
:time_zone
Expand All @@ -26,7 +25,6 @@ def initialize(env, logger: NullLogger.new)
@influx_org = env.fetch('INFLUX_ORG')
@influx_bucket = env.fetch('INFLUX_BUCKET')
@influx_interval = [env.fetch('INFLUX_INTERVAL', '3600').to_i, 300].max
@influx_measurement = env.fetch('INFLUX_MEASUREMENT', 'power_splitter')
validate_url!(influx_url)
logger.info "Accessing InfluxDB at #{influx_url}, bucket #{influx_bucket}"

Expand All @@ -43,6 +41,10 @@ def influx_url

attr_reader :logger

def influx_measurement
'power_splitter'
end

def measurement(sensor_name)
@measurement ||= {}
@measurement[sensor_name] ||= splitted_sensor_name(sensor_name)&.first
Expand Down
4 changes: 2 additions & 2 deletions spec/cassettes/influx_success.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions spec/cassettes/last_splitter-with-records.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/cassettes/last_splitter-without-records.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion spec/lib/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
'INFLUX_TOKEN' => 'this.is.just.an.example',
'INFLUX_ORG' => 'solectrus',
'INFLUX_BUCKET' => 'my-bucket',
'INFLUX_MEASUREMENT' => 'my-measurement',
'INFLUX_INTERVAL' => '5',
###
'INFLUX_SENSOR_GRID_IMPORT_POWER' => 'SENEC:grid_power_plus',
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

expect(lines).to eq(
[
'my_power_splitter heatpump_power_grid=10i,house_power_grid=25i,wallbox_power_grid=15i 1641034800',
'power_splitter heatpump_power_grid=10i,house_power_grid=25i,wallbox_power_grid=15i 1641034800',
],
)
end
Expand Down

0 comments on commit f1d1353

Please sign in to comment.