hasscc / meiju Goto Github PK
View Code? Open in Web Editor NEWMidea Meiju (美的美居) For HomeAssistant
License: Apache License 2.0
Midea Meiju (美的美居) For HomeAssistant
License: Apache License 2.0
首先在这里感谢 @mac-zhou @blindlight86 @vividmuse 等各位大佬对美的美的设备协议和美居APP接口的不懈努力,此插件的只要功能即将美的设备的读写命令通过yaml转换为HA实体。美的设备的读写命令是通过字节(byte)数组传输的,因此适配美的设备需要一点编程基础。
当前阶段,本插件仅支持yaml配置,后续会支持通过UI集成
# configuration.yaml
meiju:
# 单个账号
username: 18866668888 # 美居APP账号
password: abcdefghijk # 美居APP密码
devices: # 设备列表
- device_id: 160123456789001 # 设备ID
host: 192.168.1.101 # 设备IP
- device_id: 160123456789002
host: 192.168.1.102
# 多个账号
accounts:
- username: 18866668881 # 账号1
- username: 18866668882 # 账号2
devices: # 设备列表
customizes: # 设备自定义
customizes:
根据设备类型或SN8(型号)为设备解析命令成HA实体的配置,类似于HA的template
,可以为设备添加不同类型的实体以展示状态和控制设备
get_extra: {10: 0x31}
配置查询状态命令索引为10的byte值为0x31
,部分设备为0x03
或其他set_extra: {10: 0x21}
配置控制设备命令索引为10的byte值为0x21
sensors:
添加sensor传感器实体
byte: 11
表示该实体的状态在状态byte数组的第12位上(索引为11)dict:
字典或数组,映射状态值state_template:
实体状态模板attrs_template:
实体属性模板,返回字典binary_sensors:
添加二元传感器实体,同sensors
state_template:
实体状态模板,返回布尔switches:
添加开关实体
on_value: 0x01
byte位上的值等于此值时表示开off_value: 0x00
byte位上的值等于此值时表示关on_extra:
打开时设置额外的byte数据,字典类型off_extra:
关闭时设置额外的byte数据,字典类型selects:
添加下拉选择实体,如:模式
set_extra:
选中选项时设置额外的byte数据options:
下拉选项,字典类型,key为byte位上的值
name:
选项名称extra:
选中时额外的byte数据,字典类型numbers:
添加数值实体,如:目标温度
max:
最大值min:
最小值step:
步长,默认1meiju.get_lua
服务获取设备的lua脚本lua
目录下有常用设备的lua0x02
控制 0x03
读取)get_extra
set_extra
modelNumber
或sn8
来区分,这两种型号可以在info实体的属性中找到meiju.get_plugin
服务获取设备的JS插件代码device_customizes.yaml
一起参与适配。在我的HomeAssistant中使用该插件添加美的JSQ30-MJ3热水器时程序出现错误,提示
Logger: homeassistant.setup
Source: setup.py:288
First occurred: 15:36:12 (1 occurrences)
Last logged: 15:36:12
Error during setup of component meiju
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 288, in _async_setup_component
result = await task
^^^^^^^^^^
File "/config/custom_components/meiju/__init__.py", line 100, in async_setup
await acc.update_devices(cfg.get(CONF_DEVICES) or [])
File "/config/custom_components/meiju/__init__.py", line 505, in update_devices
await dvc.auth_device()
File "/config/custom_components/meiju/__init__.py", line 632, in auth_device
token, key = await self.hass.async_add_executor_job(self.account.cloud.gettoken, udpid)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/msmart/cloud.py", line 190, in gettoken
response = self.api_request(
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/msmart/cloud.py", line 109, in api_request
self.handle_api_error(int(response['code']), response['msg'])
File "/usr/local/lib/python3.11/site-packages/msmart/cloud.py", line 275, in handle_api_error
handler()
File "/usr/local/lib/python3.11/site-packages/msmart/cloud.py", line 261, in throw
raise ValueError(error_code, message)
ValueError: (40404, '调用业务系统异常(访问地址不存在) [no Route matched with those values]')
用户名和密码检查是正确的,也有热水器信息返回。
此错误来自自定义集成。
Logger: custom_components.meiju
Source: custom_components/meiju/__init__.py:496
Integration: Midea Meiju (documentation, issues)
First occurred: 15:36:12 (1 occurrences)
Last logged: 15:36:12
211106239999999, e3, 51109999, 0000E353151101719181712000357YX4,0000, 204, 燃气热水器
尝试连接代码中的地址,该网址返回内容和错误提示一样
{"msg":"调用业务系统异常(访问地址不存在) [no Route matched with those values]","code":40404}
怀疑美的更改了业务网址导致该故障发生,期待作者大大看一下。
搞了好久,查询可以,控制不了,大佬,麻烦帮忙看下,谢谢
https://github.com/yingying77/midea-lexiang-3/blob/main/T_0000_AC_23096361_2022051705.lua
现在使用homeassistant通过易微联绑定了美的的空调,但是易微联不支持美的的洗碗机和电风扇这些职能产品,这边有其他什么办法吗
我在美的美居的app里找不到这个值……
如题
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.