jangxx / node-magichome

An incomplete implementation of the functionality of the "Magic Home" app. Partially a port of https://github.com/Danielhiversen/flux_led to Node.js
ISC License
124 stars 26 forks source link

state.type 0x44 needs apply_masks in true #22

Closed nicogon closed 4 years ago

nicogon commented 4 years ago

I've discovered that my magic bulb needs apply_masks in true (type 0x44). Why this flag is not enforced for all devices?

nicogon commented 4 years ago

by the way. GREAT job guys!

jangxx commented 4 years ago

The reason that the flag is not enforced for all devices is, that a lot of controllers do not need it and actually do not work if it is set. Therefore, having it set by default for all devices would break backwards compatibility, since this library did not support bulbs in the beginning.

From the original Python script I gathered, that type 0x25 was some kind of bulb, so I put in a bit of code, which automatically sets the flag, if queryState encounters a device of this type. Now what you're saying is, that there are apparently bulbs with other types out there. I can't verify this unfortunately, but I could add this to the list of types, which automatically have the flag set to true.

Can you post the output of magic-home query_nice <bulb_ip>, i.e. the output of queryState here, so I can see for myself? Afterwards, I would be happy to add this type to the list.

nicogon commented 4 years ago

{ "type": 68, "on": true, "mode": "color", "speed": 50, "color": { "red": 0, "green": 0, "blue": 0 }, "warm_white": 255, "cold_white": 0 }

jangxx commented 4 years ago

Looks good! Version 2.3.1 now sets the parameter automatically in queryState.