433mhz, infrared IR to and from MQTT on ESP8266

Yep, but nothing commercial Iā€™m aware of yet :slight_smile:
Would make it accessible for non-DIY people.

PIR sensor addon is available here for test purposes

Thank you to OP and everyone for this gateway.
I got this error trying to compile it.

>     Arduino: 1.8.3 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"
> 
>     C:\Users\DanialD4\Downloads\Arduino\OpenMQTTGateway\ZgatewayIR.ino: In function 'boolean IRtoMQTT()':
> 
>     ZgatewayIR:66: error: 'USECPERTICK' was not declared in this scope
> 
>            rawCode = rawCode + (results.rawbuf[i] * USECPERTICK);
> 
>                                                     ^
> 
>     exit status 1
>     'USECPERTICK' was not declared in this scope
> 
>     This report would have more information with
>     "Show verbose output during compilation"
>     option enabled in File -> Preferences.

I manage to get it working the first time.
This time I try to include dht11 and try to flash it the 2nd time but got the error instead.
Iā€™m sorry if Iā€™m noob but please explain it like Iā€™m 5. :smile:
Thank you.

Hello,

Itā€™s more likely you didnā€™t take the good libraries version corresponding to the OpenMQTTGateway code, the best way to proceed is to take the version pointed in the libraries folder of the source code.

Some explanations about why I added RFM69 to the gateway:

Yes you are right, I tried to launch a kickstart, and yes I hit a wall, I think that the idea is good but Is too much just for one person. The project is complete. The only part missing is the box :disappointed:, any person can use it. The setup takes less than 2 minutes. The process is very simple also you can go to the web console, add a remote control for your TV, DVD, etc.

if you have an Alexa, you can use the skill to turn on/off your tv, DVD etc. but also you can mute/pause increase/decrease the volume even change the input. Ex Alexa change input to HDMI1 on TV,

Also, I working on the possibility to add activities, for example when you say Alexa turn on Netflix, this will turn on the TV, Turn on the Roku, change the input on the TV, etc etc, The idea is that via the web you can set up the steps to do.

Yes, I know that there are solutions, but I want to make the process simple. I created a new topic take a look here Remotsy at ESP8266 infreared device

Hey, itā€™s working. Thank you so much.
Itā€™s weird. I downloaded the respected library from the release version using your library repo and couldnā€™t work but when I download the zip it work.
Same as your code, many error pop-up if I use the release version.
Or maybe itā€™s just me who didnā€™t know how github work.

Strange, I removed all the libraries, redownloaded them and recompiled without any issue

Yeah, I mean which one of the github page should I click if I want the source code? The release tab or the ā€˜clone or downloadā€™ tab?
Note that the gateway already working, Iā€™m just asking something about the github page.
I notice the code from the version 0.3.1 on the release tab is different from the one on ā€˜clone or downloadā€™ tab.
Anyway, thanks for the help.
I have a few other questions, but Iā€™ll probably asking it later.

You should download a stable release, the master and beta releases are for tests only

@1technophile

Hi, Iā€™ve tested during weekend the ADC reading. The sketch didnā€™t compile for Arduino Mega (error below) however it compiled fine for NodeMCU v3. Probably I donā€™t have all the libraries but I havenā€™t investigated further.

It has worked quite reliably, there were differences in value readings compared to the other sketch that Iā€™m using for ADC (Bruh code) however these are quite normal and acceptable as the ADC is not calibrated (also Bruh code updates the light level immediately if changed).

Initially I thought 30s between readings would be an issue however I realized that it simply doesnā€™t need a quicker update for light level as the sunset doesnā€™t occur in one second :slight_smile: and I havenā€™t modified the sketch to decrease it. Anyway, also the MQTT broker is happier with publishing at this rate.

Although, for automations that need instant update reading from light sensor (such as to get feedback from the light bulbs after turning on or off) I think it should be modified to a 1/4 of a second or lower however it just need to modify the sketch. Also, a low response time is needed if using for stuff like open door sensors (in combination with a magnetic hall sensor).

I have an issue on the NodeMCU boards I have: on both v0.4 and 0.3 bluetooth module (non-genuine HM10) and (occasionally) RF receiver (superheterodyne type) the MQTT connection gets reset. This does not trigger full reboot of NodeMCU but only disconnects the MQTT connection and reconnects and it takes a few seconds (3 - 4 at max) to reconnect.

I wouldnā€™t have observed this if not for the board being connected to an IR blaster with an AC unit. When the NodeMCU gets reset, it loads the code for the MQTT switch (it has retain flag) and sends the IR code to the AC (and AC has a buzzer).

I think there was someone else with a similar problem with the bluetooth module.

