Home Assistant Publish MQTT for a "Physical Switch"

Hello Everyone,

I am pretty new to Home Assistant, so please bear with me. What I’m trying to accomplish is manipulating a “Physical Switch” from HomeSeer to Home Assistant. All the documentation on MQTT that I see on Home Assistant seems to cover how to subscribe and publish to switch over MQTT switches that aren’t seen as "Physical on Home Assistant.

Basically what I am looking to do is control this switch created with Home Assistant. The purpose of this switch is to turn on and turn off my Xiaomi Mi Smart Vac. The switch works great as I was able to follow the documentation (with some modifications of my own) to get it to work. Now this switch is viewed as “switch.vacuum” under entities in HomeSeer.

My MQTT broker itself is all set up properly. I have a MQTT broker that is all set up in Home Assistant and I’m using a MQTT plugin in HomeSeer. I can verify HomeSeer connects in properly. I am just not sure how to proceed from here. If I had to take a guess, I believe I would have to set up a MQTT switch, but not sure how to connect it to the physical switch I have in Home Assistant. Ideally, I would like to communicate the status and other values that the Home Assistant Vacuum Switch I created has. Please see the screen shot of what I have. Any assistance would be greatly appreciated.

49 PM

The instructions for setting up an MQTT switch in HA are here It doesn’t matter whether the switch is physical or ephemeral, HA will just send MQTT messages to turn it on or off.

However, you seem to have more than that, so I’m not entirely sure that is really what you need. If you could explain your set up a little more, it would be useful. Where does HomeSeer fit in? Is that picture from HA or HomeSeer?

I too had trouble understanding the setup. I’m not familiar with HomeSeer but wanted to add that the mqtt switch in Home Assistant can get an “update” from another source to correct the state in Home Assistant.

For example: I can use an RF remote (instead of HA) to turn off a light and HA will update the state to match.

This is done with the “state_topic:” setting. My arduino listens for the remote signal and publishes it to the state topic (like “home/433toMQTT”) and Home Assistant will change the state to match.

Hope that helps.

1 Like

I can definitely explain it some more. Here is some background so that you can see where I am using Home Assistant and where I am using Homeseer. I’m moving on from Vera and decided between Home Assistant and Homeseer for my Z-wave controller. I have an additional requirement of where the primary z-wave controller sends all of my z-wave info to my Simon Xti so that I use so that I can also control all z-wave devices on alarm.com. I tried using Home Assistant as a primary and send to alarm.com.

But the locks never transferred even when the zwave devices are close together. The Vera was guilty of doing this too. I kept having to retry multiple times. Unfortunately Home Assistant’s open z-wave doesn’t appear to handle this well even after retrying multiple times. It just never worked on getting the lock over. HomeSeer does it perfectly. So I decided that all z-wave devices are the Primary on HomeSeer.

I may even replicate the z-wave devices to Home Assistant as a secondary controller if I can ever find the option on how to do this. The Open Z-wave control panel doesn’t have an option to “receive controller information”. Even though I’m using Home Seer for my z-wave, I am interested in using Home Assistant as a compliment to my home automation for items not readily available in Home Seer. One of the items that interested me as this Xiaomi Mi Vacuum integration. I got it all configured successfully in Home Assistant. Now the immediate goal is to have a switch in HomeSeer that I can control. Ideally, I would also like to get what it says in the status and error values. That screen shot is directly from Home Assistant.

Having said that, I made some progress but not with MQTT/Home Assistant. I was able to create the MQTT switches for turning on and off the vacuum. I could trigger them in Home Assistant and they would perform the appropriate actions. I found two issues here. One is that according to another HA post, MQTT doesn’t send all those details like I have on my screenshot. Only Json/Rest does. The other is that the HomeSeer MQTT appears to be flaky in my opinion. I can’t get it to subscribe to the topics that I created in HA.

My end result is that I installed python mirobo and use SSH from HomeSeer to send the commands. It works pretty well. I just need to find out how to get the SSH results and parse the status. I found a workaround, but wanted to answer both of you on what I am trying to do. I know this is definitely out of the norm for typical HA setups.

Thank you for this explanation! You even educated me on the trouble with my own zwave devices using Alarm.com and Home Assistant. I have been meaning to learn more about Z wave and why I can’t seem to get it to HA.

I’m glad you found a work around for the moment. My only suggestion is an automation that will send the data you need via mqtt when you use HA to control the unit. However, not getting HomeSeer to subscribe would still be an issue.

I wish you luck!