Skip to content

Commit 6decee6

Browse files
committed
Merge branch 'release/0.2.7'
2 parents 1e86042 + a7ef294 commit 6decee6

File tree

10 files changed

+163
-121
lines changed

10 files changed

+163
-121
lines changed

.env.example

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
# Demo
1+
# Tibber demo token, replace with your own
22
TIBBER_TOKEN=5K4MVS-OjfWhK_4yrjOlFe1F6kJXPVf7eQYggo8ebAE
33

44
# Update interval in seconds
55
TIBBER_INTERVAL=3600
66

77
# Credentials of your InfluxDB installation
8-
INFLUX_HOST=influxdb.example.com
9-
INFLUX_SCHEMA=https
10-
INFLUX_PORT=443
11-
INFLUX_TOKEN=my-super-secret-write-token
12-
INFLUX_ORG=solectrus
8+
INFLUX_HOST=localhost
9+
INFLUX_SCHEMA=http
10+
INFLUX_PORT=8086
11+
INFLUX_TOKEN=my-token
12+
INFLUX_ORG=my-org
13+
INFLUX_PASSWORD=my-password
14+
INFLUX_USERNAME=my-user
1315

1416
# Customize InfluxDB storage
15-
INFLUX_BUCKET=my-solectrus-bucket
16-
INFLUX_MEASUREMENT=Tibber
17+
INFLUX_BUCKET=my-bucket
18+
INFLUX_MEASUREMENT=my-prices
1719

1820
# Timezone
1921
TZ=Europe/Berlin

.github/workflows/push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
run: bundle exec rake test
4040

4141
- name: Send test coverage to CodeClimate
42-
uses: paambaati/codeclimate-action@v8.0.0
42+
uses: paambaati/codeclimate-action@v9.0.0
4343
if: ${{ env.CC_TEST_REPORTER_ID }}
4444
with:
4545
coverageCommand: true

Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ruby:3.3.4-alpine AS Builder
1+
FROM ruby:3.3.4-alpine AS builder
22
RUN apk add --no-cache build-base
33

44
WORKDIR /tibber-collector
@@ -15,21 +15,21 @@ LABEL maintainer="georg@ledermann.dev"
1515
RUN apk add --no-cache tzdata
1616

1717
# Decrease memory usage
18-
ENV MALLOC_ARENA_MAX 2
18+
ENV MALLOC_ARENA_MAX=2
1919

2020
# Move build arguments to environment variables
2121
ARG BUILDTIME
22-
ENV BUILDTIME ${BUILDTIME}
22+
ENV BUILDTIME=${BUILDTIME}
2323

2424
ARG VERSION
25-
ENV VERSION ${VERSION}
25+
ENV VERSION=${VERSION}
2626

2727
ARG REVISION
28-
ENV REVISION ${REVISION}
28+
ENV REVISION=${REVISION}
2929

3030
WORKDIR /tibber-collector
3131

32-
COPY --from=Builder /usr/local/bundle/ /usr/local/bundle/
32+
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
3333
COPY . /tibber-collector/
3434

35-
ENTRYPOINT bundle exec app/main.rb
35+
ENTRYPOINT ["bundle", "exec", "app/main.rb"]

