syssi / philipslight

Xiaomi Philips Lights integration for Home Assistant
Apache License 2.0
70 stars 19 forks source link

Add philips.light.zystrip support #24

Open jiagangxu opened 5 years ago

jiagangxu commented 5 years ago

2019-09-08 18:37:04 ERROR (MainThread) [homeassistant.components.xiaomi_miio.light] Unsupported device found! Please create an issue at https://github.com/syssi/philipslight/issues and provide the following data: philips.light.zystrip Could you guys help to support the strip light? It should be technically possible according to https://www.openhab.org/addons/bindings/miio. Appreciate your help!

syssi commented 4 years ago

@terenceng81 Do you use the MiHome app with the philips.light.zystrip and do you have a rooted android device? I'm interested in the Mie Home app plugin of this device. Are you able to control the device if you use the bulb model at your configuration.yaml?

terenceng81 commented 4 years ago

FYI, I am currently using "philips.light.bulb" for the Philips Cove light "philips.light.zystrip", it is working and having the "Google Home unable to add Unavailable issue" issue.

terenceng81 commented 4 years ago

@terenceng81 Do you use the MiHome app with the philips.light.zystrip and do you have a rooted android device? I'm interested in the Mie Home app plugin of this device. Are you able to control the device if you use the bulb model at your configuration.yaml?

Yes, I am able to control "philips.light.zystrip" using bulb model.

Yes, I do have rooted Anroid simulator that i used to collect tokens from the database.

terenceng81 commented 4 years ago

For unknown reason, all assigned lights (philips.light.bulb and philips.light.downlight) are gone in Google Home.. It seems "Model" is not the root caused.

