dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.9k stars 503 forks source link

Power-on behavior #1055

Closed TimmyUll closed 5 years ago

TimmyUll commented 5 years ago

When updating and change power-on behavior on Hue-lights to "last uses color and brightness". Then connect them to conbee again. The Power-on behavior changes back to 100% White light regardless what previous state was.

ebaauw commented 5 years ago

That’s the idea of a factory reset, which you need to make the light join another network. Change the poweron settings from the deCONZ GUI.

ghost commented 5 years ago

Hey ebaauw, I dont get how to do it... Would anyone please be so kind to explain how to do it exactly? Where do I have to fill in what value? Regards Ferdel73

ebaauw commented 5 years ago

Go to the Cluster Info panel and write the PowerOn attributes of the OnOff, Level Control, and Color Control clusters. See https://github.com/dresden-elektronik/deconz-rest-plugin/issues/1014#issuecomment-445452409 and the next comment.

ghost commented 5 years ago

Thank you for the quick answer! I will try during Chrismas holidays. Just last night I got deCONZ running over x11vnc, before I only used deconz.service headless (deconz-gui.service wont start...). But I ran into some problems regarding different data / databases under phosconn with gui and headless. Regards Ferdel

bytat commented 5 years ago

I've tried to set PowerOn OnOff to both "On" and "Off" ("Previous" not working) but it doesn't seem to matter. The light still comes on at 100%, not remembering last state when turning off electricity. Am I misunderstanding what's supposed to happen?

ebaauw commented 5 years ago

What light type and what light firmware version are you using? It works for me for all types of Hue lights at the latest (Dec 2018) firmware.

bytat commented 5 years ago

it's a hue ambiance white e27 bulb. Model: LTW001 SW: 5.127.1.26420. Just updated to the latest fw.

It should be mentioned, I didn't seem to get it to work as expected with the hue gateway either. I was able to chose the power on behavior in the app but it seemed to reset both light levels and color when turning off the electricity. I didn't spend much time trying before changing to conbee, though, since I wasn't that interested in the hue gateway more than updating to the latest firmware.

ebaauw commented 5 years ago

That is the firmware that supports PowerOn OnOff (and the dimming and colour variants).

Note that it might take a couple of seconds before the light has written the setting to non-volatile memory. You should be able to read back the setting in the deCONZ GUI.

bytat commented 5 years ago

Ok. To rule out anything I might be doing wrong, would you mind telling me exactly what variable, and to what, I would need to set to get a light to go back to the previous state of light level and color when turning the electricity back on again? All I could gather when looking at the linked threads was setting power onoff to "off" since it was already set to on. (on another note, now when trying to set power onoff back to "on" again I get "failed to write")

ebaauw commented 5 years ago

For previous settings, you need to write 0xff or 0xffff to the following attributes:

bytat commented 5 years ago

I'm sorry for the late reply. I've managed to set the default value of PowerOn OnOff and I've uncommented the PowerOn variants. I haven't gotten around to fix/understand the rest yet but I'll be back with more questions when/if they'll arise. Thanks for the help!

ghost commented 5 years ago

Hello again, after repairing my raspberry installation -'which took quite some time -'the deCONZ GUI is working now. But as described it fails to write the “Previous“ value to Poweron onoff. How can i change this value without the software? It is the latest version, bulb fw is at december version. Do i have to use newer github Files? Will there be a patched release soon? Sorry for being pesky (AND late) about this, but i appreciate your knowledge!

ebaauw commented 5 years ago

This is an issue with the deCONZ GUI, not with the open source REST API plugin.

If you're comfortable reading and writing ZCL payloads, you might try https://github.com/ma-ca/deconz-cli-plugin.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

frankhommers commented 4 years ago

Hey @ebaauw, I have read all your work on the Power On stuff. I just upgraded all my bulbs to the latest firmware since I have never done that. Now I want to make use of the "Previous" mode. So the lights come on in the same state/color/level as they went out. I still doesn't work through the deconz GUI.

Can you help me do this? What steps do I need to follow?

I have edited general.xml to circumvent the enum problem by adding this:

<value name="Unused2" value="0x02"/>
<value name="Unused3" value="0x03"/>
<!--etc-->
<value name="Unused253" value="0xfd"/>
<value name="Unused254" value="0xfe"/>

That seems to work for the on/off state, but not for the color and level... Please help me.

ebaauw commented 4 years ago

See above.

