Chibald / maestrogateway

Manage MCZ pellet stoves that are equipped with Maestro technology
GNU General Public License v3.0
38 stars 13 forks source link

Option to choose between sending each items value as payload on its own topic or all items as JSON payload #15

Closed tharts closed 3 years ago

tharts commented 3 years ago

This pull request introduces a config option _MQTT_PAYLOAD_TYPE and the according changes to the code. Reason for the change is that its sometimes easier to have distinct messages instead of a bulk in JSON. The default behaviour of the code will stay as is if this option has any value other than 'TOPIC'. If the config option is set to 'TOPIC' then messages arent sent as JSON anymore. Instead the attribute name becomes a subtopic and the attribute value becomes the payload of an mqtt-message.

Chibald commented 3 years ago

Hi tharts,

It looks great! Working with topics looks much cleaner & easier to use. Very nice that you kept it backwards compatible.

I noticed you removed the "no changes" message. The purpose of this message was to send a heartbeat every 15 seconds, even if there a no new values. The MCZ wifi can be a bit unreliable, and I use this to be able to send an alert from openhab if the connection to the mcz device is down for too long. I don't want to wake up in a cold house ;)

But a better approach would be to make a designated state topic like 'pubMCZ/state' and publish online and offline messages. I will try to add this in the coming weeks, when I find some time to implement it.