### Install APS2MQTT Manually Source: https://github.com/fligneul/aps2mqtt/blob/main/README.md Install APS2MQTT from a downloaded wheel file. Replace '[version]' with the specific version number you have downloaded. ```sh pip3 install aps2mqtt-[version]-py3-none-any.whl ``` -------------------------------- ### Unsecured MQTT Connection Example Source: https://github.com/fligneul/aps2mqtt/blob/main/README.md Configuration for an unsecured MQTT connection. Ensure MQTT broker details and ECU settings are correctly specified. ```yaml ecu: APS_ECU_IP: '192.168.1.42' APS_ECU_TIMEZONE: 'Europe/Paris' APS_ECU_STOP_AT_NIGHT: True APS_ECU_POSITION_LAT: 47.206 APS_ECU_POSITION_LNG: -1.5645 mqtt: MQTT_BROKER_HOST: '192.168.1.12' MQTT_BROKER_PORT: 1883 MQTT_BROKER_USER: 'johndoe' MQTT_BROKER_PASSWD: 'itsasecret' MQTT_RETAIN: True MQTT_DISCOVERY_ENABLED: True ``` -------------------------------- ### Docker Compose Configuration Source: https://github.com/fligneul/aps2mqtt/blob/main/README.md Example Docker Compose setup for APS2MQTT. Environment variables are used to configure the service, including timezone and MQTT settings. ```yaml services: aps2mqtt: image: fligneul/aps2mqtt:latest restart: always environment: - TZ=Europe/Paris - DEBUG=True - APS_ECU_IP=192.168.1.42 - APS_ECU_STOP_AT_NIGHT=True - APS_ECU_POSITION_LAT=47.206 - APS_ECU_POSITION_LNG=-1.5645 - MQTT_BROKER_HOST=broker.hivemq.com - MQTT_BROKER_PORT=8883 - MQTT_BROKER_USER=johndoe - MQTT_BROKER_PASSWD=itsasecret - MQTT_BROKER_SECURED_CONNECTION=True ``` -------------------------------- ### Start APS2MQTT from Command Line Source: https://github.com/fligneul/aps2mqtt/blob/main/README.md Run the APS2MQTT module directly using Python. Use the -h flag to view available command-line options. ```sh python3 -m aps2mqtt -h ``` -------------------------------- ### Install APS2MQTT via PyPI Source: https://github.com/fligneul/aps2mqtt/blob/main/README.md Install the APS2MQTT package using pip. It is recommended to use a virtual environment for better dependency management. ```sh pip3 install aps2mqtt ``` -------------------------------- ### Secured MQTT Connection Example Source: https://github.com/fligneul/aps2mqtt/blob/main/README.md Configuration for a secured MQTT connection using TLS. Set MQTT_BROKER_SECURED_CONNECTION to True and use the appropriate port. ```yaml ecu: APS_ECU_IP: '192.168.1.42' APS_ECU_TIMEZONE: 'Europe/Paris' APS_ECU_STOP_AT_NIGHT: True APS_ECU_POSITION_LAT: 47.206 APS_ECU_POSITION_LNG: -1.5645 mqtt: MQTT_BROKER_HOST: 'broker.hivemq.com' MQTT_BROKER_PORT: 8883 MQTT_BROKER_SECURED_CONNECTION: True MQTT_DISCOVERY_ENABLED: True MQTT_DISCOVERY_PREFIX: 'custom_discovery' ``` -------------------------------- ### Old Manual MQTT Sensor Configuration Source: https://github.com/fligneul/aps2mqtt/blob/main/README.md This is an example of a manual MQTT sensor configuration for ECU power before the introduction of MQTT Discovery. ```yaml mqtt: sensor: - name: "ECU Power" state_topic: "aps/123456789/power" unit_of_measurement: "W" ``` -------------------------------- ### New Manual MQTT Sensor Configuration (without Discovery) Source: https://github.com/fligneul/aps2mqtt/blob/main/README.md This is an example of a manual MQTT sensor configuration for ECU power after the topic structure change, when MQTT Discovery is not used. It requires a value_template to parse the JSON payload. ```yaml mqtt: sensor: - name: "ECU Power" state_topic: "aps/123456789" unit_of_measurement: "W" value_template: "{{ value_json.current_power }}" ``` -------------------------------- ### Configure APS2MQTT as a Systemd Service Source: https://github.com/fligneul/aps2mqtt/blob/main/README.md Example systemd service unit file to run APS2MQTT automatically on boot and restart it on failure. Ensure the ExecStart path points to your virtual environment's Python interpreter and configuration file. ```yaml [Unit] Description=APS2MQTT After=multi-user.target [Service] Type=simple User=user Restart=on-failure ExecStart=/path-to-your-venv/python3 -m aps2mqtt -c config.yaml [Install] WantedBy=multi-user.target ``` -------------------------------- ### Test ECU Connection with Netcat Source: https://github.com/fligneul/aps2mqtt/blob/main/README.md Use Netcat to verify connectivity to the APsystems ECU on port 8899. This helps confirm the ECU is reachable and ready to receive commands before starting APS2MQTT. ```sh nc -v 192.168.1.42 8899 ``` -------------------------------- ### Enable MQTT Discovery Source: https://github.com/fligneul/aps2mqtt/blob/main/README.md Enable MQTT discovery to automatically integrate with home automation platforms. This publishes configuration messages for device discovery. ```yaml mqtt: # ... other mqtt settings MQTT_DISCOVERY_ENABLED: True # Optional: Change the discovery prefix if your platform requires it MQTT_DISCOVERY_PREFIX: 'homeassistant' ``` -------------------------------- ### ECU Ready to Receive Commands Source: https://github.com/fligneul/aps2mqtt/blob/main/README.md A successful connection to the ECU will result in a specific message, confirming its readiness to accept commands. If this message appears, the ECU is prepared for APS2MQTT. ```sh APS1100160001END ``` -------------------------------- ### Test ECU Connection with Netcat Source: https://github.com/fligneul/aps2mqtt/blob/main/src/aps2mqtt/apsystems/README.md Use the Netcat command to test the connection between Home Assistant and your APsystems ECU. Ensure you use the correct IP address of your ECU. ```bash [core-ssh .storage]$ nc -v 172.16.0.4 8899 <┘ 172.16.0.4 (172.16.0.4:8899) open APS1100160001END <┘ APS11009400012160000xxxxxxxz%10012ECU_R_1.2.22009Etc/GMT-8 ``` -------------------------------- ### ECU Connection Confirmation Source: https://github.com/fligneul/aps2mqtt/blob/main/README.md The expected response from the ECU when a Netcat connection is successfully established. This indicates the ECU is ready for communication. ```sh 192.168.1.42 (192.168.1.42:8899) open ``` -------------------------------- ### Convert Non-Numeric Temperature to Zero Source: https://github.com/fligneul/aps2mqtt/blob/main/src/aps2mqtt/apsystems/README.md Use this template to convert non-numeric temperature readings (often from offline inverters) to zero for gauge indicators. This prevents errors when inverters are off. ```yaml temperature_non_numeric_408xxxxxxxxx: value_template: "{{ states('sensor.inverter_408xxxxxxxxx_temperature')|float(0) }}" unit_of_measurement: "°C" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.