433MHz Pilight Problems

Hello, everyone,
here’s the problem. I am using the nodemcuv2-pilight firmware and have the problem that I can’t switch. When I switch the handheld transmitter of my wall socket I get the following MQTT:
home/ESP_RF/PilighttoMQTT
{“message”:{“id”: “C7”, “unit”:36, “state”: “on”}, “protocol”: “clarus_switch”, “length”: “C7”, “repeats”:2, “status”:2}

When I send the same content to
home/ESP_RF/commands/MQTTtoPilight
I get the following message on the console:

N: Received json : {“message”:{“id”: “C7”, “unit”:36, “state”: “on”}, “protocol”: “clarus_switch”, “length”: “C7”, “repeats”:2, “status”:2}
E: MQTTtoPilight failed json read
E: protocol is not available

What am I doing wrong? Because the protocol is recognized without any problems via the receiver. Do I have something wrong in the json string? or why can’t it be interpreted?

Many greetings

Frank

Hi Frank,

Unfortunately Pilight library are not requiring the same exact syntax for sending that it provide when receiving:
Could you try with:
ON
{"message":{"id": "C7", "unit":36, "on":1}, "protocol": "clarus_switch", "length": "C7", "repeats":2, "status":2}
OFF
{"message":{"id": "C7", "unit":36, "off":1}, "protocol": "clarus_switch", "length": "C7", "repeats":2, "status":2}

Hi, thanks for the tip, but unfortunately I get the same error message. So there seems to be still some error in the message?

Be carefull on the quotes, and alternatively you can try to escape them:
https://docs.openmqttgateway.com/use/rf.html#pilight-gateway

Okay, I’ll test. Is the “nodemcuv2-pilight-firmware.bin” the correct firmware? I want to replace the Pilight on the Raspberry with this gateway so I can run my FHEM on a Nuc and still control 433Mhz sockets. Whereby I am new in programming the Escapen means that one puts a backslash before the quotation marks again?

Now I have constructed the message as follows:
{"message": "{\"id\":C7,\"unit\":36,\"off\":1}", "protocol": "clarus_switch", "length": "C7", "repeats":2, "status":2}

now I get this message:
MQTTtoPilight json data analysis
MQTTtoPilight msg & protocol ok
message is not a proper json object

But I have no idea what else I can or should change, because he seems to have understood it, but somehow not because it is not a real json object. Maybe someone else has an idea.

Don’t take care of this message.

Does it switch ON or OFF your device?

Unfortunately the socket does not switch. But I have another assumption: If I have connected the transmitter to the ESP, the socket receives the signals from the handheld transmitter very badly. Is it correct to hang the “transmission line” on the ESP on the RX? I have wired it according to the instructions. Is it possible that there are still problems?

To be sure you may connect the emitter to D2 and change it into config_RF.h.

Okay, what do I need to download for that? I’ve only installed the bin file so far. Can you customize it in the Arduino Editor? Do I have to download nodemcuv2-pilight-libraries.zip and compile it in the Arduino IDE?

Yes you can modify config_RF.h in the Arduino IDE

Yes follow the instruction from the docs and it should be OK

