Skip to content

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ledermann committed Dec 17, 2023
2 parents 0619726 + 82f7c42 commit a390f5c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 20 deletions.
9 changes: 1 addition & 8 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ require:
- rubocop-minitest
- rubocop-rake
- rubocop-performance
- rubocop-minitest
- rubocop-graphql

AllCops:
Expand All @@ -19,7 +18,7 @@ Style/FrozenStringLiteralComment:
Enabled: false

Metrics/MethodLength:
Max: 40
Max: 20

Metrics/AbcSize:
Max: 25
Expand All @@ -30,14 +29,8 @@ Style/TrailingCommaInArguments:
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: consistent_comma

Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: consistent_comma

Layout/LineEndStringConcatenationIndentation:
Enabled: false

Layout/FirstArrayElementIndentation:
Enabled: false

Minitest/MultipleAssertions:
Enabled: false
15 changes: 8 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ GEM
graphql-client (0.18.0)
activesupport (>= 3.0)
graphql
hashdiff (1.0.1)
hashdiff (1.1.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
influxdb-client (3.0.0)
Expand All @@ -39,7 +39,7 @@ GEM
minitest-silence (0.2.4)
minitest (~> 5.12)
mutex_m (0.2.0)
parallel (1.23.0)
parallel (1.24.0)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
Expand All @@ -64,11 +64,12 @@ GEM
parser (>= 3.2.1.0)
rubocop-graphql (1.4.0)
rubocop (>= 0.90, < 2)
rubocop-minitest (0.33.0)
rubocop-minitest (0.34.1)
rubocop (>= 1.39, < 2.0)
rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-performance (1.20.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
ruby-progressbar (1.13.0)
Expand Down Expand Up @@ -110,4 +111,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
2.4.22
2.5.1
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[![Continuous integration](https://github.com/solectrus/tibber-collector/actions/workflows/push.yml/badge.svg)](https://github.com/solectrus/tibber-collector/actions/workflows/push.yml)
[![wakatime](https://wakatime.com/badge/user/697af4f5-617a-446d-ba58-407e7f3e0243/project/018c1bd2-0182-4fb4-a801-4bdd567f1a76.svg)](https://wakatime.com/badge/user/697af4f5-617a-446d-ba58-407e7f3e0243/project/018c1bd2-0182-4fb4-a801-4bdd567f1a76)
[![Maintainability](https://api.codeclimate.com/v1/badges/1b392dc7af3b0b5cb57d/maintainability)](https://codeclimate.com/repos/6572cf994f3c7e5e3e355636/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/1b392dc7af3b0b5cb57d/test_coverage)](https://codeclimate.com/repos/6572cf994f3c7e5e3e355636/test_coverage)
[![wakatime](https://wakatime.com/badge/user/697af4f5-617a-446d-ba58-407e7f3e0243/project/018c1bd2-0182-4fb4-a801-4bdd567f1a76.svg)](https://wakatime.com/badge/user/697af4f5-617a-446d-ba58-407e7f3e0243/project/018c1bd2-0182-4fb4-a801-4bdd567f1a76)

# Tibber collector

Collect upcoming Tibber prices and push them to InfluxDB.
Collect upcoming Tibber energy prices and push them to InfluxDB.

## Usage

Expand All @@ -21,10 +21,12 @@ Collect upcoming Tibber prices and push them to InfluxDB.
ghcr.io/solectrus/tibber-collector
```

It's recommended to integrate the `tibber-collector` into your SOLECTRUS hosting. See more here:
https://github.com/solectrus/hosting
It's recommended to integrate the `tibber-collector` into your [SOLECTRUS hosting](https://github.com/solectrus/hosting).
To charge your SENEC.Home battery when energy is cheap, you can use the [SENEC Charger](https://github.com/solectrus/senec-charger).
## License
Copyright (c) 2023 Georg Ledermann, released under the MIT License
Sponsored by [EP: Bölsche Frikom GmbH](https://www.ep.de/boelsche)
5 changes: 4 additions & 1 deletion app/loop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ def start(max_count)
loop do
self.count += 1

puts "##{self.count} - #{Time.now}"

push_to_influx(pull_from_tibber)
break if max_count && count >= max_count

puts " Sleeping for #{config.tibber_interval} seconds ..."
sleep config.tibber_interval
puts
end
end

Expand All @@ -34,7 +37,7 @@ def start(max_count)
attr_accessor :count

def pull_from_tibber
print "##{count} Fetching prices from Tibber ... "
print ' Fetching prices from Tibber ... '
Tibber.new(config:).price_info
end

Expand Down
4 changes: 4 additions & 0 deletions test/tibber_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def test_price_info_success
price_info.today.each do |p|
assert p.starts_at.is_a?(String)
assert p.total.is_a?(Float)
assert_includes(
%w[CHEAP VERY_CHEAP NORMAL EXPENSIVE VERY_EXPENSIVE],
p.level,
)
end
end

Expand Down

0 comments on commit a390f5c

Please sign in to comment.