All these devices are now in "Linked to you & Not in a Home & Room" in Google Home App, :-(

syssi commented 4 years ago

It doesn't sound like an issue of this costum component. Do you have additional devices /components in Google Home which are stable?

terenceng81 commented 4 years ago

It doesn't sound like an issue of this costum component. Do you have additional devices /components in Google Home which are stable?

I have Yeelight products (strip, ceiling light, bulb, table lamb), they are stable.

Aqara products (Curtain, Aircon Controller, Power Plug)

Zhimi products (Pedestal Fan)

Xiaomi products (Vaccum robot, Sensor, Air Humidifier, Air Purifier)

All the above are ok except for the Xiaomi-Philips Downlight and Cove Light

syssi commented 4 years ago

If you unplug and replug the Air Purifier, do you have the same issue?

terenceng81 commented 4 years ago

If you unplug and replug the Air Purifier, do you have the same issue?

U are right, the same issue happens. Air Purifier becomes a "new found" device after I refresh the main page of Google Home App..

It does not happen to the integrated "linked Services" like "Yeelight" or "Smart Things".

I've linked XiaoMi Service but only limited devices available and does not include XIaoMi-Philips downlight.

syssi commented 4 years ago

The problematic devices are exposed by HA. The Yeelight and Smart Things devices are connected directly? May be this is a HA issue in general independent of the used HA component/integration?

terenceng81 commented 4 years ago

The problematic devices are exposed by HA. The Yeelight and Smart Things devices are connected directly? May be this is a HA issue in general independent of the used HA component/integration?

You are right, I just tested other devices and experienced the same issue, so long they are exposed by HA will then encounter this issue.

The Yeelight and Smart Things devices are added to the Google Home App directly, Google called it "Linked Services", all these devices are not affected.

High chance this is a HA issue but I do not know how to escalate this case to official HA,

syssi commented 4 years ago

Please open an issue at the official repository: https://github.com/home-assistant/home-assistant

terenceng81 commented 4 years ago

Please open an issue at the official repository: https://github.com/home-assistant/home-assistant

Thanks syssi.

I have reported this case using the link given. Below is the case link. https://github.com/home-assistant/home-assistant/issues/28268

BTW for your information, this issue does not happen to HA Cloud, maybe this is the only difference between Paid and Free service.

:-(

syssi commented 4 years ago

The zystrip supports following methods:

"add_mb", [item]
"apply_fixed_scene", [scene_num]
"delay_off", [0]
"delay_off", [second]
"enable_ac", [isOnStr]
"enable_bl", [isOnStr]
"enable_mb", [on ? 1 : 0]
"enable_mibs", [on ? 1 : 0]
"get_band_period", []
"get_mb_mac", []
"get_mb_rssi", []
"get_props", ['ac']
'get_props', ['dv']
"get_props", props
'get_props', props
"get_rc_mac", []
"get_switch_en", []
"miIO.bleGetNearbyBandList", []
"miIO.bleStartSearchBand", [1000]
"miIO.bleStartSearchBand", [10000]
"set_band_period", [this.state.preTime, this.state.nextTime]
"set_bricct", [bri, cct]
"set_bright", [bri]
"set_cct", [cct]
"set_mb_rssi", [value]
"set_power", [power]
"set_scene_switch", [this.state.items]
"set_switch_en", [on ? 1 : 0]
"del_rc", []
"start_rc_pair", []
"stop_rc_pair", []

And properties:

proprs = ["power", "bright", "cct", "snm", "dv", "sw", "bl", "ms", "ac"]

power = "on", "off"
bright = 0...100
cct = 1...35(?)
snm = 1, 2, 3, 4
dv = delayed turn of in seconds?
sw = wall switch
bl = 0(off), 1(on) (dlSwitchIsOn)
ms = 0(off), 1(on) (miband feature, sleep)
ac = 0(off), 1(on) (autoAmbiance)
syssi commented 4 years ago

@terenceng81 Could you provide the output of these commands:


miiocli device --ip IP --token XXXXXXXXXXXXX info
miiocli device --ip IP --token XXXXXXXXXXXXX get_prop "['power', 'bright', 'cct', 'snm', 'dv', 'sw', 'bl', 'ms', 'ac']"
miiocli device --ip IP --token XXXXXXXXXXXXX get_switch_en 
miiocli device --ip IP --token XXXXXXXXXXXXX get_rc_mac

miiocli device --ip IP --token XXXXXXXXXXXXX set_power "['off']"
miiocli device --ip IP --token XXXXXXXXXXXXX set_power "['on']"
miiocli device --ip IP --token XXXXXXXXXXXXX set_cct "[1]"
miiocli device --ip IP --token XXXXXXXXXXXXX set_cct "[35]"
miiocli device --ip IP --token XXXXXXXXXXXXX set_cct "[36]"
miiocli device --ip IP --token XXXXXXXXXXXXX set_cct "[100]"
miiocli device --ip IP --token XXXXXXXXXXXXX get_prop "['power', 'bright', 'cct', 'snm', 'dv', 'sw', 'bl', 'ms', 'ac']"
miiocli device --ip IP --token XXXXXXXXXXXXX set_power "['off']"

miiocli device --ip IP --token XXXXXXXXXXXXX enable_ac "[1]"
miiocli device --ip IP --token XXXXXXXXXXXXX enable_ac "[0]"

miiocli device --ip IP --token XXXXXXXXXXXXX enable_bl "[1]"
miiocli device --ip IP --token XXXXXXXXXXXXX enable_bl "[0]"

In some cases it would be interesting, what's happening if you've called the command. Thanks in advance!

syssi commented 4 years ago

Could you provide a link to a product page where I can see/buy the device we are talking about?

rezmus commented 4 years ago

i think it's this one

https://aliexpress.com/item/32951674146.html

terenceng81 commented 4 years ago

i think it's this one

https://aliexpress.com/item/32951674146.html

I got it from https://www.xiaomiyoupin.com/detail?gid=104093

I've compared the link given with my link, yes they are the same product.

terenceng81 commented 4 years ago

@terenceng81 Could you provide the output of these commands:


miiocli device --ip IP --token XXXXXXXXXXXXX info
miiocli device --ip IP --token XXXXXXXXXXXXX get_prop "['power', 'bright', 'cct', 'snm', 'dv', 'sw', 'bl', 'ms', 'ac']"
miiocli device --ip IP --token XXXXXXXXXXXXX get_switch_en 
miiocli device --ip IP --token XXXXXXXXXXXXX get_rc_mac

miiocli device --ip IP --token XXXXXXXXXXXXX set_power "['off']"
miiocli device --ip IP --token XXXXXXXXXXXXX set_power "['on']"
miiocli device --ip IP --token XXXXXXXXXXXXX set_cct "[1]"
miiocli device --ip IP --token XXXXXXXXXXXXX set_cct "[35]"
miiocli device --ip IP --token XXXXXXXXXXXXX set_cct "[36]"
miiocli device --ip IP --token XXXXXXXXXXXXX set_cct "[100]"
miiocli device --ip IP --token XXXXXXXXXXXXX get_prop "['power', 'bright', 'cct', 'snm', 'dv', 'sw', 'bl', 'ms', 'ac']"
miiocli device --ip IP --token XXXXXXXXXXXXX set_power "['off']"

miiocli device --ip IP --token XXXXXXXXXXXXX enable_ac "[1]"
miiocli device --ip IP --token XXXXXXXXXXXXX enable_ac "[0]"

miiocli device --ip IP --token XXXXXXXXXXXXX enable_bl "[1]"
miiocli device --ip IP --token XXXXXXXXXXXXX enable_bl "[0]"

In some cases it would be interesting, what's happening if you've called the command. Thanks in advance!

Hi syssi,

May I know how do i run this command?

ssh to my HA and entered the command below but does not work.. miiocli device --ip 192.168.8.152 --token 3bd3c23837071ab35xxxxxxxx info

core-ssh:~# miiocli device --ip 192.168.8.152 --token 3bd3c23837xxxx info -bash: miiocli: command not found

syssi commented 4 years ago

If you have another linux host just install python-miio by:

pip3 install python-miio
terenceng81 commented 4 years ago

If you have another linux host just install python-miio by:

pip3 install python-miio

Only the first command is working, the rest having "Unknown command" errors.

Last login: Mon Oct 28 13:27:07 on ttys002 Terences-Macbook-Air:~ terenceng$ Terences-Macbook-Air:~ terenceng$ miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e info Hardware version: ESP8266 Firmware version: 1.2.8 Network: {'localIp': '192.168.8.113', 'mask': '255.255.255.0', 'gw': '192.168.8.1'} AP: {'rssi': -82, 'ssid': '13-19 HOME WIFI', 'bssid': 'C6:FB:E4:44:00:C4'}

Error: Unknown command (get_switch_en) Error: Unknown command (get_rc_mac) Error: Unknown command (set_power) Error: Unknown command (set_cct) Error: Unknown command (get_prop) Error: Unknown command (set_power) Error: Unknown command (enable_ac) Error: Unknown command (enable_bl)

syssi commented 4 years ago

I've fixed the command list. There was a parameter missing:

miiocli device --ip IP --token XXXXXXXXXXXXX info
miiocli device --ip IP --token XXXXXXXXXXXXX raw_command get_prop "['power', 'bright', 'cct', 'snm', 'dv', 'sw', 'bl', 'ms', 'ac']"
miiocli device --ip IP --token XXXXXXXXXXXXX raw_command get_switch_en 
miiocli device --ip IP --token XXXXXXXXXXXXX raw_command get_rc_mac

miiocli device --ip IP --token XXXXXXXXXXXXX raw_command set_power "['off']"
miiocli device --ip IP --token XXXXXXXXXXXXX raw_command set_power "['on']"
miiocli device --ip IP --token XXXXXXXXXXXXX raw_command set_cct "[1]"
miiocli device --ip IP --token XXXXXXXXXXXXX raw_command set_cct "[35]"
miiocli device --ip IP --token XXXXXXXXXXXXX raw_command set_cct "[36]"
miiocli device --ip IP --token XXXXXXXXXXXXX raw_command set_cct "[100]"
miiocli device --ip IP --token XXXXXXXXXXXXX raw_command get_prop "['power', 'bright', 'cct', 'snm', 'dv', 'sw', 'bl', 'ms', 'ac']"
miiocli device --ip IP --token XXXXXXXXXXXXX raw_command set_power "['off']"

miiocli device --ip IP --token XXXXXXXXXXXXX raw_command enable_ac "[1]"
miiocli device --ip IP --token XXXXXXXXXXXXX raw_command enable_ac "[0]"

miiocli device --ip IP --token XXXXXXXXXXXXX raw_command enable_bl "[1]"
miiocli device --ip IP --token XXXXXXXXXXXXX raw_command enable_bl "[0]"
terenceng81 commented 4 years ago

Everything is okay except for the Enable_AC_On and Enable_AC_Off

miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e info Model: philips.light.zystrip Hardware version: ESP8266 Firmware version: 1.2.8 Network: {'localIp': '192.168.8.113', 'mask': '255.255.255.0', 'gw': '192.168.8.1'} AP: {'rssi': -80, 'ssid': '13-19 HOME WIFI', 'bssid': 'C6:FB:E4:44:00:C4'}

miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e raw_command get_prop "['power', 'bright', 'cct', 'snm', 'dv', 'sw', 'bl', 'ms', 'ac']" Running command raw_command ['off', 14, 100, 0, 0, [[0, 3], [0, 2], [0, 1]], 1, 1]

miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e raw_command get_switch_en Running command raw_command [1]

miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e raw_command get_rc_mac Running command raw_command ['']

miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e raw_command set_power "['off']" Running command raw_command ['ok']

miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e raw_command set_power "['on']" Running command raw_command ['ok']

miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e raw_command set_cct "[1]" Running command raw_command ['ok']

miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e raw_command set_cct "[35]" Running command raw_command ['ok']

miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e raw_command set_cct "[36]" Running command raw_command ['ok']

miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e raw_command set_cct "[100]" Running command raw_command ['ok']

miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e raw_command get_prop "['power', 'bright', 'cct', 'snm', 'dv', 'sw', 'bl', 'ms', 'ac']" Running command raw_command ['on', 14, 100, 0, 0, [[0, 3], [0, 2], [0, 1]], 1, 1]

miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e raw_command set_power "['off']" Running command raw_command ['ok']

miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e raw_command enable_ac "[1]" Running command raw_command ERROR:miio.device:Got error when receiving: timed out Error: No response from the device

miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e raw_command enable_ac "[0]" Running command raw_command ERROR:miio.device:Got error when receiving: timed out Error: No response from the device

miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e raw_command enable_bl "[1]" Running command raw_command ['ok']

miiocli device --ip 192.168.8.113 --token 527daede17f1afe5de70a5cd40f7317e raw_command enable_bl "[0]" Running command raw_command ['ok']