the https://github.com/letscontrolit/ESPEas ... 111_RF.ino does not work in newest Espeasy and I want to update it to the latest EspEasy standards. This is the first time changing something in Espeasy/plugins sources, so I'm not really an expert on the topic. I only need to listen on the codes, if the code matches the code I expect (mailbox sensor, door sensor, etc. I don't need to extract any value from the code). The raw int code is enough for me.
I had to change Device[deviceCount].VType = Sensor_VType::SENSOR_TYPE_ULONG;
the problem I'm facing is the UserVar variable, where it was previously an Array, now it's a Struct:
old code (line 114-115):
Code: Select all
UserVar[event->BaseVarIndex] = (valuerf & 0xFFFF);
UserVar[event->BaseVarIndex + 1] = ((valuerf >> 16) & 0xFFFF);
my attempt was compiling okay, code is read properly and the valuerf contains correct code (is logged in log).
Code: Select all
UserVar.setUint32(event->TaskIndex, 0, valuerf);
Code: Select all
110393: RF Code Recieved: 10106965
110393: To send this command, use this: URL
110402: EVENT: rf#RF=0
111393: RF Code Recieved: 10106965
111393: To send this command, use this: URL
111398: EVENT: rf#RF=0
1. I'm not sure what is the TaskIndex compared with BaseVarIndex (what exactly are those and which one to use?).
2. valuerf var is of type int (but the code could be easily over 32bit long, but that's another story). I'm also not sure about the type of the value I should be storing to UserVar. I've tried to use setUint32() method of the UserVarStruct struct
does anybody have time for explanation, what I'm doing wrong or where are my thought going wrong way?