V_FORECAST
-
Where can I find out the format of the data sent by V_FORECAST?
I assumed it was an int or byte containing a pointer to the index of an array with the various weather states in - but seems not to work for me....Any ideas or info please?
-
@skywatch I've never used V_FORECAST, but the documentation at https://www.mysensors.org/download/serial_api_20#set,-req might be useful.
EDIT: https://github.com/mysensors/MySensors/blob/6ffe29cb5fcfa33fa83133044c2d16ee45c66697/core/MyMessage.h#L108 suggests it is a string.
-
@mfalkvidd Thank you! - That explains why I have had trouble getting it to work......
Time to re-write that bit of code I think
-
This seems to work for anyone who needs it.......
void receive(const MyMessage &message) { if (message.sensor == CHILD_ID_GETFORECAST && message.type == V_FORECAST) { forecast = (message.getString()); if (forecast == "stable"){ Index = 0;} else if (forecast == "sunny"){ Index = 1;} else if (forecast == "cloudy"){ Index = 2;} else if (forecast == "unstable"){ Index = 3;} else if (forecast == "thunderstorm"){ Index = 4;} else if (forecast == "unknown"){ Index = 5;} }