Gemfile.lock

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,61 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
activesupport (7.1.3.4)
4+
activesupport (7.2.1)
55
base64
66
bigdecimal
7-
concurrent-ruby (~> 1.0, >= 1.0.2)
7+
concurrent-ruby (~> 1.0, >= 1.3.1)
88
connection_pool (>= 2.2.5)
99
drb
1010
i18n (>= 1.6, < 2)
11+
logger (>= 1.4.2)
1112
minitest (>= 5.1)
12-
mutex_m
13-
tzinfo (~> 2.0)
13+
securerandom (>= 0.3)
14+
tzinfo (~> 2.0, >= 2.0.5)
1415
addressable (2.8.7)
1516
public_suffix (>= 2.0.2, < 7.0)
1617
ast (2.4.2)
1718
base64 (0.2.0)
1819
bigdecimal (3.1.8)
1920
climate_control (1.2.0)
20-
concurrent-ruby (1.3.3)
21+
concurrent-ruby (1.3.4)
2122
connection_pool (2.4.1)
2223
crack (1.0.0)
2324
bigdecimal
2425
rexml
2526
csv (3.3.0)
26-
docile (1.4.0)
27+
docile (1.4.1)
2728
dotenv (3.1.2)
2829
drb (2.2.1)
29-
graphql (2.3.8)
30+
fiber-storage (1.0.0)
31+
graphql (2.3.14)
3032
base64
33+
fiber-storage
3134
graphql-client (0.23.0)
3235
activesupport (>= 3.0)
3336
graphql (>= 1.13.0)
34-
hashdiff (1.1.0)
37+
hashdiff (1.1.1)
3538
i18n (1.14.5)
3639
concurrent-ruby (~> 1.0)
3740
influxdb-client (3.1.0)
3841
json (2.7.2)
3942
language_server-protocol (3.17.0.3)
40-
minitest (5.24.1)
43+
logger (1.6.0)
44+
minitest (5.25.1)
4145
minitest-silence (0.2.4)
4246
minitest (~> 5.12)
43-
mutex_m (0.2.0)
44-
parallel (1.25.1)
45-
parser (3.3.4.0)
47+
parallel (1.26.3)
48+
parser (3.3.4.2)
4649
ast (~> 2.4.1)
4750
racc
48-
public_suffix (6.0.0)
49-
racc (1.8.0)
51+
public_suffix (6.0.1)
52+
racc (1.8.1)
5053
rainbow (3.1.1)
5154
rake (13.2.1)
5255
regexp_parser (2.9.2)
53-
rexml (3.3.1)
56+
rexml (3.3.6)
5457
strscan
55-
rubocop (1.65.0)
58+
rubocop (1.65.1)
5659
json (~> 2.3)
5760
language_server-protocol (>= 3.17.0)
5861
parallel (~> 1.10)
@@ -63,9 +66,9 @@ GEM
6366
rubocop-ast (>= 1.31.1, < 2.0)
6467
ruby-progressbar (~> 1.7)
6568
unicode-display_width (>= 2.4.0, < 3.0)
66-
rubocop-ast (1.31.3)
69+
rubocop-ast (1.32.1)
6770
parser (>= 3.3.1.0)
68-
rubocop-graphql (1.5.3)
71+
rubocop-graphql (1.5.4)
6972
rubocop (>= 1.50, < 2)
7073
rubocop-minitest (0.35.1)
7174
rubocop (>= 1.61, < 2.0)
@@ -76,6 +79,7 @@ GEM
7679
rubocop-rake (0.6.0)
7780
rubocop (~> 1.0)
7881
ruby-progressbar (1.13.0)
82+
securerandom (0.3.1)
7983
simplecov (0.22.0)
8084
docile (~> 1.1)
8185
simplecov-html (~> 0.11)
@@ -86,7 +90,8 @@ GEM
8690
tzinfo (2.0.6)
8791
concurrent-ruby (~> 1.0)
8892
unicode-display_width (2.5.0)
89-
vcr (6.2.0)
93+
vcr (6.3.1)
94+
base64
9095
webmock (3.23.1)
9196
addressable (>= 2.8.0)
9297
crack (>= 0.3.2)
@@ -115,4 +120,4 @@ DEPENDENCIES
115120
webmock
116121

117122
BUNDLED WITH
118-
2.5.15
123+
2.5.18

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,22 @@
77

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

10-
## Usage
10+
This is a companion service to the [SENEC Charger](https://github.com/solectrus/senec-charger), which allows you to charge your SENEC.Home battery when energy is cheap.
1111

12-
1. Make sure your InfluxDB database is ready (not subject of this README)
12+
## Usage
1313

14-
2. Prepare an `.env` file (see `.env.example`) with your InfluxDB credentials and the Tibber API token.
14+
1. Prepare an `.env` file (see `.env.example`)
1515

16-
3. Run the Docker container on your Linux box:
16+
2. Run the Docker containers on your Linux box:
1717

1818
```bash
19-
docker run -it --rm \
20-
--env-file .env \
21-
ghcr.io/solectrus/tibber-collector
19+
docker compose up
2220
```
2321

24-
It's recommended to integrate the `tibber-collector` into your [SOLECTRUS hosting](https://github.com/solectrus/hosting).
22+
In the `senec-charger` repository you can find an [example](https://github.com/solectrus/senec-charger/blob/develop/compose.yml) of how to use `tibber-collector` with the SENEC charger.
23+
24+
It's recommended to add `tibber-collector` and `senec-charger` to your [SOLECTRUS hosting](https://github.com/solectrus/hosting).
2525

26-
To charge your SENEC.Home battery when energy is cheap, you can use the [SENEC Charger](https://github.com/solectrus/senec-charger).
2726

2827
## License
2928

compose.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
services:
2+
tibber-collector:
3+
image: ghcr.io/solectrus/tibber-collector:latest
4+
depends_on:
5+
influxdb:
6+
condition: service_healthy
7+
links:
8+
- influxdb
9+
environment:
10+
- TZ
11+
- INFLUX_HOST=influxdb
12+
- INFLUX_TOKEN
13+
- INFLUX_ORG
14+
- INFLUX_BUCKET
15+
- INFLUX_MEASUREMENT
16+
- TIBBER_TOKEN
17+
- TIBBER_INTERVAL
18+
restart: unless-stopped
19+
20+
influxdb:
21+
image: influxdb:2.7-alpine
22+
environment:
23+
- DOCKER_INFLUXDB_INIT_MODE=setup
24+
- DOCKER_INFLUXDB_INIT_USERNAME=${INFLUX_USERNAME}
25+
- DOCKER_INFLUXDB_INIT_PASSWORD=${INFLUX_PASSWORD}
26+
- DOCKER_INFLUXDB_INIT_ORG=${INFLUX_ORG}
27+
- DOCKER_INFLUXDB_INIT_BUCKET=${INFLUX_BUCKET}
28+
- DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=${INFLUX_TOKEN}
29+
command: influxd run --bolt-path /var/lib/influxdb2/influxd.bolt --engine-path /var/lib/influxdb2/engine --store disk
30+
restart: unless-stopped
31+
healthcheck:
32+
test: ['CMD', 'influx', 'ping']
33+
interval: 10s
34+
timeout: 10s
35+
retries: 5
36+
start_period: 10s

0 commit comments

Comments
 (0)