Fix topic for power discovery
Fix unique_id
Add power discovery message, set retain flag
A small application I'm using to log my electrical meter data (using the french "Teleinfo" protocol) to a PostgreSQL database.
This might serve as an example on how to use the teleinfo-parser library.
I recently added some optional MQTT capabitilies:
Create a local tty by connecting on a TCP serial exposed by ser2net:
socat PTY,link=/tmp/ttyS0,rawer TCP:192.168.2.105:2000,keepalive,interval=10
Create a temporary database using Docker, and initialize the model using the telinfo-db project:
sudo docker run --rm --name teleinfo-db -e POSTGRES_PASSWORD=teleinfo -e POSTGRES_USER=teleinfo -p 5432:5432 postgres
mvn process-resources -Dliquibase.url=jdbc:postgresql://localhost:5432/teleinfo -Dliquibase.username=teleinfo -Dliquibase.password=teleinfo
Run the program with:
cargo run
(the file .cargo/config.toml
includes some default environment variables for testing)