In OpenHab you can add a mapping file to adress the conversion between the values that are coming from the gateway remote and the corresponding switch state. In home assistant you can search maybe about templates and use the state topic when configuring your switch.
These ideas are just tracks as I don’t have HA i m not able to test.
I have read about MySensors but I’m not sure they have the same capability of responding back to Home Assistant via an MQTT topic to report that the status changed outside of HA (like a remote).
I just switched to a Raspberry Pi with an AIO install from a Linux Mint Computer to help with zwave devices… That’s another story… Is that an RPI?
I am trying to get the alarmdotcom platform to work (again another story) but I noticed that the MQTT Alarm Control Panel actually listens to a topic to do a static change… so it’s possible for HA to listen to a topic and do what I want… Maybe I can modify that?.. So it could also be possible to make the Etekcity remotes “smart” this way by sending a status via a topic…
Again, I’m a newbie but thanks for allowing me to talk out loud.
mysensors has 2 way communication possible.
you can make an arduino wo listens to remote and tell HA to change the setting, as well as that you can use HA to change the setting and send it to the arduino who then makes an action.
i have quite a few cheap (old) 433 mhz switches which i control with HA through mysensors.
at the same time i have arduinos with relays that i control in the same way.
i have quite a few arduinos with temperature, light, motion and humidity sensors, and i have automations based on those to control my cheap switches, all trough mysensors.
i dont know what you mean by “a topic” if you mean a file then thats possible.
topic as in MQTT topic. Thanks ReneTode! Looks like I’ll be doing some more reading on it. I’ll definitely be switching to mysensors since it can relay the remote info back to HA. I don’t want to reinvent the wheel…
i had made my own communication protocol and had made my own frontend before i came to mysensors and HA
but now i love both (almost all of the time ) and they control my house. arduinos control my heating devices, my lights, my irrigation, my aquariums, and more.
In an earlier post with ReneTode, I stated I was going to switch over to mysensors. Well I was looking into that today and was trying to figure out which sensor to make - it seems all the info on the website is about the gateway and not much on each sensor…
Anyway… I went back through the forum here looking for the sensor and noticed that 1technophile had also posted. (I think he uses OpenHab) So I re-read what he had said since he invented the 433toMQTTto433 Gateway that I’m currently using. He stated “In home assistant you can search maybe about templates and use the state topic when configuring your switch.”
So I took another look at templates which got me looking at the MQTT switch component… Turns out I didn’t have this configured correctly to begin with. I added “state_topic” for Hass to “listen” to the remotes. My mistake before was not adding the “optimistic: true” which is what makes it work.
Here is the configuration that works. And I didn’t change the code just in case your in Seymour Indiana and want to mess with my office fan. (fun!)
I wonder how hard would it be to make 433toMQTTto433 Gateway hardware to also host an IR emitter/receiver. I had this dual 433/IR setup on RPi2 working, but in stateless mode (not remembering what status a switch is in).
Why not throw some sensors like DHT22 into the circuitry as well? It would be awesome if it can publish the temperature and humidity to the MQTT as well.
// add this line into the loop method TempAndHumAndVolt(); // send local data of temperature and and voltage humidity
void TempAndHumAndVolt(){
if (millis() > (time1 + 33300)) {//retriving value of temperature and humidity of the box from DHT every xUL, must not be a multiple of previous value to avoid concurrency between sensors
time1 = millis();
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t)) {
trc("Failed to read from DHT sensor!");
}else{
sendMQTT(HUM1,String(h));
sendMQTT(TEMP1,String(t));
}
}
if (millis() > (time2 + 3600000)) {
time2 = millis();
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h2 = dht2.readHumidity();
// Read temperature as Celsius (the default)
float t2 = dht2.readTemperature();
// Check if any reads failed and exit early (to try again).
if (isnan(h2) || isnan(t2)) {
trc("Failed to read from DHT2 sensor!");
}else{
sendMQTT(HUM2,String(h2));
sendMQTT(TEMP2,String(t2));
}
//retriving value of voltage of the box
int val = 0;
val = analogRead(4);
trc(String(val));
sendMQTT(VOLT,String(val*0.0194));
}
}
Not close to Seymour, but would be happy if I could mess with my own 433 devices! lol
Question: the state_topic: “home/433toMQTT”, how do you get that particular data?
I have a node-red setup with 433 and Im trying to have HA send 433 binary codes through HA to MQTT to control my 433 (doorbell, fan, etc)
I know it may sounds like a stupid question but I tried something similar:
@aelg305,
The command topic is the MQTT topic that HA uses to send codes to the device.
To answer your question, the state_topic is the mqtt topic to listen to data from an external source which in my case is the remote control that came with my switch. So if your fan has a remote control, you press the button on the remote and the 433toMQTTto433 gateway would “hear” that remote too (like the fan did) and send the MQTT traffic to HA to change the state of the fan so that HA in synch with the fan’s status.
I’m not familiar with node-red, but you didn’t mention your MQTT broker which is needed to “operate” the traffic for MQTT topics. I use Mosquitto (an MQTT broker) on the same Pi with HA. After Mosquitto is setup and you can listen and send mqtt manually, don’t forget to add this information to HA with this configuration.
mqtt:
broker: 192.168.xxx.xxx
port: 1883 (match to yours)
client_id: xxxx (mine is named hass)
keepalive: 60
@Partybug i know you have a some 433 mhz etekcity, but i have a question for you.
i have a similar etekcity, but the other debrand.
its has one phisically button, its possible when i press the phisically button , HA knows the state of etekcity?
got the topics working:
using node red, I used the “debug” function.
To answer the question about the broker: mosquitto as well, setup similar to yours.
Im able now to send messages from the hass “set state” page manually, working now on getting the same results with automation, etc.
How many devices do you think you could safely proxy thru an arduino? What about multiple events coming in at the same time (or when it is pushing the message to mqtt)?
I have 15 devices emitting by 433mhz running without problem. Difficult to say what could be the maximum quantity that could pass to the arduino, a load test should be done. I 'm quite confident If I increase the number of sensor to 20-30 it will be ok.
About multiple events coming at the same time, before having a bottleneck with MQTT you could have a wave superposition in 433mhz.
I did some test with two remote control sending two different code, if I press the two buttons at the same time the signal is not caught. If I introduce a little gap less than 0,5s the both signals are read. Indeed my sensors are not able to receive an acknowledgement so as to know when the message is caught by the gateway. By the way not able to repeat in case of a message not received.
For my home automation this constraint is not disturbing me I don’t need to have acknowledgement, I prefer to have several cheap sensors compared to one with acknowledgement more expensive.
Regarding the other direction pushing the message from MQTT to 433mhz it is working well, the gateway is not pushing signals at the same time. I have some scene that require several plugs to be turned ON and they are turned ON one by one.