My goal is to control two ZWave switches connected to a 2nd remote instance of HA in the UI of the first HA instance.
To this end I have:
A “main” HA and a “remote” HA instance (ie master/slave).
Two ZWave switches connected to the remote HA. They are visible in the remote UI and working.
On the remote HA I have setup MQTT StateStream:
The state_topic is what I see coming in on the MQTT broker. The switch state is correctly displayed in the main UI.
So far so good. Now I want to be able to control the switch through the main UI. My understanding is that StateStream is one way (ie to the MQTT broker, not listening to it), so I made up the command_topic.
This is so that the button in the main UI sends an MQTT message that is picker up by the remote HA.
Result: it works (yeah!) but feels clunky. The button in the main UI toggles between on and off because it will only display the correct state after the MQTT round trip. Secondly, it seems like a lot of work just for 1 switch.
There must be a better way to two this. Suggestions Appreciated!
You need the state_stream on both, one as master and one as slave, nothing else needs to be done as the states etc will propagate between the two. At least that’s how I do mine as Win 10 can’t do zwave but my pi can
Ahh sorry I’m using event_stream not state_stream So ignore me
I do pretty much the same thing with my zwave switches. Mine doesn’t have the issues with toggling like you’re describing. If you use a MQTT client and subscribe to those two topics, is there a delay for the messages coming up?
One thing I noticed that may be causing a slow down, is that you have attributes and timestamps on. Which means that there is a lot of extra information being sent that you don’t seem to be using. At least from what you’re saying here. You can also limit statestream to just the switches you’re using it for to cut down on that even more.
I’ll double check my config when I can to see if there’s anything different between our setups. That’s the only thing I can think of currently.
@aterox I’ve reduced the number of MQTT messages and , indeed, the toggling goes away. Thanks!
Still the solution of the Statestream going one way and MQTT commands going the other way and being picked up by the automation rules feels clunky. Fortunately I have only 2 switches.
@keithh666 how does it work with EventStream? In another thread it was mentioned that Statestream was preferred in some way.
I run win 10 HA as main and an RPI 3 as a slave (running hass.io) with my zwave and xiaomi gadgets on the slave as they don’t work on win 10. This all works well except that the states of everything is propagated to the slave as well, currently 7 times so everything on the slave is sent to the master and then sent back to the slave. So the frontend looks a complete mess on the slave, however it all works well in that I can control the RF Link on the master from hass.io and the master (win 10) can control the zwave and xiaomi devices on the slave. But if anyone can help on the frontend or suggest where I’m going wrong with the eventstream I’m all ears What I think is happening is that when I restart the win 10 HA it propagates a new copy of the data from the slave thereby increasing the copies of the sensors etc. See pic below…
I currently do it with ~10 switches. I agree it’s not the most ideal method, a component to do this would be ideal.
I used to use eventstream, but didn’t like how there’s no way to filter the events and that the devices will disappear off the main instance’s front end after a while of not being updated.That’s why I prefer the roundabout method with statestream.
You could always set a default view with only the devices you want to show up, which should get rid of the automatically propagated ones.
Are you restarting the main instance with the button in the ui or manually? If you restart it through the ui, eventstream will also restart the slave instance, which may help get rid of the devices
Yep I noticed that if I restart hass.io they go away until I restart the win 10 end. Thanks for the pointer, I have default view on the win 10 end, but forgot to set it up for the hass.io end I did start looking at statestream but felt it was too much work with all the devices I have, maybe I should have kept going with it
Did you publish a custom component after your PR was rejected? I find the existing MQTT approach to be so complex and unreliable to the point of uselessness. Would be interested in using a custom component for websocket communication.