Thanks, I’ll try that now. Also have an old remote and going to use the IR from that.
be carefull also about garbage codes you can receive, repeat the push on your remote control several time to extract the code that is coming back each time.
Changing to sendNEC worked. Turned the telly off while missus was watching Eastenders.
I found sending the codes from the remote under and tea towel cut out a lot of the noise.
Thank you so much for this work!
Last question.
I use RF already on Pi and with emulated Hue my echo dot can control them. Will this work with IR switches too?
To answer my own question: yes it does. Came up as a smart device in Alexa app and acts as a switch. Loving HA more everyday.
Hi
I have a similar setup to yours but I am trying to control my IR Dimmable light switch using an IR Remote. I have decoded the IR Codes for my IR remote and I want to now use them to operate the switch using esp8266 board and connecting it to MQTT which will then be operated by HA via MQTT.
Could you please help me? and share your (IR + MQTT + HA) setup/project?
Many thanks.
After days of trying this is what worked for me. I’m not interested in receiving to HA so I put the state topic as #. As recommended earlier I had more luck using home/command/SendNEC (worked on LG TV and Xbox one). You will have to try all the send… commands to see which works for you.
In terms of a switch I tried to group them but my knowledge of YAML is still poor so I clumsily made each switch like this, it gets the job done:
switch tv: (no space before)
platform: mqtt (2 space indent for all the rest)
name: “TV”
state_topic: “home/commands/#”
command_topic: “home/commands/sendNEC”
payload_on: 551489775
payload_off: 551489775
optimistic: false
retain: true
Hope it works for you and good luck.
Thanks for this.
Did you do any changes to the sketch?
@bachoo786 I’m catching up to you on the forums. I’m glad you asked around. There would be no change to the sketch, even if your not using the 433 Mhz component. The sketch simply receives the code you put into HA via the MQTT topic and transmits this via IR. It also does this in reverse.
To make this dim-able at the moment would require creating several instances of the switch, one with the codes for on/off, one substituting the codes for 25% and 50% etc.
I’m wondering if there isn’t a component already created for HA that has a slider for dim-able switches that could be used or altered. Or even something like mysensors…
Sketch has been updated to remove duplicates of code (RF to MQTT direction) see here for documentation
Hi
I am having difficulties with the MQTT on Arduino. On Serial Monitor it says :
-2
try again in 5 seconds
Attempting MQTT connection…
failed, rc=
-2
try again in 5 seconds
Attempting MQTT connection…
and keeps on looping. I have uploaded the code successfully and the board is 2.3.0 it is a Wemos D1.
Can you please help?
Hi Haas
Can you please share your IR circuit I have managed to get MQTT wor king and everything is connected to HA but only for the circuit which I think is incorrect as I am try to emit the codes via the IR LED but it doesn’t seen to do anything.
Thanks.
I didn’t change any part of the sketch, I only added my ssid, password, MQTT address MQTT username and password. Leave the rest.
Nice one, Thanks for all your hard work.
This is amazing i been thinking how can add 433mhz components in to HA. Now can’t wait to go home from holiday to play with it.
My goal is to have two or three ESP8266 nodes around my house. I successfully replicated this project with one ESP8266 node so I added a second one to the mix. This node has a different client name, IP address, etc. but when I turn on the second node only one of them seem to work. I change the order of plugging in etc and basically the second unit turned on wins. So, I figured maybe they need different topics (home/upstairs/commands/MQTTto433, home/downstairs/commands/MQTTto433
) to subscribe too and this hasn’t worked out either. I’m not clear on how to differentiate between the two (or three).
By different client name you mean that you have modified this line on one of the two esp ?client.connect("433nIRtoMQTTto433nIR")
.
If yes it could be interesting to wire the both by usb and have two serial monitor to check the traces and point out where the second one bug.
Just wanted to say thanks. It works very well for me.
Now I don’t need to write my own =)
I am having difficulties with the MQTT on Arduino. On Serial Monitor it says :
-2
try again in 5 seconds
Attempting MQTT connection…
failed, rc=
-2
try again in 5 seconds
Attempting MQTT connection…
SOLVED
Edit:
// If you want to use a username and password, uncomment next line and comment the line if (client.connect(“433toMQTTto433”)) {
if (client.connect(“433toMQTTto433”, mqtt_user, mqtt_password)) {
// and set username and password at the program beginning
// if (client.connect(“433toMQTTto433”)) {
ok now i have other problem… now i am connected my broker:
ÿConnecting to
Casa
.
.
WiFi connected
client mqtt not connected, trying to connect
Attempting MQTT connection…
connected
subscription OK to
home/commands/#
but i dont receive the message;
"Hey I got a callback "
how can i do??? @masterkenobi @1technophile @prefectionist
Hello,
Did you try to publish a message like stated in the tutorial?
If you have mosquitto:
mosquitto_pub -t home/MQTTto433/ -m 1315156