Guys,
for my smart home project, i have setup my little nodejs server which communicates with the clients over socket.io
the clients can turn on/off virtual switches on the server which in turn emits the message to a raspberrypi which opens/closes some relays.
I am trying to replicate the same system with an ESP8266 (it is a relay module, but in reality i only need to program the ESP) so that i can go wireless
the server emits a message which is a json
(sorry if the formatting is a bit messy and probably not ideal, can't really change it now without changing my nodejs server... )
["serveremit",{"Client":"192.168.xxx.yyy"},{"Index":"1"},{"Link":"LIGHTS"},{"Item":"LR Ceiling Light"},{"Status":true},{}]
and i want the ESP to receive the message and process it
I want to check whether if myIndex and root_2_Index are a match (and I will need to do the same with myItem and root_4_Item)
if they are it means that the ESP knows the message is for himself and not for one of the other ESP's around the house)
if i Serial.print the variables and i get the same output on the monitor
unfortunately if i run a check like "if (myIndex == root_2_Index)" i never get a positive answer
the variables in question are:
myIndex and myItem (the ones which are coming from WiFiManagerParameter, the fantastic library from Tzapu)
and
root_2_Index and root_4_Item which are the ones i am receiving from my nodejs server (imported through the ArduinoJson and WebSocketsClient libraries)
I tried to change a bit the code, i suspect my issue is that there is a mismatch with the variable types and probably I am using pointers instead of variable.
But my background is mechanical and i am struggling with the underlying principles.
Could i kindly ask to take a look at the code and let me have some "pointers" (pun not intended) to where i should go to fix the issue? I don't mind studying it a bit more deeply, but i guess i am too far to even understand what the issue might be at the moment...
thanks a lot
M
8266-blink-02.ino (7.35 KB)