For Hue lights to power on at previous settings, you need to set the following attributes:

  1. OnOff cluster 0x0006, PowerOn OnOff attribute 0x4003 to value Previous (0xff). The issue with this is, indeed, that the deCONZ GUI doesn't support enum values with gaps. Specifying all 256 possible values in general.xml might very well work around it; I've never tried this myself, though;
  2. Level Control cluster 0x0008, PowerOn Level attribute 0x4000 to value 255 (0xff). The deCONZ GUI supports this without any issues. Note that the light needs to remain powered for some time after writing the attribute, presumably to copy the setting to non-volatile memory. Best read back the setting after writing it, to make sure it caught on.
  3. Color Control cluster 0x0300, PowerOn Color Temperature attribute 0x4010 to value 65536 (0xffff). The deCONZ GUI supports this without any issues. This is needed only for color temperature and extended color lights (supporting ct).
  4. Color Control cluster 0x0300, manufacturer-specific PowerOn Current X attribute 0x0003 to value 65536 (0xffff), and manufacturer-specific PowerOn Current Y attribute 0x0004 to value 65536 (0xffff). The deCONZ GUI can support this, but not while also supporting the standard Current X and Current Y attributes. You need to comment out these in general.xml: https://github.com/dresden-elektronik/deconz-rest-plugin/blob/14c07293647d78385ee0b4dea61a8fdd04e270d7/general.xml#L1565-L1566 and then uncomment the manufacturer-specific attributes: https://github.com/dresden-elektronik/deconz-rest-plugin/blob/14c07293647d78385ee0b4dea61a8fdd04e270d7/general.xml#L1610-L1613 This is needed only for (extended) color lights (supporting xy).
frankhommers commented 4 years ago

@ebaauw Awesome! I had a hard time with step 4. That works now!

Maybe for others that need this same help correct 0x65535 into 65535 :-)

SuneRadich commented 4 years ago

Im new to Deconz, and have only started looking into how to configure things. But are the power-on settings eventually added to the GUI?

AudiTTR commented 4 years ago

Thx @ebaauw for the time you've put into this, for providing the steps above. Also thx to @frankhommers for the clever workaround to circumvent the enum8 issue wrt non-continuous values.

I've been able to successfully setup my deCONZ GUI so that I can now configure my Hue bulbs so they default to the 'Previous' power on state. SWEET!

However, I've got nearly 100 bulbs to do, and doing those 4 steps in the deCONZ GUI for each and every bulb is going to be very tedious. Not to mention mistake-prone. I also want to be able to quickly re-apply the 'Previous' power on state if I have to remove groups of my bulbs from my Raspbee/deCONZ/Phoscon bridge, link them to the original Hue bridge, do a FW upg, and then re-link them back to my Raspbee bridge.

Therefore, is there a way these 4 steps could be automated/scripted via bash or python or some other method so I can do a large number of bulbs quickly and without making any mistakes (missing steps and/or typos)?

ebaauw commented 4 years ago

Lacking (pending?) support for this by the REST API plugin, you would need to use the deconz-cli-plugin to send the attribute write commands.

zladukas commented 4 years ago

@ebaauw, could You please help me make correct deconz-cli ZCL command?

I'm trying to set PhilipsHUE to "previous" 0xFF setting with no success.

I was using based on searching in gitHub:

zclattr zclattr 0x5CCC 11 0x0006 02400320FF

ebaauw commented 4 years ago

I like to keep my sniffer running when composing cli commands, to make sure that it indeed sends the ZigBee message I want.

You need to specify the attribute ID in the payload as big endian, so 0340 for 0x4003. The type of the attribute is enum8, so 30. Not sure if the endpoint needs to be in decimal or hex.

So try:

zclattr 0x5CCC 11 0x0006 02034030FF

or

zclattr 0x5CCC 0x0B 0x0006 02034030FF
zladukas commented 4 years ago

@ebaauw Many thanks, first one is working!!! I was very near, but was using wrong data type.

Bruskey commented 4 years ago

After going through all this, im still confused as to how to make this change. I want to set my Hue light which is not paired to a Hue bridge anymore, but directly to Deconz to adjust the power-on behavior to "previous state". Based on all of the above and any limitations or issues that might exist, what is the best way to do that? I am a noob in regards to Deconz and the GUI so might need a little bit of extended info if anyone is able to share their method to do this.

Thanks Andrew

mgrn0 commented 4 years ago

@frankhommers would you mind sharing the lines you extended the general.xml as a gist/snippet?

update: I solved it myself and it is working :)

for anyone who is trying to solve it in the way described above, I created a gist for the missing lines that have to be inserted around line 550 (for version .75): https://gist.github.com/mgrn0/8f52a05601a5fdc7d6e35e80c5cdc088

if wanted I can create a step-by-step howto with screens for explanation.

Bruskey commented 4 years ago

Are you able to provide step by step instructions around how to make this change if possible?

mgrn0 commented 4 years ago

Are you able to provide step by step instructions around how to make this change if possible?

will do.

Bruskey commented 4 years ago

Have you had a chance to list the steps needed to do this?

mgrn0 commented 4 years ago

