nplan / HomeButtons

135 stars 10 forks source link

Button Lable change Iobroker via MQTT #37

Closed Frodonet closed 1 year ago

Frodonet commented 1 year ago

Hi I tried your great Produkt. Alls works fine with my IObroker but to change the Button Labels I didi not find a working way. Can you help me to get a working url Request ?

Regards Frodonet

Taffmailer commented 1 year ago

Hi I would like to join this - super project. I have the same problem and looking for a solution how I can change the label via mqtt in the iobroker environment.

all the best

Zixim commented 1 year ago

Home Assistant sends a MQTT message to homebuttons/Home Buttons XXXXXX/cmd/btn_6_label with payload containing the label. XXXXXX being the device identifier. Next time you press any button, the device will get the message and adjust the label.

Frodonet commented 1 year ago

ok I can send the Message to the device buy instead of my text it shows "null" on the display

nplan commented 1 year ago

{BASE_TOPIC}/{DEVICE_NAME}/cmd/btn_{1-6}_label is the topic used for label text. The default BASE_TOPIC is homebuttons and DEVICE_NAME is what you set it during initial setup. Defaulting to Home Buttons XXXXXX with Xs replaced with the ID. The message should be published with retained flag set, so that Home Buttons receives it when it wakes up.

Since you're getting "null", could you please check with MQTT Explorer what is actually published to the topic?

Taffmailer commented 1 year ago

I have published value "Entry" . After the „home button" was woken up by pressing any button, the data communication took place (Sorry for screenshots, I have not found a full logfile about the history). I hope that this is helpful

Publish CleanShot 2023-03-22 at 09 15 34@2x CleanShot 2023-03-22 at 09 16 08@2x CleanShot 2023-03-22 at 09 16 26@2x
Frodonet commented 1 year ago

I have the same in my MQTT Explorer.

nplan commented 1 year ago

This seems like a MQTT compatibility issue. Which MQTT broker are you using?

When Home Buttons wakes up, it receives the new label command, updates the label and then sends a MQTT message with empty payload to the broker which should then delete the retained cmd topic.

But here something goes wrong. Instead of deleting the topic the payload is set to "null" which updates the label again...

Taffmailer commented 1 year ago

I'm using iobroker with the adapter MQTT 4.0.7. I haven't any problems with my other devices including esp32 via mqtt

nplan commented 1 year ago

This is the problem: https://github.com/ioBroker/ioBroker.mqtt/issues/231#issuecomment-1117701462

On a real MQTT broker you can delete a retained topic by publishing an empty payload. Which Home Buttons does for labels. On the broker that you are using, this does not appear to be supported.

Could you switch the broker to mosquitto? And then only use this adapter in the client mode.

Taffmailer commented 1 year ago

Thanks a lot, I've solved the problem.

... and it works

Frodonet commented 1 year ago

Thanks a lot, I've solved the problem.

  • installed mosquitto at iobroker server,
  • created a separate mqtt instance at iobroker in client mode which connects to mosquitto
  • Topic is homebutton/#
  • configured the retainer flag there
  • and reconfigured the home button (new mqtt broker is now mosquitto)

... and it works

Can you tell me more details ??