arachnetech / homebridge-mqttthing

A plugin for Homebridge allowing the integration of many different accessory types using MQTT.
Apache License 2.0
462 stars 104 forks source link

onValue and offValue parameters separated for getOn and setOn Topics in LightBulb and Outlet #528

Closed digitaldex closed 2 years ago

digitaldex commented 2 years ago

Hi, i have a problem with lightbulb-OnOff and outlets. I have some kind of toggle switch that needs 1 as onValue and 1 as offValue for the setOn topic. The getOn Topic on the other hand works with 1 for On and 0 for Off state. I managed to get it running with this config:

"type": "lightbulb-OnOff", "name": "Light", "url": "ip", "username": "name", "password": "password", "topics": { "getOn": "stat/light", "setOn": "cmnd/light/Power" }, "integerValue": true, "onValue": "1", "offValue": "1", "accessory": "mqttthing"

Only Problem is, that the status update does not work if i use the button on my wall.

What i need is a pair of "on/offValue:" for different topics:

"type": "lightbulb-OnOff", "name": "Light", "url": "ip", "username": "name", "password": "password", "topics": { "getOn": "stat/light", "setOn": "cmnd/light/Power" }, "integerValue": true, "onValueSet": "1", "offValueSet": "1", "onValueGet": "1", "offValueGet": "0", "accessory": "mqttthing"

Is there any chance you could add this feature to future releases?

arachnetech commented 2 years ago

I think you could use an apply function on the set topic to 'encode' the on value as always 1.

digitaldex commented 2 years ago

Thanks alot! This gave me the right direction