Skip to content

Commit 7dd93ad

Browse files
authored
Merge pull request #347 from pennam/dimmed-light-fake
CloudDimmedLight property cleanup
2 parents 27c05bc + 078f62f commit 7dd93ad

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

extras/test/src/test_encode.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ SCENARIO("Arduino Cloud Properties are encoded", "[ArduinoCloudThing::encode-1]"
196196
CloudDimmedLight color_test = CloudDimmedLight(true, 2.0);
197197
addPropertyToContainer(property_container, color_test, "test", Permission::ReadWrite);
198198

199-
/* [{0: "test:swi", 4: true},{0: "test:hue", 2: 0.0},{0: "test:sat", 2: 0.0},{0: "test:bri", 2: 2.0}] = 9F A2 00 68 74 65 73 74 3A 73 77 69 04 F5 A2 00 68 74 65 73 74 3A 68 75 65 02 FA 00 00 00 00 A2 00 68 74 65 73 74 3A 73 61 74 02 FA 00 00 00 00 A2 00 68 74 65 73 74 3A 62 72 69 02 FA 40 00 00 00 FF*/
200-
std::vector<uint8_t> const expected = {0x9F, 0xA2, 0x00, 0x68, 0x74, 0x65, 0x73, 0x74, 0x3A, 0x73, 0x77, 0x69, 0x04, 0xF5, 0xA2, 0x00, 0x68, 0x74, 0x65, 0x73, 0x74, 0x3A, 0x68, 0x75, 0x65, 0x02, 0xFA, 0x00, 0x00, 0x00, 0x00, 0xA2, 0x00, 0x68, 0x74, 0x65, 0x73, 0x74, 0x3A, 0x73, 0x61, 0x74, 0x02, 0xFA, 0x00, 0x00, 0x00, 0x00, 0xA2, 0x00, 0x68, 0x74, 0x65, 0x73, 0x74, 0x3A, 0x62, 0x72, 0x69, 0x02, 0xFA, 0x40, 0x00, 0x00, 0x00, 0xFF };
199+
/* [{0: "test:swi", 4: true},{0: "test:bri", 2: 2.0}] = 9F A2 00 68 74 65 73 74 3A 73 77 69 04 F5 A2 00 68 74 65 73 74 3A 62 72 69 02 FA 40 00 00 00 FF*/
200+
std::vector<uint8_t> const expected = {0x9F, 0xA2, 0x00, 0x68, 0x74, 0x65, 0x73, 0x74, 0x3A, 0x73, 0x77, 0x69, 0x04, 0xF5, 0xA2, 0x00, 0x68, 0x74, 0x65, 0x73, 0x74, 0x3A, 0x62, 0x72, 0x69, 0x02, 0xFA, 0x40, 0x00, 0x00, 0x00, 0xFF };
201201
std::vector<uint8_t> const actual = cbor::encode(property_container);
202202
REQUIRE(actual == expected);
203203
}

src/property/types/automation/CloudDimmedLight.h

-9
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,7 @@ class CloudDimmedLight : public Property {
100100

101101
virtual CborError appendAttributesToCloud(CborEncoder *encoder) {
102102
CHECK_CBOR_MULTI(appendAttribute(_value.swi, "swi", encoder));
103-
// To allow visualization through color widget
104-
// Start
105-
float hue = 0;
106-
float sat = 0;
107-
CHECK_CBOR_MULTI(appendAttribute(hue, "hue", encoder));
108-
CHECK_CBOR_MULTI(appendAttribute(sat, "sat", encoder));
109103
CHECK_CBOR_MULTI(appendAttribute(_value.bri, "bri", encoder));
110-
// should be only:
111-
// appendAttribute(_value.bri);
112-
// end
113104
return CborNoError;
114105
}
115106

0 commit comments

Comments
 (0)