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

Philips Eyecare - physical buttons stops working after few days #617

Open
pniewiadowski opened this issue Jan 26, 2020 · 69 comments
Open

Philips Eyecare - physical buttons stops working after few days #617

pniewiadowski opened this issue Jan 26, 2020 · 69 comments

Comments

@pniewiadowski
Copy link

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:

  1. Philips eyecare synced with Mi Home app, works without problem. Both, physical buttons and app control works without problem,
  2. 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.

@syssi
Copy link
Collaborator

syssi commented Jan 26, 2020

Do you mean the button of the device itself? What happens after 4-5 days if you remove the integration from HA?

@pniewiadowski
Copy link
Author

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 :)

@pniewiadowski
Copy link
Author

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.

@syssi
Copy link
Collaborator

syssi commented Jan 27, 2020

You should contact the manufacturer of your device because it looks like an firmware issue which cannot be solved here.

@pniewiadowski
Copy link
Author

Hmm, so why is that the manufacturer integration (Mi Home app) works, while once I start using python-miio it stops?

@syssi
Copy link
Collaborator

syssi commented Jan 27, 2020

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. :-)

@pniewiadowski
Copy link
Author

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 :)

@pniewiadowski
Copy link
Author

pniewiadowski commented Jan 27, 2020

Hey, I found out this is the same here: syssi/philipslight#25

I can try and help, but need some guidance, what I can check.

@maximalexanian
Copy link

The same issue here with two different versions of the lamp. Please let me know if I can help debugging it

@Emilv2
Copy link

Emilv2 commented Mar 4, 2020

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?

@pniewiadowski
Copy link
Author

pniewiadowski commented Apr 1, 2020

Hey, any news about this? I really would like to help, but not sure how.

@rytilahti
Copy link
Owner

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).

@seafoodrice
Copy link

To refresh the discussion of the defect, I am joining the party and become another additional victim of the issue.

@xekil
Copy link

xekil commented Aug 13, 2020

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

@bazuchan
Copy link
Contributor

A have the same problem with xiaomi zhimi heater and it started after firmware upgrade.

@Stupco
Copy link

Stupco commented Sep 2, 2020

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

@TigranAsaturjan
Copy link

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.

@janowakps
Copy link

same issue philips eyecare 2 I used openhab before and everything worked there, after switching to homeassistant the buttons stopped working

@syssi
Copy link
Collaborator

syssi commented Jan 18, 2021

@janowakps Are you sure? Can we try to compare both implementations?

@Emilv2
Copy link

Emilv2 commented Jan 18, 2021

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

@syssi
Copy link
Collaborator

syssi commented Jan 18, 2021

This issue applies to the sread1, right?

@syssi
Copy link
Collaborator

syssi commented Jan 18, 2021

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

@syssi
Copy link
Collaborator

syssi commented Jan 18, 2021

# 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

@syssi
Copy link
Collaborator

syssi commented Jan 18, 2021

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) {

@syssi
Copy link
Collaborator

syssi commented Jan 18, 2021

Anybody here available for an experiment?

  1. Remove this device from HA (comment out the philipslight platform).
  2. Reboot the lamp and test the phyiscal buttons. They should work now.
  3. Install this custom component: https://github.com/syssi/xiaomi_raw/
  4. 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'
  1. Restart Home Assistant
  2. 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 the set_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.

@janowakps
Copy link

janowakps commented Jan 18, 2021

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

@Emilv2
Copy link

Emilv2 commented Jan 18, 2021

I'll give it a try too

@pniewiadowski
Copy link
Author

Trying this one as well. Will see.

@Emilv2
Copy link

Emilv2 commented Feb 23, 2021

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.

@syssi
Copy link
Collaborator

syssi commented Feb 23, 2021

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.

@Emilv2
Copy link

Emilv2 commented Feb 23, 2021

I was too quick in replying, those properties do indeed what you say and seem to work correctly for me.

@Emilv2
Copy link

Emilv2 commented Mar 2, 2021

I have added notifystatus and the buttons stopped working after 5 days.

@janowakps
Copy link

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

@syssi
Copy link
Collaborator

syssi commented Mar 19, 2021

I will remove notifystatus from python-miio.

@Emilv2
Copy link

Emilv2 commented Mar 19, 2021

@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?

@syssi
Copy link
Collaborator

syssi commented Mar 19, 2021

Ups. You are right. In this case the exact solution is still undefined. :-(

@ratcashdev
Copy link

Isn't it possible to hook up Arduino studio to this lamp and check the logs/output?

@xekil
Copy link

xekil commented Jul 10, 2021

Hello, you can find a solution? Thanks you

@misterymisery
Copy link

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?

@syssi
Copy link
Collaborator

syssi commented Sep 26, 2021

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.

syssi added a commit to syssi/python-miio that referenced this issue Sep 26, 2021
@misterymisery
Copy link

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.

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'

@Emilv2
Copy link

Emilv2 commented Oct 11, 2021

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.

I tried this config and the buttons still stop working after a while.

@Emilv2
Copy link

Emilv2 commented Oct 28, 2021

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?

@xekil
Copy link

xekil commented Nov 8, 2021

hello, any idea of the official integration modification date?

@syssi
Copy link
Collaborator

syssi commented Nov 8, 2021

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.

@Emilv2
Copy link

Emilv2 commented Nov 8, 2021

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.

@xekil
Copy link

xekil commented Nov 9, 2021

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

@xekil
Copy link

xekil commented Dec 12, 2021

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/

@rytilahti
Copy link
Owner

@xekil that's a separate issue, but I added the model to #1246 so that it will disappear from the logs in time.

@xekil
Copy link

xekil commented Dec 13, 2021

@rytilahti OK, thanks.
Any ideas on the availability of the fix for the physical buttons problem?

thank you

@YuvalWS
Copy link

YuvalWS commented May 1, 2022

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.

@xekil
Copy link

xekil commented Jun 4, 2022

Any ideas on the availability of the fix for the physical buttons problem?
thank you

@rytilahti
Copy link
Owner

Sorry, I have no idea what is causing the problem nor do I have such a device myself, so I cannot really help here :-(

@xekil
Copy link

xekil commented Jul 22, 2022

any update ?

@YuvalWS
Copy link

YuvalWS commented Dec 9, 2022

New ideas, someone?

@xekil
Copy link

xekil commented Jan 20, 2024

Any ideas on the availability of the fix for the physical buttons problem?
thank you

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

No branches or pull requests