Move To HASS MQTT - Nodes not responding
Hello, I was planning to move away from OpenHab to Home Assistant and I started configuring my nodes in HASS. I have the MQTT up and running, and I have it configured in HASS, they appear and I can controll them. The problem is a lot of miss messages. In OpenHab I was able to do ON OFF ON OFF fast and the lamps would go on off, "never" (rarely) missing a cycle. In HASS I turn on the lamp, but when I go to put off it fails.
I remember in OpenHab I had to make a small tweak to the config to make this work, QOS 2 and turn off asynchronously.
What are your experiences with MQTT GW and the response time and viability?
Ok, I made a test adding manual, and it works... the problem is in the auto added switches
switch: - platform: mqtt name: "My Light" command_topic: "mygateway1-in/1/2/1/0/2" payload_on: "1" payload_off: "0" optimistic: false qos: 2
All works ok! With the auto added switch I click on... the light comes on, and immediately the switch goes to off... Only 30 seconds later (my node sends a updated status message every 30 seconds) the node goes to ON (the real state)
You need to send/feedback the new state to home assistant from the node in the receive function. Otherwise home assistant thinks the message was not received by the node. This behavior is modified by the optimistic setting in the mysensors config section.
Thank you @martinhjelmare it was that! One last question that I don't know if it's related! The first time that HA discovered my nodes (power cycle) the created items where with a toggle switch and under a card named lighs (I think that it was that). Now I deleted the mysensors.json file and added the items again, and now they are detected as interruptor and the switch is a lightning bolt. No major problem in that, just trying to understand the reason... It's the same nodes, no code changes.
If you changed the optimistic setting, actuators will have assumed state and this will show in the ui as two different buttons for on and off.
I recommend to not use optimistic setting, but instead feedback the new state to home assistant.