python-miio
python-miio copied to clipboard
Philips Eyecare - physical buttons stops working after few days
Hi There,
don't know really where to put this issue, here or in Home Assistant, but let me try to explain and the you can redirect me to appropriate project.
Once the light is hooked up to Home Assistant via the miio integration, after few days, the physical buttons stops working on the device.
So we have two scenarios:
- Philips eyecare synced with Mi Home app, works without problem. Both, physical buttons and app control works without problem,
- Philips eyecare integrated into Home Assistant, works for 4, 5 days (physcial buttons, Mi Home app control, and via Home Assistant). After 4, 5 days, buttons doesn't react on touch, app control and HA integration works though.
Once I pull out the plug and plugin back again, the device reconnect to network, and buttons work again for few days.
I have run some debug commands and I am not able to spot anything interesting here, but maybe you are.
This is what I can see just after reset:
PS C:\WINDOWS\system32> mieye --ip=192.168.0.113 --token=xxxxxxxxxx-d INFO:miio.philips_eyecare_cli:Debug mode active DEBUG:miio.philips_eyecare_cli:Connecting to 192.168.0.113 with token xxxxxxxxxx DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b'' DEBUG:miio.device:Got a response: Container: data = Container: data = b'' (total 0) value = b'' (total 0) offset1 = 32 offset2 = 32 length = 0 header = Container: data = b'!1\x00 \x00\x00\x00\x00\x03.\xa0"\x00\x00\x02\xd2' (total 16) value = Container: length = 32 unknown = 0 device_id = unhexlify('032ea022') ts = 1970-01-01 00:12:02 offset1 = 0 offset2 = 16 length = 16 checksum = b'\x8f\x00\xcb\x89]\xe5j\x00\x0e\x8e\xc3\xca\x85\xec\x03\xe2' (total 16) DEBUG:miio.device:Discovered 032ea022 with ts: 1970-01-01 00:12:02, token: b'xxxxxxxxxx' DEBUG:miio.device:192.168.0.113:54321 >>: {'id': 2, 'method': 'get_prop', 'params': ['power', 'bright', 'notifystatus', 'ambstatus', 'ambvalue', 'eyecare', 'scene_num', 'bls', 'dvalue']} DEBUG:miio.device:192.168.0.113:54321 (ts: 1970-01-01 00:12:02, id: 2) << {'result': ['on', 47, 'off', 'on', 1, 'on', 1, 'on', 0], 'id': 2} Power: on Brightness: 47 Eye Fatigue Reminder: False Ambient Light: True Ambient Light Brightness: 1 Eyecare Mode: True Eyecare Scene: 1 Night Light: True Countdown of the delayed turn off: 0 minutes
This is once the button stooped reacting:
PS C:\Users\Przemek> mieye --ip=192.168.0.113 --token=xxxxxxxxx -d INFO:miio.philips_eyecare_cli:Debug mode active DEBUG:miio.philips_eyecare_cli:Connecting to 192.168.0.113 with token xxxxxxxxx DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b'' DEBUG:miio.device:Got a response: Container: data = Container: data = b'' (total 0) value = b'' (total 0) offset1 = 32 offset2 = 32 length = 0 header = Container: data = b'!1\x00 \x00\x00\x00\x00\x03.\xa0"\x00\x04\x8e\xaa' (total 16) value = Container: length = 32 unknown = 0 device_id = unhexlify('032ea022') ts = 1970-01-04 10:57:46 offset1 = 0 offset2 = 16 length = 16 checksum = b'\x8f\x00\xcb\x89]\xe5j\x00\x0e\x8e\xc3\xca\x85\xec\x03\xe2' (total 16) DEBUG:miio.device:Discovered 032ea022 with ts: 1970-01-04 10:57:46, token: b'xxxxxxxxx' DEBUG:miio.device:192.168.0.113:54321 >>: {'id': 2, 'method': 'get_prop', 'params': ['power', 'bright', 'notifystatus', 'ambstatus', 'ambvalue', 'eyecare', 'scene_num', 'bls', 'dvalue']} DEBUG:miio.device:192.168.0.113:54321 (ts: 1970-01-04 10:57:47, id: 2) << {'result': ['off', 50, 'off', 'off', 1, 'on', 1, 'on', 0], 'id': 2} Power: off Brightness: 50 Eye Fatigue Reminder: False Ambient Light: False Ambient Light Brightness: 1 Eyecare Mode: True Eyecare Scene: 1 Night Light: True Countdown of the delayed turn off: 0 minutes
I can try to help with debuging this, but please tell me what else I can do here. I own two of these lights, and both react the same way. I found a guy on the internet, which has same problem as mine.
Do you mean the button of the device itself? What happens after 4-5 days if you remove the integration from HA?
Yes, I mean the button of the device itself. Any of the buton doesn't react. Well, I didn't think of removing this integration, but le me check and come once the issue occur again. It can take few days :)
This time issue appeared a bit faster. After few hours. I have removed the integration from HA, but this did not resolve the problem. The other light which is not integrated with HA works as it should.
You should contact the manufacturer of your device because it looks like an firmware issue which cannot be solved here.
Hmm, so why is that the manufacturer integration (Mi Home app) works, while once I start using python-miio it stops?
What did you mean by:
I have removed the integration from HA, but this did not resolve the problem.
If the issue appears without interaction with 3rd party apps/libraries it should be a hardware/firmware issue of the device itself. Correct me if I'm wrong. :-)
I thought you want me to remove the integration from HA, once the issue occur again. So I did, and the issue persists.
The other Philips light is sync with Hi Home app, but not with HA and the issue doesn't appear so I think there is something with python-miio.
Hope I am clear now :)
Hey, I found out this is the same here: https://github.com/syssi/philipslight/issues/25
I can try and help, but need some guidance, what I can check.
The same issue here with two different versions of the lamp. Please let me know if I can help debugging it
Same issue here, when integrated with Home Assistant the physical buttons stop working after a while until the power is turned off (after which it happens again). When it's not connected with Home Assistant this problem does not occur.
I would say that the most logical explanation is that python-miio somehow triggers a bug (or a hidden child lock function?) in the firmware, but maybe we can find a workaround for it?
Hey, any news about this? I really would like to help, but not sure how.
Well, the only real way (in my opinion) to find out is to use the command-line tool (or create a script to do those calls) and find out at which point and at which call it will get stuck.
My intuition agrees with the analysis of @Emilv2 on that regard, but we need to find out what triggers it and then create a workaround for it.
As it does not hit until a few days later, maybe this has something to do with the sequence numbers? So perhaps:
- Too high sequence numbers trigger that behavior, or
- Cycling the ID back to one triggers this.
One way to try that out would be to initialize the device with a large sequence number and see what happens when it hits the limit (see https://github.com/rytilahti/python-miio/blob/master/miio/miioprotocol.py#L231).
To refresh the discussion of the defect, I am joining the party and become another additional victim of the issue.
I have exactly the same problem with 3 lamps, it is annoying because my children can no longer use the lamp, you can find a solution? Thanks you
A have the same problem with xiaomi zhimi heater and it started after firmware upgrade.
Same issue with 2x Philips Eyecare lamps, only happened since integrating with HA which is a shame as they are now useless for "dumb" operations (using buttons) which my wife prefers.
Would really like a fix!
Light Xiaomi firmware version: 1.2.8.0026
Same issue, for already a year... all the time i need to get a new token and as soon as it is connected to Home Assistant, buttons on the device are disabled. Please, need a solution for this.
same issue philips eyecare 2 I used openhab before and everything worked there, after switching to homeassistant the buttons stopped working
@janowakps Are you sure? Can we try to compare both implementations?
This seems to be the https://github.com/openhab/openhab-addons/tree/main/bundles/org.openhab.binding.miio miio OpenHAB implementation.
Edit: Think this is the official one
This issue applies to the sread1
, right?
https://github.com/openhab/openhab-addons/blob/main/bundles/org.openhab.binding.miio/src/main/resources/database/philips.light.sread1.json
Implemented properties and commands:
$ cat philips.light.sread1.json | grep property
"property": "power",
"property": "bright",
"property": "ambstatus",
"property": "ambvalue",
"property": "dvalue",
"property": "eyecare",
"property": "bl",
$
$ cat philips.light.sread1.json | grep command
"command": "set_power",
"command": "set_bright",
"command": "set_power",
"command": "enable_amb",
"command": "set_amb_bright",
"command": "set_eyecare",
"command": "enable_bl",
We are using this properties: https://github.com/rytilahti/python-miio/blob/master/miio/philips_eyecare.py#L122-L132
# python-miio, https://github.com/rytilahti/python-miio/blob/master/miio/philips_eyecare.py#L122-L131
"power",
"bright",
"ambstatus",
"ambvalue",
"dvalue",
"eyecare",
"bls", // typo?
"notifystatus", // not requested at openhab
"scene_num", // not requested at openhab
The mi home plugin (react app) uses this set of properties:
_miot.Device.getDeviceWifi().callMethod('get_prop', ["power", "bright", "notifystatus", "ambstatus", "ambvalue", "eyecare", "scene_num", "bls", "dvalue"]).then(function (response) {
Anybody here available for an experiment?
- Remove this device from HA (comment out the philipslight platform).
- Reboot the lamp and test the phyiscal buttons. They should work now.
- Install this custom component: https://github.com/syssi/xiaomi_raw/
- Configure the lamp as switch (because this component doesn't support a light entity):
switch:
- platform: xiaomi_miio_raw
name: Philips Eyecare Lamp
host: <host>
token: <token>
turn_on_command: 'set_power'
turn_on_parameters: 'on'
turn_off_command: 'set_power'
turn_off_parameters: 'off'
state_property: 'power'
state_property_getter: 'get_prop'
state_on_value: 'on'
state_off_value: 'off'
- Restart Home Assistant
- You should be able to control the lamp via the switch entity (
switch.philips_eyecare_lamp
) now. You cannot change the brightness remotely etc. because we are requesting a single property (periodically) now (power
) and we use theset_power
method only. If the phyiscal buttons are working now and doesn't get stuck we are on the right track. If the phyiscal buttons doesn't work after some time, we can stop this experiment and we don't need to care about the number of requested properties.
This issue applies to the
sread1
, right?
yes, everything except this lamp works fine I'm starting an experiment, I'll let you know in a few days
I'll give it a try too
Trying this one as well. Will see.
I have two of these lights. I have integrated them and reset the same time 4 days ago. One currently running on the "xiaomi_raw" custom component. another one on Home Assistant integration. The one running "xiaomi_raw" - no issue with buttons but the second one, I have found out today buttons stops working so the "xiaomi_raw" custom component looks promising :)
Continue testing.
same here, xiaomi_raw 4 days without issue
Yes, seems like you're on the right track @syssi
@syssi a week has passed and I can confirm with almost 100% certainty that in this configuration with xiaomi_raw it does not block the physical buttons
@syssi everything still works fine, can we move on? I will be happy to take part in further experiments
The next step is to request a properties periodically as the custom component is doing it. Just add this block to your configuration:
# first try
sensor:
- platform: xiaomi_miio_raw
name: Philips Eyecare Lamp Properties
host: <host>
token: <token>
sensor_property: 'bright'
sensor_unit: '%'
default_properties_getter: 'get_prop'
default_properties:
- power
- bright
- notifystatus
- ambstatus
- eyecare
- scene_num
- bls
- dvalue
A new sensor (sensor.philips_eyecare_lamp_properties
) will be registered. It will show the brightness property as value. The values of the other properties are available as attributes. As soon the device crashs we will reduce the number of properties.
# second try. The set of properties used at openhab. Using "bl" instead of "bls".
sensor:
- platform: xiaomi_miio_raw
name: Philips Eyecare Lamp Properties
host: <host>
token: <token>
sensor_property: 'bright'
sensor_unit: '%'
default_properties_getter: 'get_prop'
default_properties:
- power
- bright
- ambstatus
- ambvalue
- dvalue
- eyecare
- bl
I was trying to add this today but there seems to be a problem with sensor_unit
Invalid config for [sensor.xiaomi_miio_raw]: [sensor_unit] is an invalid option for [sensor.xiaomi_miio_raw]. Check: sensor.xiaomi_miio_raw->sensor_unit. (See ?, line ?).
I've released a fixed xiaomi_miio_raw
version (1.4.0
) right now. Please give it a try.
Weird, I didn't have that issue. The buttons just stopped working with the first test values. I will try the second test now.
@syssi hi so here is my results: first test with bls physical buttons stops responding after just one day second test with bl instead bls 9 days and still everytning works
so i think we have a solution
@syssi hi so here is my results: first test with bls physical buttons stops responding after just one day second test with bl instead bls 9 days and still everytning works
so i think we have a solution
Not yet I think, there are more differences between the two: there's also scene_num
and notifystatus
. Changing bl
into bls
does still work after 5 days here.
there are more differences between the two: there's also
scene_num
andnotifystatus
in fact, I didn't even notice these code differences but still it's been 10 days and I get this data from the integration
model: philips.light.sread1
firmware_version: 1.2.8
hardware_version: ESP8266
properties: eyecare, bright, power, notifystatus, scene_num, dvalue, bl, ambstatus
sensor_property: bright
eyecare: off
bright: 100
power: off
notifystatus: off
scene_num: 1
dvalue: 0
bl: on
unit_of_measurement: %
friendly_name: Philips Eyecare Lamp Properties
icon: mdi:flask-outline
so everything is fine except for the "ambstatus" property which should be turned on now (because I turned it on with the button) but it doesn't show at all
For me it's been six days now with these values in the configuration:
- power
- bright
- ambstatus
- ambvalue
- dvalue
- eyecare
- bls
ambvalue
and ambstatus
work for me:
model: philips.light.sread1
firmware_version: 1.2.8
hardware_version: ESP8266
properties: dvalue, ambstatus, power, bls, eyecare, ambvalue, bright
sensor_property: bright
dvalue: 0
ambstatus: off
power: on
bls: on
eyecare: off
ambvalue: 41
bright: 5
unit_of_measurement: %
friendly_name: Philips Eyecare Lamp Properties
icon: mdi:flask-outline
I'll wait a few more days to be 100% sure, but I don't think bls
is the issue. Maybe it's a combination that does it?
I'm also not really sure what ambvalue
, abmstatus
and bls
/bl
are supposed to represent, they do not seem to change values at all.
I would be happy if everybody could provide a list of good vs. bad properties.
ambvalue: Brightness of the ambient light.
ambstatus: Ambient light on/off
bls/bl: True if the smart night light mode is on.
I was too quick in replying, those properties do indeed what you say and seem to work correctly for me.
I have added notifystatus
and the buttons stopped working after 5 days.
24 days and still everythings works my properties:
- power
- bright
- notifystatus
- ambstatus
- eyecare
- scene_num
- bl
- dvalue
as you can see, notifystatus is not causing the problem
I will remove notifystatus
from python-miio.
@syssi I think you misread, @janowakps has no issue with notifystatus
.
I've been running this configuration for 17 days now and everything still works:
- power
- bright
- ambstatus
- scene_num
- ambvalue
- dvalue
- eyecare
- bls
So I'd say bls
isn't the problem either. Maybe it's a combination that triggers the issue?
Ups. You are right. In this case the exact solution is still undefined. :-(
Isn't it possible to hook up Arduino studio to this lamp and check the logs/output?
Hello, you can find a solution? Thanks you
It works like a charm! 2nd day and buttons on lamp still works. I am missing a bit brightness and ambient light control but even without it this lamp makes sense now. @syssi not sure if you are author of this fix do you think this can be implemented to final code or you can fix original integration?
Could somebody test this property set on the long run:
sensor:
- platform: xiaomi_miio_raw
name: Philips Eyecare Lamp Properties
host: <host>
token: <token>
sensor_property: 'bright'
sensor_unit: '%'
default_properties_getter: 'get_prop'
default_properties:
- power
- bright
- ambstatus
- notifystatus
- ambvalue
- dvalue
- eyecare
- bls
I've replaced scene_num
by notifystatus
to retrieve the most useful properties from the device.
Could somebody test this property set on the long run:
sensor: - platform: xiaomi_miio_raw name: Philips Eyecare Lamp Properties host: <host> token: <token> sensor_property: 'bright' sensor_unit: '%' default_properties_getter: 'get_prop' default_properties: - power - bright - ambstatus - notifystatus - ambvalue - dvalue - eyecare - bls
I've replaced
scene_num
bynotifystatus
to retrieve the most useful properties from the device.
I would like to help but I am not so good in writing in yaml.
This is my setup. How it should look with your settings you would like to test?
switch:
- platform: xiaomi_miio_raw name: Attic Philips Raw host: XXX.XXX.XXX.XXX token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx turn_on_command: 'set_power' turn_on_parameters: 'on' turn_off_command: 'set_power' turn_off_parameters: 'off' state_property: 'power' state_property_getter: 'get_prop' state_on_value: 'on' state_off_value: 'off'
Could somebody test this property set on the long run:
sensor: - platform: xiaomi_miio_raw name: Philips Eyecare Lamp Properties host: <host> token: <token> sensor_property: 'bright' sensor_unit: '%' default_properties_getter: 'get_prop' default_properties: - power - bright - ambstatus - notifystatus - ambvalue - dvalue - eyecare - bls
I've replaced
scene_num
bynotifystatus
to retrieve the most useful properties from the device.
I tried this config and the buttons still stop working after a while.
24 days and still everythings works my properties:
- power - bright - notifystatus - ambstatus - eyecare - scene_num - bl - dvalue
as you can see, notifystatus is not causing the problem
For me this configuration also does not seem to cause any issues. @syssi Maybe take this one then?
hello, any idea of the official integration modification date?
The set of properties provided by @Emilv2 cannot be used without dropping a feature (brightness of the ambient light). I'm unsure how to proceed here.
I see, that is unfortunate. This one worked for me (don't know about others, has anyone confirmed it worked?):
- power
- bright
- ambstatus
- scene_num
- ambvalue
- dvalue
- eyecare
- bls
Anything important missing here?
That aside, for me at least, being able to control the lamp manually is much more important than any other feature.
That aside, for me at least, being able to control the lamp manually is much more important than any other feature.
+++ 10000, update please, especially since the variation in the brightness of the ambient light is barely perceptible I find
after update ha 2021.12
Found an unsupported model 'philips.light.sread1' for class 'PhilipsEyecare'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
@xekil that's a separate issue, but I added the model to #1246 so that it will disappear from the logs in time.
@rytilahti OK, thanks. Any ideas on the availability of the fix for the physical buttons problem?
thank you
Same problem here. 2 Lamps, worked perfectly for months until I added them to HA. since I added them, after hours or days the physical buttons stops responding. plugging off fixes it temporarily. I thought maybe it happens after HA turns them on (manually or by automation) but nope. I seems not deterministic.
Any ideas on the availability of the fix for the physical buttons problem? thank you
Sorry, I have no idea what is causing the problem nor do I have such a device myself, so I cannot really help here :-(
any update ?