433mhz, infrared IR to and from MQTT on ESP8266

Thanks for this explanation,

You are right if we use the ack current functionnality you will have to choose into HA config between ack topic and 433tomqtt topic.

If I sum up HA can have 2 kind of data from the gateway:
-feedback when sensing a command to the gateway that indicates that the gateway received it
-data coming from signals published to mqtt

And it should be the same topic to be able to update HA switches when pressing a button from a remote or the HA command.
You could use optimistic: true but you prefer that the gateway says that it received the message so as to update the switch.

Am I right?

One other track; is it not the goal of MQTT QOS level 1 to handle that ?

You are right :slight_smile:

Yes you could use optimistic: true but basically you than ignoring the state topic i.e. you could even leave it out of the config.

MQTT QOS is quality of service on protocol level and you don’t really want to use it as you can end up with resend of packages. The ACK we are talking about here is on service/application level.

But in principle we are only confirming that the gateway has received a command and successfully transmitted it via RF… this doesn’t mean that the switch has received it and turned itself on or off… however it is just nice to have the interface updated either way

Ok clear to me, i will update the code and the wiki with this function, thanks for your participation

@ronvl @craigcarps
I have made the modification to send back the payload here if you have some time to test don’t hesitate

Thanks for the idea, added to the code

I am scared now to update as i had problems to upload the sketch… i used the webbrowser arduino to upload and it worked but as i am not that familiar with all of this i might want to let it as it is till someone would provide a step by step tutorial for this :stuck_out_tongue: Thanks anyway for your efforts

Cheers, I’ll take a look tonight

Thanks, will try it next week :slight_smile:

You might want to make a short how to? I’m really not that familiar with arduino. Got it working but not sure what and how I did it
:joy:

Hi

I’ve grabbed the new code and had a look. The “home/sensors/ir” MQTT feed now relays the transmitted IR code which is great. However when I used this feed as my state loop my switch seems to turn off for a second and then bounce back to on. I suspect this is due to both states (on/off) being triggered by the same payload value (the same IR code).

I might try using a if then else statement to publish back either a On or Off to designate the two states.
e.g.
if (signalSent == true && String(state) == “Off”){
char state[] = “On”;
trc("State changed to " + String(state));
boolean result = client.publish(subjectGTWIRtoMQTT, state); //datacallback);
if (result)trc(F(“Acknowedgement of reception published”));
} else if (signalSent == true && String(state) == “On”){
char state[] = “Off”;
trc("State changed to " + String(state));
boolean result = client.publish(subjectGTWIRtoMQTT, state); //datacallback);
if (result)trc(F(“Acknowedgement of reception published”));
}else{
trc(“State un-changed”);
trc(state);
}
if (result)trc(F(“Acknowedgement of reception published”));
}

Unfortunately my state variable stays as a constant and never changes (char state[] = ‘Off’), I think its cause the PubSub library publish function wants a constant char value as the message.

Hello,

Have you seen this wiki?

Hello,

Indeed as it is the same code for on and off i’m not sure this new acknowledgement function is usefull in this case, optimistic : true could be a bypass before finding another way.

i saw this wiki but couldnt figure out exactly how to change the files . a step by step would be great though … :frowning:

Hello,

I have a request on the openmqttgateway github.
Asking to be compatible with homie convention

I’m investigating time on this but before going further i would like to know the degree of compatibility with home assistant.
My main concern is about the fact that several mqtt payload must be sent in case one needs to send a rf signal with some particular parameters.

Currently if you want to send a signal with a special protocol or pulselength you set it into the topic:
home/MQTTto433/433_1/PLSL_360 123456
In one mqtt message we are able to send 123456 and other parameters.

With the homie convention we will have to publish 3 messages:
homie/openmqttgateway/rf-send/plsl/set 360
homie/openmqttgateway/rf-send/protocol/set 1
homie/openmqttgateway/rf-send/set 123456

I would like to have your thoughts on that, can this example be implemented easily into home assistant ?

Hello,

Just added publication of advanced IR data to MQTT, now it will be easier to identify the protocol of the remote control.

home/sensors/ir 875849879
home/IRtoMQTTAdvanced Value 875849879 Bit 32 Protocol 7

The number returned by the gateway correspond to the position of the protocol in the enum decode_type_t of this file begining at RC5=1

In the case above it is a samsung one

Hello @1technophile im getting below error when compiling in IDE

WARNING: Spurious .github folder in 'Adafruit NeoPixel' library
C:\Users\Ashfaq\Downloads\OpenMQTTGateway-master\OpenMQTTGateway-master\OpenMQTTGateway\OpenMQTTGateway.ino: In function 'void receivingMQTT(char*, char*)':

OpenMQTTGateway:349: error: 'class IRsend' has no member named 'sendCOOLIX'

     irsend.sendCOOLIX(data, 24);

            ^

OpenMQTTGateway:362: error: 'class IRsend' has no member named 'sendLG'

     irsend.sendLG(data, 28);

            ^

exit status 1
'class IRsend' has no member named 'sendCOOLIX'

will you please help me?

Hello,

Please check the arduino ide version that you are using and library versions, in particular irremote for esp8266, you should have the last ones available.

Regards

it worked thanks. I’m using IR part what I’m trying to do is if my roommate turns off AC from remote then HA to turn it back ON. I tried reading the OFF button on Ac remote the numbers which I get is not same… it will be different every read. Anyway, I can do this automation?

Did you check the info published into ir advanced topic?
You should have the protocol also into this topic, when it is equal to -1 don’t take into account the value given.

Regarding your automation it should be possible but i let the ha expert answer your question.

The program is now able to remove duplicates even if you have several gateways installation, here is how it works