Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the possibility to force an update of the "alive" state #107

Open
AlCalzone opened this issue Sep 20, 2018 · 8 comments
Open

Document the possibility to force an update of the "alive" state #107

AlCalzone opened this issue Sep 20, 2018 · 8 comments

Comments

@AlCalzone
Copy link
Owner

See: #106 (comment)

@nykfank
Copy link

nykfank commented Sep 20, 2018

  1. GET coaps://IP_ADDRESS:5684/15001/BULB_DEVICE_ID and extract warmth value from reply
  2. PUT warmth - 1 (1 if warmth == 0) to the above URL
  3. wait 1 second
  4. PUT warmth (original value) to the above URL
  5. wait 1 second
  6. loop 5 times to point 2

I don't know if there's better method, but this work fine. I used warmth because it doesn't noticeably influence the bulb state if it is powered on. Changing brightness would turn on the bulb, if if is powered on and in OFF state on the gateway. In my tests, the true alive status was determined after 6 seconds. The loop runs to 10 seconds to make sure. I also tried just changing the warmth once, but then it would take full 10 seconds to get the true status.
My python implementation is here
https://github.com/nykfank/ikea_tradfri_alive/blob/master/ikea_tradfri_alive.py

@AlCalzone
Copy link
Owner Author

AlCalzone commented Sep 21, 2018

Did you check the gateway updates (observeDevice) for turned-off bulbs? Do those come and include the correct color temperature (the one you just set)? If yes, this could be a way to bail out of the check loop early if the bulb is alive.
Edit: I see you're not using this lib in your test. Might be something worth to check out.

@nykfank
Copy link

nykfank commented Sep 21, 2018

Yes, that could be an interesting idea! At what endpoint can I get the gateway updates? 15011/15012?
I would like to use your library, but couldn't get node/npm installed on my SheevaPlug yet.

@AlCalzone
Copy link
Owner Author

Basically you have set the observe option for the specific endpoint you are interested in, eg devices/deviceID

@realjax
Copy link

realjax commented Jul 10, 2019

Is it really needed to change a value for a device to receive an update? The warmth, for instance won't work with a non-white spectrum light. And from what I understood the gateway will also respond with a new alive value after it receives an update for a bulb in which no properties have been changed.

Am I correct in assuming that if a lightOperation was sent to a device that contains no changes, that this update is not sent? And if so, maybe implement a force update option?

@AlCalzone
Copy link
Owner Author

Is it really needed to change a value for a device to receive an update? The warmth, for instance won't work with a non-white spectrum light.

You can also use the brightness for no-spectrum lights (with the downside that turned-off bulbs may be turned on) or color/hex/sat for RGB lights.
Currently, the way this lib is designed, the bare minimum of data is transmitted. This means that a no-change operation won't send anything. I'll have to add a way to force the command to be sent.

@realjax
Copy link

realjax commented Jul 15, 2019

I'll have to add a way to force the command to be sent.

That would be awesome! :)

@realjax
Copy link

realjax commented Jul 20, 2019

You were right, setting the brightness for no-spectrum lights turns them on, so that is not an option. I then tried it by changing the transitionTime ( using operateLigh() ) and all though the command (seems) tor work ok, it does not trigger any callbacks.

So I guess it is safe to say that at the moment for no-spectrum lights there is no way to determine the "alive" state by forcing an update. ( unless switching the light on when it is off is not a problem of course :) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants