Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(shell): add mqtt + env config support #6

Merged
merged 3 commits into from
Apr 15, 2022

Conversation

ahochsteger
Copy link
Contributor

@ahochsteger ahochsteger commented Apr 3, 2022

This PR adds support for MQTT (read-only) and configuration using environment variables to the Wattpilot Shell.

MQTT Support

It is possible to publish JSON messages received from Wattpilot and/or individual property value changes to an MQTT server.
The easiest way to start the shell with MQTT support is using these environment variables:

export MQTT_ENABLED=true
export MQTT_HOST=<mqtt_host>
export WATTPILOT_HOST=<wattpilot_ip>
export WATTPILOT_PASSWORD=<wattpilot_password>
python3 shell.py

Environment Variables

Environment Variable Description Default Value
MQTT_BASE_TOPIC Base topic for MQTT wattpilot
MQTT_CLIENT_ID MQTT client ID wattpilot2mqtt
MQTT_ENABLED Enable MQTT false
MQTT_HA_DISCOVERY_ENABLED Enable Home Assistant Discovery (not yet implemented) false
MQTT_HOST MQTT host to connect to
MQTT_MESSAGE_TOPIC_PATTERN Topic pattern to publish Wattpilot messages to {baseTopic}/{serialNumber}/messages/{messageType}
MQTT_PORT Port of the MQTT host to connect to 1883
MQTT_PROPERTY_READ_TOPIC_PATTERN Topic pattern to publish property values to {baseTopic}/{serialNumber}/properties/{propName}
MQTT_PROPERTY_SET_TOPIC_PATTERN Topic pattern to listen for property value changes for (not yet implemented) {baseTopic}/{serialNumber}/properties/{propName}/set
MQTT_PUBLISH_MESSAGES Publish received Wattpilot messages to MQTT true
MQTT_PUBLISH_PROPERTIES Publish received property values to MQTT false
MQTT_WATCH_PROPERTIES List of space-separated default properties to publish changes for (use "" for all properties) amp car fna lmo sse
WATTPILOT_CONNECT_TIMEOUT Connect timeout for Wattpilot connection 30
WATTPILOT_DEBUG_LEVEL Debug level INFO
WATTPILOT_INITIALIZED_TIMEOUT Wait timeout for property initialization 30
WATTPILOT_HOST IP address of the Wattpilot device to connect to
WATTPILOT_PASSWORD Password for connecting to the Wattpilot device

* add mqtt support (env variables + commands)
* add environment variables for configuration
* update property infos in wattpilot.yaml with go-eCharger API v2 infos
@joscha82
Copy link
Owner

Thanks, i will add the dependency for paho mqtt client later this day to setup.py before generating a pypi package for #3

@joscha82 joscha82 merged commit ae3e37c into joscha82:main Apr 15, 2022
@ahochsteger ahochsteger deleted the mqtt-support branch June 4, 2022 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants