I use a dashboard button to set a global variable in my sketch which updates an external api. This works fine.
However, when the variable in the sketch is changed by a call to the api, the button is not changed. The variable changes but the button does not.
I’m obviously missing something - any help gratefully received.
bool valve_1_sync = 0;
// This is in Setup()
thing["valve1"] << [](pson& in){
if(in.is_empty()){
in = valve_1_sync;
}
else{
valve_1_sync = in;
setServerValveStatus(1, valve_1_sync); // api call
}
};