This does not occur on the Arduino Mega (v.30) but only on the NodeMCU. It might be a defective board problem (Iā€™m using generic boards and they also have wrong prints for D1 pin on both D1 and D2) however itā€™s not a sampling aspect. I have tested on 3 units out of the 10 units batch and they all get reset.

Arduino: 1.8.3 (Windows 7), Board: ā€œArduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)ā€

C:\Users\Documents\Arduino\libraries\NewRemoteSwitch\NewRemoteReceiver.cpp: In static member function ā€˜static void NewRemoteReceiver::interruptHandler()ā€™:

C:\Users\Documents\Arduino\libraries\NewRemoteSwitch\NewRemoteReceiver.cpp:45:53: error: cannot convert ā€˜NewRemoteCodeā€™ to ā€˜unsigned intā€™ in argument passing

#define CALLBACK_SIGNATURE (_callback)(receivedCode)

                                                 ^

C:\Users\Documents\Arduino\libraries\NewRemoteSwitch\NewRemoteReceiver.cpp:194:7: note: in expansion of macro ā€˜CALLBACK_SIGNATUREā€™

   CALLBACK_SIGNATURE;

   ^

Hello,

thanks for this detailled feedback!

Regarding the error when compiling on arduino mega it is possible you donā€™t have the last version of the library, try to download it from here.
I just retried and it compiles ok on my environment.

I will take a look to the others points tomorrow.

I have garage door that I want to add control to open/close from HA using OpenMQTTGateway.

I tried to decode the current remote control and i get the following readings on the receiver frm mqtt:

home/OpenMQTTGateway/LWT Online
home/433toMQTT/protocol 6
home/433toMQTT/bits 28
home/433toMQTT/length 471
home/433toMQTT 181222222

When I try to run the following command:
mosquitto_pub -t home/commands/PLSL_471/433_6/BITS_28 -m 181222222

I get the following on serial monitor:
Hey I got a callback
RF Protocol number:
6
RF Pulse Length:
471
MQTTtoRF user parameters
6
471
24
MQTTtoRF OK and ack published
181222222

Although the command is set as BITS_28, the transmitted pattern appears to be of 24 bits.

is there a limitation on the advanced parms to be used. How can I check what posible values can take each parm to see if the combination of protocol, pulse length, bits and payload are alowed?.
I did several checks and tryed several codes with no success at all.
Thanks for your help.
Adrian

Hello,

No limitation below 32 bits, but a mistake in the docšŸ˜’ the key for bit length is RFBITS_ and not BITS_ , the example in the docs is corrected

Hello,

I could modify the addon to publish adc reading only when there is a change in a certain limit, do you think it is interesting ? Or let the choice between this reading method and the regular one.

Hi,

I think it would be great to have also the option to send the reading when it reaches a threshold.

Although I didnā€™t used any scientific method for calibrating max and min values (Iā€™ve first completely covered the module then used a flashlight directly pointed to it) I did get to reasonable values.

A funny fact: I have two identical cheap LDR modules (as far as I can tell they are identical, because there is no marking on either of them) however they are wired internally in reverse. With one I had to subtract the reading from 1024 while for the other I could use it as is.

Thanks for your work, itā€™s working, but I get wrong status randomly, that is nobody there, the PIR show true

I am also have the same issues

I have an issue on the NodeMCU boards I have: on both v0.4 and 0.3 bluetooth module (non-genuine HM10) and (occasionally) RF receiver (superheterodyne type) the MQTT connection gets reset. This does not trigger full reboot of NodeMCU but only disconnects the MQTT connection and reconnects and it takes a few seconds (3 - 4 at max) to reconnect.

My MQTT show the signal well, but in HA, the status donā€™t update.thatā€™s usually happens after hours, restart HA the status updates correctly, and after hours, the issue appears again

I updates the mosquito, change to the emmberd boker, setup HA againā€¦ the issue is still there:sob:

My problem is that the Bluetooth module resets the MQTT connection for a brief time (during which it doesnā€™t send any message to MQTT broker from other modules connected to that NodeMCU either). If you can see the MQTT updates in the desired topics it is more likely an issue with either HA or MQTT rather than the NodeMCU itself.
Does the HA work reliably?
Do you see any errors in the frontend pertaining to the MQTT?
Do you have the possibility of installing a MQTT broker on a separate unit (either a second Rpi or a full Linux PC)? At least to identify where the problem resides.
Iā€™ve had problems with the embedded MQTT broker included in the AiO base at some point (as it is quite limited in robustness). I went with installing a broker on a different Rpi (v1) and I didnā€™t had any issue with MQTT since. Rpi v1 is more than sufficient for running a MQTT broker with 10-15 different clients updating topics each second.

HA work well, there is no errors about MQTT in HA logs, after last MQTT message, there is no more. MQTT logs are no problem.so I donā€™t know who is wrong I will setup new mosquito in another machine to check