sorry for the delay @Bruskey , for me the following steps were successful:

Hope this helps :)

gvdhoven commented 4 years ago

@mgrn0 if you want to have your bulbs to 'off' state after a power cut (e.g. my home automation system will decide if they will be turned on) what steps should i then take, can you also elaborate on that in such detail?

mgrn0 commented 4 years ago

@Webunity I was only after the "last / previous" setting, but from what I understand you would chose "off" in step (5) instead of "previous", which is at the very top of the dropdown menu. deconz--2020-05-20_08-04-04

Bruskey commented 4 years ago

@mgrn0 Apologies for sounding like a noob, but i have installed Deconz through Home Assistant as an addon on the same server Home Assistant is running on. When you say the below, how do i actually access the file system to make those changes to the xml file?

add the missing values / lines (https://gist.github.com/mgrn0/8f52a05601a5fdc7d6e35e80c5cdc088) in /usr/share/deCONZ/zcl/general.xml , restart deCONZ

mgrn0 commented 4 years ago

@Bruskey hm, I am running deCONZ on a Raspbee 2, so I don't know where in your case the files are located; if you go to "Edit > Preferences" (deCONZ) you will be able to see the path to the XML in your case, however you have to figure out how to edit the file / how to 'get' there, sorry (maybe somebody else can help?)

Gerben321 commented 4 years ago

I tried to follow the guide for my Hue GU10 bulbs, but when I turn them off and on again they're just cold white? Is the color part for X and Y correct? Can't set that anymore because it's gone commented out in the XML like in the guide.

Edit: After some more tinkering they're now back to their normal 'on' value that's the default. I really don't understand why it sometimes seems to work, and it sometimes doesn't. Sometimes the writing and reading is also stuck for ages...

ebaauw commented 4 years ago

There a bug in the GUI, that it doesn't understand the same attribute IDs for standard and manufacturer-specific attributes. If you comment out the standard Current X and Current Y attributes in general.xml and uncomment the PowerOn variants, you should be able to set these from the GUI.

Gerben321 commented 4 years ago

I've done that. I think I have to try it again some other time. It does seem to remember my brightness value though. But my Windows 10 seems to crash or logout when I am trying it too much, rather not mess around too much with it because I have to restart my VM's every time.

Would be great if this would be implemented in Phoscon, or via the API at least. This is undoable right now, especially for multiple lights.

miljume commented 4 years ago

I also try to find the general.xml file but with no luck. I am using deCONZ in Hass.IO as a Docker plugin. In Docker it says that the volume should be at /usr/share/hassio/addons/data/core_deconz but there is no such directory

miguelcaravantes commented 4 years ago

why is the deconz GUI not fixed yet?

networkpotato commented 4 years ago

When I try to write the value Previous to my Hue bulbs through the GUI, it gives me the error writing failed.

However, writing the value off or on works fine.

Why can't I set the Previous value?

mgrn0 commented 4 years ago

@ludipq did you add the value entries in the xml file as described above?

TheAlphaLaw commented 4 years ago

It's unfortunate this isn't already corrected for Hue bulbs. The above method does not seem to work well for my color lights. Hoping we see some effort put into this from Deconz.

networkpotato commented 4 years ago

@ludipq did you add the value entries in the xml file as described above?

No, I thought I didn't have to because the option was there in the GUI.

Where do I find general.xml when running on Docker? I have mapped the following folder and this is the only content of it.

/volume1/docker/deconz:/root/.local/share/dresden-elektronik/deCONZ

Skjermbilde

networkpotato commented 4 years ago

@ludipq did you add the value entries in the xml file as described above?

No, I thought I didn't have to because the option was there in the GUI.

Where do I find general.xml when running on Docker? I have mapped the following folder and this is the only content of it.

/volume1/docker/deconz:/root/.local/share/dresden-elektronik/deCONZ

Skjermbilde

Anyone?

networkpotato commented 3 years ago

I just updated both my ConBee and deCONZ to the latest versions, and suddenly I am able to write the "previous" value to the bulbs, without editing the xml file!

gvdhoven commented 3 years ago

@ludipq can you elaborate on the steps that you have taken?

Mimiix commented 3 years ago

@gvdhoven On/off cluster in deCONZ. Then attribute 0x4003 :)

miljume commented 3 years ago

I still can't write to the attribute, I receive the same error as before writing failed. Running deCONZ v2.05.88 and updated the FW to 0x26390500

bytat commented 3 years ago

I managed to write to à couple of them. I think I need to upgrade the firmware on the others.

TheAlphaLaw commented 3 years ago

@gvdhoven On/off cluster in deCONZ. Then attribute 0x4003 :)

Writing previous works for me, but it doesn't function as intended.

theCroh commented 3 years ago

Has anyone found a way to do this with Hass.IO deCONZ addon?