Skip to content

1.3.0

Compare
Choose a tag to compare
@hostcc hostcc released this 28 Aug 12:44
· 166 commits to master since this release
47c9bad

What's Changed

Fixed processing online sensor to properly reflect its state

If no MQTT responses are seen from the clients for more than config.general.intercycle_delay the client will be considered disconnected and last will be be sent indicating online state being 'off'. Previously, each cycle of interacting with meter had pair of connect/disconnect MQTT client calls so last will is not activated if the program dies in between invocations.

  • Introduced MqttClient.connect() method that supports multiple calls to it while performing actual connect only once (if underlying MQTT client isn't connected already)
  • Added EnergomeraHassMqtt.finalize() method that is now performs MQTT client disconnect only at the end of processing, when the program is about to exit
  • Set MQTT keepalive to interval between meter interaction cycles (config.general.intercycle_delay), so that MQTT broker will consider the client disconnected upon that internal if no MQTT traffic is seen from the client. Please note the interval could be shorter due to the use of asyncio_mqtt, since its asynchronous task runs in the loop and can respond to MQTT pings anytime in between meter cycles.

tests/test_online_sensor: Tests adjusted to cover normal program run against real MQTT broker

  • The MQTT broker fixture now supports managing users/password via pytest mark mqtt_broker_users (currently unused)
  • Added test_online_sensor_normal_run test that performs normal program run against real MQTT broker and validates proper online sensor states are sent

README.rst updates

  • Added mentions of explicit Docker image variant if it isn't selected properly (seems happening with ARMv6 only)
  • Added documentation for config.mqtt.tls property
  • Added clarification to config.general.intercycle_delay is also used as MQTT keepalive interval