『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 65118|回复: 50

[插件集成] 云米热水器插件

[复制链接]

8

主题

154

帖子

1158

积分

论坛技术达人

积分
1158
金钱
994
HASS币
20
发表于 2020-1-30 17:21:42 | 显示全部楼层 |阅读模式
本帖最后由 wen_jxpx 于 2020-1-31 16:50 编辑

https://github.com/SevenPlusJun/yunmi_water_heater

补充说明下: clientid 是需要抓包获取的,猜测是app内部算法生成的一个和手机设备相关的值。
理论上里面的YunmiWaterHeaterController类适用于所有的云米商城app里的设备,只是其他的就得自己抓包了。另外预约的时间没有额外做,默认是8-18点,可自己在504行代码中修改,或者用input_number关联。
QQ20200130-172549@2x.png



评分

参与人数 1金钱 +20 收起 理由
jyz_0501 + 20 论坛有你更精彩!

查看全部评分

回复

使用道具 举报

2

主题

102

帖子

432

积分

论坛积极会员

积分
432
金钱
330
HASS币
0
发表于 2020-1-30 17:38:28 | 显示全部楼层
请问,云米的设备是不是一定要买云米那个网关才可以?
回复

使用道具 举报

8

主题

154

帖子

1158

积分

论坛技术达人

积分
1158
金钱
994
HASS币
20
 楼主| 发表于 2020-1-30 17:40:36 | 显示全部楼层
Leven 发表于 2020-1-30 17:38
请问,云米的设备是不是一定要买云米那个网关才可以?

不需要,我是抓包实现的。
回复

使用道具 举报

6

主题

154

帖子

1395

积分

金牌会员

Rank: 6Rank: 6

积分
1395
金钱
1241
HASS币
10
发表于 2020-1-31 10:41:39 | 显示全部楼层
论坛有你更精彩
回复

使用道具 举报

6

主题

154

帖子

1395

积分

金牌会员

Rank: 6Rank: 6

积分
1395
金钱
1241
HASS币
10
发表于 2020-1-31 11:41:20 | 显示全部楼层
报错啊大神,哪里出问题了
360截图20200131114016367.jpg
回复

使用道具 举报

6

主题

154

帖子

1395

积分

金牌会员

Rank: 6Rank: 6

积分
1395
金钱
1241
HASS币
10
发表于 2020-1-31 11:44:36 | 显示全部楼层
2020-01-31 11:36:33 ERROR (MainThread) [custom_components.yunmi_water_heater.water_heater] ============= yunmi water heater setup -> name: yunmi water heater =============
2020-01-31 11:36:33 ERROR (MainThread) [custom_components.yunmi_water_heater.water_heater] ============= YunmiWaterHeaterController setup -> phone_number: ********** =============
2020-01-31 11:36:34 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for gocloud which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2020-01-31 11:36:35 ERROR (MainThread) [homeassistant.components.water_heater] Error while setting up platform yunmi_water_heater
Traceback (most recent call last):
  File "/home/pi/.homeassistant/custom_components/yunmi_water_heater/water_heater.py", line 243, in yunmi_get_access_token
    self._access_token_exp_time = int(res_list['result']['expiresIn'])
KeyError: 'expiresIn'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.homeassistant/custom_components/yunmi_water_heater/water_heater.py", line 222, in yunmi_login
    tk_arr = self.yunmi_get_access_token(self._refresh_token, self._client_id)
  File "/home/pi/.homeassistant/custom_components/yunmi_water_heater/water_heater.py", line 246, in yunmi_get_access_token
    _LOGGER.error('get access token failed:'+e.__context__)
TypeError: can only concatenate str (not "NoneType") to str

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.homeassistant/custom_components/yunmi_water_heater/water_heater.py", line 169, in __init__
    self.yunmi_login()
  File "/home/pi/.homeassistant/custom_components/yunmi_water_heater/water_heater.py", line 231, in yunmi_login
    _LOGGER.error('login failed:'+e.__context__)
TypeError: can only concatenate str (not "KeyError") to str

During handling of the above exception, another exception occurred:
回复

使用道具 举报

8

主题

154

帖子

1158

积分

论坛技术达人

积分
1158
金钱
994
HASS币
20
 楼主| 发表于 2020-1-31 16:48:00 | 显示全部楼层
shangjiazi 发表于 2020-1-31 11:44
2020-01-31 11:36:33 ERROR (MainThread) [custom_components.yunmi_water_heater.water_heater] ========= ...

获取expiresIn出错了, 你的clientid是怎么获取的。 这个需要抓包哦。 暂时没有解决这个值是怎么产生的。
回复

使用道具 举报

6

主题

154

帖子

1395

积分

金牌会员

Rank: 6Rank: 6

积分
1395
金钱
1241
HASS币
10
发表于 2020-2-1 16:13:37 | 显示全部楼层
抓的包没分析出来,还望普及一下
回复

使用道具 举报

220

主题

1284

帖子

7847

积分

超级版主

Rank: 8Rank: 8

积分
7847
金钱
6533
HASS币
86

教程狂人论坛风云人物突出贡献

发表于 2020-2-1 16:45:05 | 显示全部楼层
请问楼主是用什么工具抓包呢?试了几个都很难抓到
回复

使用道具 举报

6

主题

154

帖子

1395

积分

金牌会员

Rank: 6Rank: 6

积分
1395
金钱
1241
HASS币
10
发表于 2020-2-1 17:01:02 | 显示全部楼层
lidicn 发表于 2020-2-1 16:45
请问楼主是用什么工具抓包呢?试了几个都很难抓到

我用Wireshark抓的包实在是看不懂
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-26 11:57 , Processed in 0.064163 second(s), 36 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表