We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 279a98e commit c221d09Copy full SHA for c221d09
ArduinoCloudProperty.cpp
@@ -170,7 +170,18 @@ void ArduinoCloudProperty::setAttributesFromCloud(LinkedList<CborMapData *> *map
170
171
void ArduinoCloudProperty::setAttributeReal(bool& value, String attributeName) {
172
setAttributeReal(attributeName, [&value](CborMapData * md) {
173
- value = md->bool_val.get();
+ // Manage the case to have boolean values received as integers 0/1
174
+ if (md->bool_val.isSet()) {
175
+ value = md->bool_val.get();
176
+ } else if (md->val.isSet()) {
177
+ if (md->val.get() == 0) {
178
+ value = false;
179
+ } else if (md->val.get() == 1) {
180
+ value = true;
181
+ } else {
182
+ /* This should not happen. Leave the previous value */
183
+ }
184
185
});
186
}
187
0 commit comments