Closed ghost closed 6 years ago
Could you test some API calls and provide some visual feedback? I don't own the device therefore the implementation depends on your feedback.
Sure. I'm not a programmer, but I think that should not be a problem. Is it something like https://github.com/syssi/philipslight/issues/3 or should it be implemented in https://github.com/rytilahti/python-miio first?
Of course there is no hurry. We'll see how much we get?
Could you please test the following commands and provide some feedback:
mieye --ip your-eyecare-ip --token your-token on
mieye --ip your-eyecare-ip --token your-token off
# Which light source turns on/off?
# If you turn on the ambient light can it be turned off by the command above, too?
# If you turn on the night light can it be turned off by the command above, too?
mieye --ip your-eyecare-ip --token your-token ambient_on
mieye --ip your-eyecare-ip --token your-token ambient_off
# Which light source turns on/off?
mieye --ip your-eyecare-ip --token your-token bl_on
mieye --ip your-eyecare-ip --token your-token bl_off
# Which light source turns on/off?
mieye --ip your-eyecare-ip --token your-token notify_on
mieye --ip your-eyecare-ip --token your-token notify_off
# How does the eye fatigue reminder / notifications works exactly? Does the lamp flash sometimes?
mieye --ip your-eyecare-ip --token your-token set_bright 90
# The brightness of which light source changes? One or both?
mieye --ip your-eyecare-ip --token your-token set_amb_bright 90
# The brightness of which light source changes?
Thanks in advance! If the behavior of the lamp is known the implementation will be easy.
Thanks. The results can be shown as follows:
mieye --ip your-eyecare-ip --token your-token on mieye --ip your-eyecare-ip --token your-token off
If light 1 is on, light 1 gets off. If light 1 is on, and light 2 is on, both are on and off.
But. The lamp saves the last setting. For example. If 2 light were on before the lamp was last turned off. 2 lights will go on and off with this command.
mieye --ip your-eyecare-ip --token your-token ambient_on mieye --ip your-eyecare-ip --token your-token ambient_off
If the light is off completely both lights are going on. If light 1 is on, with this command light 2 is going on or off.
mieye --ip your-eyecare-ip --token your-token bl_on mieye --ip your-eyecare-ip --token your-token bl_off
If the light is off completely none of the lights are on. If light 1, 2 of both are on, no clear change to night light or light change in general.
mieye --ip your-eyecare-ip --token your-token notify_on mieye --ip your-eyecare-ip --token your-token notify_off
I do not see any difference, nothing happens, but it may only work in the long term. In case of a tired user (fatigue).
If there are any questions, I would love to hear them.
Did I understand your description correctly:
The secondary light 2 seems to be connected to light 1 on the "on" switch but not "off" switch. For example the start situation; The lamp is completely off.
The command "ambient_on" ensures that both lights (1 and 2) turn on. Using "ambient_off" afterwards only light 2 goes out. Light 1 then remains on.
If you then switch the lamp off and on again. "off - on" The latest known situation applies. And that is in this example: Only Light 1 turns on.
If you want to know something else, I'd love to hear it.
@buikdaanser
Could you be so kind to help me on my way getting this light to work in HA?
I have extracted the key using the iphone backup method, git this key (slightly modified):
eb6d34d06b5117af2269c7fb8073baada432c5dec773793391a5ff4e136a12500143db63ee66b0cdff9f69917680151e
Which I then converted on my macbook using terminal command:
echo '0: eb6d34d06b5117af2269c7fb8073baada432c5dec773793391a5ff4e136a12500143db63ee66b0cdff9f69917680151e' | xxd -r -p | openssl enc -d -aes-128-ecb -nopad -nosalt -K 00000000000000000000000000000000
The output looked like:
ae3e5e0b1226814f1ed5de36fc243413
However If i use that token, the component in HA times out :(
Also trying:
mirobo --ip 192.168.2.238 --token ae3e5e0b1226814f1ed5de36fc243413 raw_command set_power '["off"]'
ERROR:miio.vacuum_cli:Unable to read the stored msgid: [Errno 2] No such file or directory: '/tmp/python-mirobo.seq'
Sending cmd set_power with params ['off']
ERROR:miio.device:Got error when receiving: timed out
WARNING:miio.device:Retrying with incremented id, retries left: 3
ERROR:miio.device:Got error when receiving: timed out
WARNING:miio.device:Retrying with incremented id, retries left: 2
ERROR:miio.device:Got error when receiving: timed out
WARNING:miio.device:Retrying with incremented id, retries left: 1
Any idea as to what I am doing wrong?
@michel72 I do not own an iPhone. In terms of extracting and converting iPhone keys, I don't know.
About the Xiaomi Philips Eyecare Smart Lamp 2. Seems you are using the old python-mirobo and /or trying to command the Xiaomi vacuum cleaner. The old python-mirobo does not support the Xiaomi Philips Eyecare Smart Lamp 2.
Please make sure that you are running the latest python-miio software. Afterwards you could start controlling your lamp by:
mieye --ip your-eyecare-ip --token your-token on
Hi,
root@UBTSRV:/home/michel# mieye --ip 192.168.2.74 --token ae3e5e0b1226814f1ed5de36fc243413 on
ERROR:miio.device:Got error when receiving: timed out
WARNING:miio.device:Retrying with incremented id, retries left: 3
ERROR:miio.device:Got error when receiving: timed out
WARNING:miio.device:Retrying with incremented id, retries left: 2
I'll try extracting the key again using a borrowed android phone.
Hi,
I extracted the token using an android phone which looks like:
# miio-extract-tokens --password 1234 backup.ab
Saving database to /tmp/tmpv042yy3u
INFO:miio.extract_tokens:Reading database from /tmp/tmpv042yy3u
INFO:miio.extract_tokens:Reading tokens from Android DB
飞利浦智睿台灯二代
Model: philips.light.sread1
IP address: 192.168.2.74
Token: 459ca90868c14f255e7231d964219a51
MAC: 28:6C:07:A7:64:D8
However.....
# mieye --ip 192.168.2.74 --token 459ca90868c14f255e7231d964219a51 on
ERROR:miio.device:Got error when receiving: timed out
WARNING:miio.device:Retrying with incremented id, retries left: 3
ERROR:miio.device:Got error when receiving: timed out
WARNING:miio.device:Retrying with incremented id, retries left: 2
Is there something else I could try?
Thx,
Michel
Are you sure that you don't have an router that blocks the connection (i.e. firewall), About python-mirobo? Does it work well with other devices?
@syssi any progress on this one?
Jep! I started yesterday and will be ready next week!
Great! Thanks.
Do you agree it doesn't make sense to implement the second light ("light 2") as light entity in home assistant because we are unable to turn on and off light 2 independently? I will provide a service per method.
If you use the mihome app it's possible to control both lights independently and ignore the saved state? Oooh! I missed something:
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_eyecare '["on"]'
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_eyecare '["off"]'
Which light is controlled?
Please check out the develop branch and give it a try. It can be used as custom_component and will override the official light.xiaomi_miio component: https://github.com/syssi/philipslight/archive/develop.zip
@buikdaanser Any progress on testing this one? ;-)
Thanks. Was on vacation and became ill on return. I look at it as quickly as possible.
@buikdaanser Do you own a rooted android device? I would like to request some data (mihome plugin apk). I will provide instructions on demand.
I'm pretty sure now: The lights can be controlled independently:
mirobo raw_command set_eyecare "['on']"
mirobo raw_command set_eyecare "['off']"
Is the main light controllable with this commands?
The device is represented as two light entities now (eyecare light, ambient light). The feature is untested!
@syssi due to a ski accident (broken leg), I could not respond earlier. I can respond at least now. Thanks for your feature.
The Xiaomi Philips Eyecare Smart Lamp has two light units. As shown in the attachment below.
Please add a function to control the second light unit on the back of the lamp. To operate (on-off) as second light independently of light one.
https://static.afbeeldinguploaden.nl/1711/334447/37pvJEiU.jpg