-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:m4dm4rtig4n/enedisgateway2mqtt in…
…to 0.5.4
- Loading branch information
Showing
6 changed files
with
1,095 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
########## | ||
## MQTT ## | ||
########## | ||
|
||
MQTT_HOST="mosquitto" | ||
MQTT_PORT="1883" | ||
MQTT_USERNAME= | ||
MQTT_PASSWORD= | ||
MQTT_PREFIX="enedis_gateway" | ||
MQTT_CLIENT_ID="enedis_gateway" | ||
RETAIN="True" | ||
QOS=0 | ||
|
||
#################### | ||
## Home assistant ## | ||
#################### | ||
|
||
HA_AUTODISCOVERY="False" | ||
HA_AUTODISCOVERY_PREFIX="homeassistant" | ||
CARD_MYENEDIS= "True" | ||
|
||
############### | ||
## Influx DB ## | ||
############### | ||
|
||
INFLUXDB_ENABLE="True" | ||
INFLUXDB_HOST="influxdb" | ||
INFLUXDB_PORT=8086 | ||
INFLUXDB_TOKEN="enedisgateway2mqtt" | ||
INFLUXDB_ORG="enedisgateway2mqtt" | ||
INFLUXDB_BUCKET="linky" | ||
|
||
|
||
######### | ||
## Api ## | ||
######### | ||
|
||
GET_CONSUMPTION="True" | ||
GET_CONSUMPTION_DETAIL="True" | ||
GET_PRODUCTION="False" | ||
GET_PRODUCTION_DETAIL="False" | ||
OFFPEAK_HOURS= | ||
YEARS=1 | ||
CYCLE=3600 | ||
ADDRESSES="False" | ||
CONSUMPTION_PRICE_HC=0.1781 | ||
CONSUMPTION_PRICE_HP=0.1337 | ||
CONSUMPTION_PRICE_BASE=0.1781 | ||
REFRESH_CONTRACT="False" | ||
REFRESH_ADDRESSES="False" | ||
WIPE_CACHE="False" | ||
DEBUG="TRUE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.idea | ||
.env | ||
/data | ||
/app/__pycache__/ | ||
/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
COMPOSE=docker-compose -f docker-compose.dev.yml | ||
|
||
## Start docker conatiners for dev | ||
up: .env | ||
@echo "Start docker conatiner for dev" | ||
$(COMPOSE) up -d | ||
@echo "" | ||
@echo "\033[0;33mMQTT Explorer:\033[0m \033[0;32mhttp://127.0.0.1:4000\033[0m Auth info: (host: mosquitto)" | ||
@echo "\033[0;33mInflux DB: \033[0m \033[0;32mhttp://127.0.0.1:8086\033[0m Auth info: (user: enedisgateway2mqtt, pawword: enedisgateway2mqtt)" | ||
|
||
## Stop docker conatiners for dev | ||
down: .env | ||
@echo "Start docker conatiner for dev" | ||
$(COMPOSE) down | ||
|
||
## Recreate .env file | ||
init: | ||
rm -rf .env | ||
make .env | ||
|
||
## Start in app | ||
start: | ||
$(COMPOSE) exec enedisgateway2mqtt python -u /app/main.py | ||
|
||
## Connect to enedisgateway2mqtt container | ||
bash: | ||
$(COMPOSE) exec enedisgateway2mqtt bash | ||
|
||
.env: | ||
@cp .env.dist .env | ||
@echo "Init your environment:" | ||
@echo "" | ||
@read -p " - Enter your API key: " ACCESS_TOKEN; echo "ACCESS_TOKEN=$$ACCESS_TOKEN" >> .env | ||
@read -p " - Enter your PDL: " PDL; echo "PDL=$$PDL" >> .env | ||
@echo "" | ||
|
||
|
||
.DEFAULT_GOAL := help | ||
.PHONY: help | ||
help: | ||
@echo "\033[0;33mUsage:\033[0m" | ||
@echo " make [var_name=value ...] [target]\n" | ||
@echo "\033[0;33mAvailable variables:\033[0m" | ||
@echo "" | ||
@awk '/^[a-zA-Z\-_0-9\.@]+:/ {\ | ||
helpMessage = match(lastLine, /^## (.*)/); \ | ||
if (helpMessage) { \ | ||
helpCommand = substr($$1, 0, index($$1, ":")); \ | ||
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ | ||
printf "%s \033[0;32m%-22s\033[0m %s\n", key, helpCommand, helpMessage; \ | ||
} \ | ||
} \ | ||
{lastLine = $$0;}' $(MAKEFILE_LIST)\ | ||
| sed -e "s/\`/\\\\\`/g" | ||
@echo "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
version: "3.9" | ||
services: | ||
enedisgateway2mqtt: | ||
build: . | ||
links: | ||
- influxdb | ||
- mosquitto | ||
volumes: | ||
- ./data:/data | ||
- ./app:/app | ||
env_file: | ||
- .env | ||
command: tail -f /dev/null | ||
|
||
influxdb: | ||
image: influxdb:2.0.7 | ||
ports: | ||
- '8086:8086' | ||
volumes: | ||
- ./data/influxdb:/var/lib/influxdb2 | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://influxdb:8086"] | ||
interval: 25s | ||
timeout: 3s | ||
start_period: 30s | ||
environment: | ||
DOCKER_INFLUXDB_INIT_MODE: setup | ||
DOCKER_INFLUXDB_INIT_USERNAME: enedisgateway2mqtt | ||
DOCKER_INFLUXDB_INIT_PASSWORD: enedisgateway2mqtt | ||
DOCKER_INFLUXDB_INIT_ORG: enedisgateway2mqtt | ||
DOCKER_INFLUXDB_INIT_BUCKET: enedisgateway2mqtt | ||
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: enedisgateway2mqtt | ||
|
||
mosquitto: | ||
image: eclipse-mosquitto:2.0.12 | ||
volumes: | ||
- /etc/localtime:/etc/localtime:ro | ||
- /etc/timezone:/etc/timezone:ro | ||
- ./data/mosquitto:/data | ||
- ./mosquitto:/mosquitto/config/ | ||
ports: | ||
- 1883:1883 | ||
- 9001:9001 | ||
|
||
|
||
mqtt_explorer: | ||
image: smeagolworms4/mqtt-explorer | ||
links: | ||
- mosquitto | ||
volumes: | ||
- ./data/:/data | ||
ports: | ||
- 4000:4000 | ||
|
||
volumes: | ||
mydata: |
Oops, something went wrong.