So, now that I’ve got it right with compiling, here comes the next problem. After uploading the following message appears on the console:
#WM: topic
N: Wifi connected
{“mqtt_server”: “192.168.99. 120”, “mqtt_port”: “1883”, “mqtt_user”: “###”, “mqtt_pass”: “#####”, “mqtt_topic”: “home/”, “gateway_name”: “OpenMQTTGateway”}E: WRONG PUBSUBCLIENT LIBRARY USED PLEASE INSTALL THE ONE FROM RELEASE PAGE
N: Setup OpenMQTT Gateway end
W: MQTT connection…
N: Connected to broker

You should take a look to that:
https://docs.openmqttgateway.com/upload/arduino-ide.html#upload-with-arduino-ide

Ok… next Problem in Arduino IDE while Compiling:

C:\Users\FB\Desktop\nodemcuv2-pilight\main\main.ino: In function ‘void setOTA()’:

main:773:14: error: ‘class ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>’ has no member named ‘setPort’

ArduinoOTA.setPort(ota_port);

          ^

main:776:14: error: ‘class ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>’ has no member named ‘setHostname’

ArduinoOTA.setHostname(ota_hostname);

          ^

main:779:14: error: ‘class ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>’ has no member named ‘setPassword’

ArduinoOTA.setPassword(ota_password);

          ^

main:781:14: error: ‘class ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>’ has no member named ‘onStart’

ArduinoOTA.onStart( {

          ^

main:784:14: error: ‘class ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>’ has no member named ‘onEnd’

ArduinoOTA.onEnd( {

          ^

main:787:14: error: ‘class ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>’ has no member named ‘onProgress’

ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {

          ^

main:790:14: error: ‘class ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>’ has no member named ‘onError’

ArduinoOTA.onError([](ota_error_t error) {

          ^

main:790:25: error: ‘ota_error_t’ has not been declared

ArduinoOTA.onError([](ota_error_t error) {

                     ^

C:\Users\FB\Desktop\nodemcuv2-pilight\main\main.ino: In lambda function:

main:792:18: error: ‘OTA_AUTH_ERROR’ was not declared in this scope

 if (error == OTA_AUTH_ERROR)

              ^

main:794:23: error: ‘OTA_BEGIN_ERROR’ was not declared in this scope

 else if (error == OTA_BEGIN_ERROR)

                   ^

main:796:23: error: ‘OTA_CONNECT_ERROR’ was not declared in this scope

 else if (error == OTA_CONNECT_ERROR)

                   ^

main:798:23: error: ‘OTA_RECEIVE_ERROR’ was not declared in this scope

 else if (error == OTA_RECEIVE_ERROR)

                   ^

main:800:23: error: ‘OTA_END_ERROR’ was not declared in this scope

 else if (error == OTA_END_ERROR)

                   ^

C:\Users\FB\Desktop\nodemcuv2-pilight\main\main.ino: In function ‘void setOTA()’:

main:803:20: error: no matching function for call to ‘ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>::begin()’

ArduinoOTA.begin();

                ^

C:\Users\FB\Desktop\nodemcuv2-pilight\main\main.ino:803:20: note: candidate is:

In file included from C:\Users\FB\Desktop\nodemcuv2-pilight\main\main.ino:144:0:

C:\Users\FB\Documents\Arduino\libraries\ArduinoOTA\src/ArduinoOTA.h:87:8: note: void ArduinoOTAMdnsClass<NetServer, NetClient, NetUDP>::begin(IPAddress, const char*, const char*, OTAStorage&) [with NetServer = WiFiServer; NetClient = WiFiClient; NetUDP = WiFiUDP]

void begin(IPAddress localIP, const char* name, const char* password, OTAStorage& storage) {

    ^

C:\Users\FB\Documents\Arduino\libraries\ArduinoOTA\src/ArduinoOTA.h:87:8: note: candidate expects 4 arguments, 0 provided

exit status 1
‘class ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>’ has no member named ‘setPort’

Hello, everyone,

nobody has any idea why I can’t get this to compile?

Many greetings

Frank

May you format the log extract so as to make it more understandable please.

Could you post your user_config.h without passwords?

Ok, I started all over again after a few days apart. So the compiling works fine now. Unfortunately I still have the problem with the Clarus switch. I have now configured the transmitter to the D2, but that didn’t bring any improvement. I still get the message on the ESP that it is not a valid Json message

( N: Received json : {“message”: “{“id”:C7,“unit”:36,“off”:1}”, “protocol”: “clarus_switch”, “length”: “C7”, “repeats”:2, “status”:2}
E: message is not a proper json object)

I put the message through a Json Validator and there it is valid. What else can I do to get this gateway working with my Clarus sockets?

Many greetings

Frank