Skip to content

Add yeelink.light.lamp1model to miio light platform (Mi LED Desk Lamp) #17699

Closed
dmacvicar wants to merge 3 commits intohome-assistant:devfrom
dmacvicar:xiaomi_mi_desk_lamp
Closed

Add yeelink.light.lamp1model to miio light platform (Mi LED Desk Lamp) #17699
dmacvicar wants to merge 3 commits intohome-assistant:devfrom
dmacvicar:xiaomi_mi_desk_lamp

Conversation

@dmacvicar
Copy link
Copy Markdown

@dmacvicar dmacvicar commented Oct 22, 2018

Description:

After getting a Mi LED Desk Lamp (MJTD01YL), I was very lost on how to get it to work with home assistant. The lamp is controlled with the same app as the Mi Robot Vacuum, and talks to the cloud.

proxy duckduckgo com

After recovering the token with the miio cli, I went to home assistant Yeelight component, but realized it does not take a token in the configuration. I went then to the miio component, and it failed because it was an unrecognized model (yeelink.light.lamp1)

I noticed python-miio has a yeelight device class, so I added a new light that uses this device to control the light. I also refactored the naming a bit to make it less tied to "Philips" in the base classes.

Example entry for configuration.yaml (if applicable):

light:
  - platform: xiaomi_miio
    name: Mi LED Desk Lamp
    host: 192.168.178.119
    token: XXXXXXXXXXXXXXXXXXXXXXXXXXX
    model: yeelink.light.lamp1

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

This model includes the Mi LED Desk Lamp (MJTD01YL)
dmacvicar added a commit to dmacvicar/home-assistant.io that referenced this pull request Oct 22, 2018
Adds support for the Mi LED Desk Lamp.
@ghost ghost added the in progress label Oct 22, 2018
Copy link
Copy Markdown
Member

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks generally okay to me, just a quick question, is this not controllable with the yeelight app / is it not possible to enable the lan mode from there for these?

@homeassistant
Copy link
Copy Markdown
Contributor

Hi @dmacvicar,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

Copy link
Copy Markdown
Author

@dmacvicar dmacvicar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rytilahti I did not try as the app showed "Login" as the first screen.

screenshot_20181023-211348

However, after clicking it I realized it used the same Mi account, and I was able to turn the light into LAN mode.

It works perfectly with the Yeelight platform. Not sure if to laugh or if to cry 😄 😢 !

Perhaps I should just update the documentation to make things less confusing.

Should we just dismiss this PR and close it?. I don't know if this method of accessing the light helps anyone. Eg. in a country where the app is not available, but miio still can retrieve the token.

@syssi
Copy link
Copy Markdown
Member

syssi commented Oct 23, 2018

We should close this PR. :-)

@rytilahti
Copy link
Copy Markdown
Member

@dmacvicar Yeah, I suppose the documentation could use some help (also that of python-miio..), so any help is very welcome! I just created a PR to python-miio to at least expose the yeelight functionality a bit (assuming you have the token, you can also use python-miio to enable the developer/lan mode, no need for the yeelight app).

@home-assistant home-assistant locked and limited conversation to collaborators Feb 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants