wutu / pimatic-mqtt

MQTT plugin for Pimatic
https://pimatic.org/plugins/pimatic-mqtt/
GNU Affero General Public License v3.0
9 stars 13 forks source link

MQTT-Presence: Accept boolean as onMessage / offMessage #45

Closed georg90 closed 4 years ago

georg90 commented 5 years ago

Hi,

my Xiaomi presence sensors report their state via a boolean (true/false). Could we enable to accept boolean as onMessage/offMessage?

MQTT publish: topic 'zigbee2mqtt/0x00158d0001ad4694', payload '{"occupancy":true,"linkquality":99}'

Else we could cast the incoming message to string?

Thanks a lot!

mwittig commented 4 years ago

Hi, I think the problem is that the MqttPresence sensor can only deal with simple payloads (e.g. "true", "false" strings) right now, and it is not possible to use a certain property inside a JSON payload.

mwittig commented 4 years ago

I have tested your scenario and as far as I can see it works as expected with the new JSON parse feature

mwittig commented 4 years ago

released pimatic-mqtt@0.9.13

Please re-open if you're still seeing the issue