Package: wattpilot
Wattpilot:warning: This project is still in early development and might never leave this statewattpilotis a Python 3 (>= 3.10) module to interact with Fronius Wattpilot wallboxes which do not support (at the time of writting) a documented API. This functionality of this module utilized a undocumented websockets API, which is also utilized by the official Wattpilot.Solar mobile app.Wattpilot API DocumentationSeeAPI.mdfor the current state of the API documentation this implementation is based on.It has been compiled from different sources, but primarily from:go-eCharger-API-v1go-eCharger-API-v2Wattpilot ShellThe shell provides an easy way to explore the available properties and get or set their values.# Install the wattpilot module, if not yet done so:pipinstall.Run the interactive shell# Usage:exportWATTPILOT_HOST=<wattpilot_ip>exportWATTPILOT_PASSWORD=<password>
wattpilotshell
WelcometotheWattpilotShell0.2.Typehelpor?tolistcommands.

wattpilot>helpDocumentedcommands(typehelp<topic>):========================================EOFexithainfopropertiesserverunwatchwatch
connectgethelpmqttrawvaluessetvaluesThe shell supports TAB-completion for all commands and their arguments.
Detailed documentation can be found inShellCommands.md.It's also possible to pass a single command to the shell to integrate it into scripts:# Usage:wattpilotshell<wattpilot_ip><password>"<command> <args...>"# Examples:wattpilotshell<wattpilot_ip><password>"get amp"wattpilotshell<wattpilot_ip><password>"set amp 6"MQTT Bridge SupportIt 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:exportMQTT_ENABLED=trueexportMQTT_HOST=<mqtt_host>exportWATTPILOT_HOST=<wattpilot_ip>exportWATTPILOT_PASSWORD=<wattpilot_password>
wattpilotshellPay attention to environment variables starting withMQTT_to fine-tune the MQTT support (e.g. which messages or properties should published to MQTT topics).MQTT support can be easily tested using mosquitto:# Start mosquitto in a separate console:mosquitto# Subscribe to topics in a separate console:mosquitto_sub-t'wattpilot/#'-vHome Assistant MQTT Discovery SupportTo enable Home Assistant integration (using MQTT) setMQTT_ENABLEDandHA_ENABLEDtotrueand make sure to correctly configure theMQTT Integration.
It provides auto-discovery of entities using property configuration fromwattpilot.yaml.
The is the simplest possible way to start the shell with HA support:exportMQTT_ENABLED=trueexportHA_ENABLED=trueexportMQTT_HOST=<mqtt_host>exportWATTPILOT_HOST=<wattpilot_ip>exportWATTPILOT_PASSWORD=<wattpilot_password>
wattpilotshellPay attention to environment variables starting withHA_to fine-tune the Home Assistant integration (e.g. which properties should be exposed).The discovery config published to MQTT can be tested using this in addition to the testing steps from MQTT above:MQTT support can be easily tested using mosquitto:# Subscribe to homeassisant topics in a separate console:mosquitto_sub-t'homeassistant/#'-vDocker SupportThe Wattpilot MQTT bridge with Home Assistant MQTT discovery can be run as a docker container.
Here's how to do that:# Build image:docker-composebuild# Create .env file with environment variables:cat.envHA_ENABLED=trueMQTT_ENABLED=trueMQTT_HOST=<mqtt_host>WATTPILOT_HOST=<wattpilot_ip>WATTPILOT_PASSWORD=<my_secret_password># Run container (recommended with MQTT_ENABLED=true and HA_ENABLED=true - e.g. on a Raspberry Pi):docker-composeup-dTo diagnose the hundreds of Wattpilot parameters the shell can be started this way (typically recommended withMQTT_ENABLED=falseandHA_ENABLED=falseon a local machine, in case a Docker container with MQTT support may be running permanently on e.g. a Raspberry Pi):# Create .env file with environment variables:cat.envHA_ENABLED=falseMQTT_ENABLED=falseMQTT_HOST=<mqtt_host>WATTPILOT_HOST=<wattpilot_ip>WATTPILOT_PASSWORD=<my_secret_password># Run the shell:docker-composerunwattpilotshellEnvironment VariablesEnvironment VariableDescriptionDefault ValueHA_ENABLEDEnable Home Assistant DiscoveryfalseHA_PROPERTIESOnly discover given properties (leave unset for all properties havinghomeAssistantset inwattpilot.yaml)HA_TOPIC_CONFIGTopic pattern for HA discovery confighomeassistant/{component}/{uniqueId}/configHA_WAIT_INIT_SWait initial number of seconds after starting discovery (in addition to wait time depending on the number of properties). May be increased, if entities in HA are not populated with values.5HA_WAIT_PROPS_MSWait milliseconds per property after discovery before publishing property values. May be increased, if entities in HA are not populated with values.50MQTT_AVAILABLE_PAYLOADPayload for the availability topic in case the MQTT bridge is onlineonlineMQTT_CLIENT_IDMQTT client IDwattpilot2mqttMQTT_ENABLEDEnable MQTTfalseMQTT_HOSTMQTT host to connect toMQTT_MESSAGESList of space-separated message types to be published to MQTT (leave unset for all messages)MQTT_NOT_AVAILABLE_PAYLOADPayload for the availability topic in case the MQTT bridge is offline (last will message)offlineMQTT_PORTPort of the MQTT host to connect to1883MQTT_PROPERTIESList of space-separated property names to publish changes for (leave unset for all properties)MQTT_PUBLISH_MESSAGESPublish received Wattpilot messages to MQTTfalseMQTT_PUBLISH_PROPERTIESPublish received property values to MQTTtrueMQTT_TOPIC_AVAILABLETopic pattern to publish Wattpilot availability status to{baseTopic}/availableMQTT_TOPIC_BASEBase topic for MQTTwattpilotMQTT_TOPIC_MESSAGESTopic pattern to publish Wattpilot messages to{baseTopic}/messages/{messageType}MQTT_TOPIC_PROPERTY_BASEBase topic for properties{baseTopic}/properties/{propName}MQTT_TOPIC_PROPERTY_SETTopic pattern to listen for property value changes for~/setMQTT_TOPIC_PROPERTY_STATETopic pattern to publish property values to~/stateWATTPILOT_AUTOCONNECTAutomatically connect to Wattpilot on startuptrueWATTPILOT_CONNECT_TIMEOUTConnect timeout for Wattpilot connection30WATTPILOT_DEBUG_LEVELDebug levelINFOWATTPILOT_HOSTIP address of the Wattpilot device to connect toWATTPILOT_INIT_TIMEOUTWait timeout for property initialization30WATTPILOT_PASSWORDPassword for connecting to the Wattpilot deviceWATTPILOT_SPLIT_PROPERTIESWhether compound properties (e.g. JSON arrays or objects) should be decomposed into separate propertiestrueHELP improving API definition in wattpilot.yamlThe MQTT and Home Assistant support heavily depends on the API definition inwattpilot.yamlwhich has been compiled from different sources and does not yet contain a full set of information for all relevant properties.
SeeAPI.mdfor a generated documentation of the available data.If you want to help, please have a look at the properties defined inwattpilot.yamland fill in the missing pieces (e.g.title,description,rw,jsonType,childProps,homeAssistant,device_class,unit_of_measurement,enabled_by_default) to properties you care about.
The file contains enough documentation and a lot of working examples to get you started.