|
本帖最后由 121665460 于 2021-10-18 16:42 编辑
1. 按装https://github.com/syssi/xiaomi_raw
2.通过破解版米家app(https://www.kapiba.ru/2017/11/mi-home.html#more)抓控制数据(理论上米家app里有的都可以控制),ios用户请自己抓包。
路径/vevs/logs/miio/xxx.txt
小鲸洗relax:(部分控制的log我提取好了,自己在app点响应的操作就会出现)get_prop不能随意组合获取,只能按照app里日志有的几种组合。
192.168.31.81
xjx.toilet.relax
xxxxxxxxxxxxxxzxxxx(token)
// 状态
2021-01-25 12:10:07 -> {"id":8568,"method":"get_prop","params":["seating"]} //着坐状态
# - status_seatheat //是否开启加热
# - status_led
# - status_selfclean
# - bubble_level
# - status_tunwash
# - status_womenwash
//控制
send_seat_heat
work_seatheat
2021-01-25 12:09:49 -> {"id":8559,"method":"work_night_led","params":[1]} //开灯
2021-01-25 12:09:53 -> {"id":8562,"method":"work_night_led","params":[0]} //关灯
2021-01-25 12:10:08 -> {"id":8570,"method":"self_clean_on","params":[]} //自清洁
2021-01-25 12:10:34 -> {"id":8618,"method":"flush_on","params":[]} //冲洗
2021-01-25 12:11:05 -> {"id":8626,"method":"bubble_shield_on","params":[]}//防臭泡沫
2021-01-25 12:11:23 -> {"id":8630,"method":"set_auto_led","params":[1]} //自动开灯
2021-01-25 12:11:23 -> {"id":8631,"method":"set_auto_close","params":[1]} //自动关盖
2021-01-25 12:11:29 -> {"id":8633,"method":"set_bubble","params":[1]} //设置泡沫量(app里没有对应功能)
2021-01-25 12:11:29 -> {"id":8634,"method":"set_auto_bubble","params":[0]}//自动防臭泡沫
2021-01-25 12:11:29 -> {"id":8635,"method":"set_freq_bubble","params":[1024]}//定期防臭泡沫
2021-01-25 12:11:36 -> {"id":8638,"method":"set_flush","params":[0]} //水量
2021-01-25 12:09:52 -> {"id":8560,"method":"get_prop","params":["status_led"]}
2021-01-25 12:09:52 <- {"code":0,"exe_time":140,"id":8560,"net_cost":68,"ot_cost":3178,"otlocalts":1611547793551648,"result":[1]}
2021-01-25 12:09:52 -> {"id":8561,"method":"get_prop","params":["bubble_level"]}
2021-01-25 12:09:52 <- {"code":0,"exe_time":170,"id":8561,"net_cost":67,"ot_cost":3163,"otlocalts":1611547794240165,"result":[3]}
2021-01-25 12:09:25 -> {"id":8542,"method":"get_prop","params":["status_womenwash","water_temp_w","water_strong_w","water_pos_w","moving_w","status_massage_w"]}
2021-01-25 12:09:25 <- {"code":0,"exe_time":130,"id":8542,"net_cost":74,"ot_cost":3224,"otlocalts":1611547766568440,"result":[0,2,2,1,0,0]}
2021-01-25 12:09:25 -> {"id":8543,"method":"get_prop","params":["status_tunwash","water_temp_t","water_strong_t","water_pos_t","moving_t","status_massage_t"]}
2021-01-25 12:09:25 <- {"code":0,"exe_time":200,"id":8543,"net_cost":108,"ot_cost":2944,"otlocalts":1611547766688603,"result":[0,2,2,1,0,0]}
3.配置yaml(没写全)
sensor:
- platform: xiaomi_miio_raw
name: xjx_seating
host: 192.168.xx
token: xxx
sensor_property: "seating"
default_properties_getter: "get_prop"
default_properties:
- seating
- platform: xiaomi_miio_raw
name: xjx_status_seatheat
host: 192.168.xx
token: xxx
sensor_property: "status_seatheat"
default_properties_getter: "get_prop"
default_properties:
- seat_temp
- status_seatheat
- platform: xiaomi_miio_raw
name: xjx_status_led
host: 192.168.xx
token: xxx
sensor_property: "status_led"
default_properties_getter: "get_prop"
default_properties:
- status_led
- platform: template
sensors:
xjx_seating_state:
friendly_name: "着坐"
value_template: "{{ state_attr('sensor.xjx_seating','seating')==1 }}"
script:
xjx_flush_on:
alias: 马桶冲水
sequence:
- service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.xjx_status_led
method: flush_on
params: ""
xjx_seat_on:
alias: 马桶圈加热开
sequence:
- service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.xjx_status_led
method: work_seatheat
params: 1
- service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.xjx_status_led
method: send_seat_heat
params: 1
xjx_seat_off:
alias: 马桶圈加热关
sequence:
- service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.xjx_status_led
method: work_seatheat
params: 0
xjx_led_on:
alias: 马桶夜灯开
sequence:
- service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.xjx_status_led
method: work_night_led
params: 1
xjx_led_off:
alias: 马桶夜灯关
sequence:
- service: xiaomi_miio_raw.sensor_raw_command
data_template:
entity_id: sensor.xjx_status_led
method: work_night_led
params: 0
switch:
- platform: template
switches:
xjx_seat_switch:
unique_id: xjx_seat_switch
value_template: "{{ is_state('sensor.xjx_status_seatheat','1') }}"
turn_on:
service: script.xjx_seat_on
turn_off:
service: script.xjx_seat_off
xjx_led_switch:
unique_id: xjx_led_switch
value_template: "{{ is_state('sensor.xjx_status_led','1') }}"
turn_on:
service: script.xjx_led_on
turn_off:
service: script.xjx_led_off
4.使用
5.为什么使用miio而不使用miot,
查询http://miot-spec.org/miot-spec-v ... 000A02E:xjx-relax:1,发现miot只能控制坐圈加热和夜灯。而miio可以控制所有app里的操作。
6.写好的插件米家 马桶/马桶圈插件 -- xiaomi_miio_toilet - 『HomeAssistant』综合讨论区 - 『瀚思彼岸』» 智能家居技术论坛 - Powered by Discuz! (hassbian.com)
7.目前app里没有开盖的控制和状态,所以不能实现人体传感器感应后自动开盖等(有设备的可以尝试下sensor_raw_command各种参数)
|
评分
-
查看全部评分
|