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

 找回密码
 立即注册
12
返回列表 发新帖
楼主: chychyy

米家智能插座2 蓝牙网关版如何接入HomeKit?

[复制链接]

1

主题

14

帖子

116

积分

注册会员

Rank: 2

积分
116
金钱
102
HASS币
0
QQ
发表于 2021-3-16 18:17:45 | 显示全部楼层
sensor:
  - platform: xiaomi_miio_raw
    name: smart_plug
    host: 192.168.x.x
    token: xxxxxxxxxx
    max_properties: 10
    default_properties_getter: get_properties
    default_properties:
      - "{'did': 'power', 'piid': 1, 'siid': 2}"
      - "{'did': 'temperature', 'piid': 6, 'siid': 2}"
      - "{'did': 'indicator_light', 'piid': 1, 'siid': 3}"
      - "{'did': 'on_duration', 'piid': 1, 'siid': 4}"
      - "{'did': 'off_duration', 'piid': 2, 'siid': 4}"
      - "{'did': 'countdown', 'piid': 3, 'siid': 4}"
      - "{'did': 'task_switch', 'piid': 4, 'siid': 4}"
      - "{'did': 'countdown_info', 'piid': 5, 'siid': 4}"
      - "{'did': 'power_consumption', 'piid': 1, 'siid': 5}"
      - "{'did': 'electric_current', 'piid': 2, 'siid': 5}"
      - "{'did': 'voltage', 'piid': 3, 'siid': 5}"
      - "{'did': 'electric_power', 'piid': 6, 'siid': 5}"
  - platform: template
    sensors:
      smart_plug_power:
        unique_id: smart_plug_power
        unit_of_measurement: W
        value_template: "{{ state_attr('sensor.smart_plug', 'electric_power')/100 }}"
        availability_template: "{{ not is_state('sensor.smart_plug', 'unavailable') }}"
        icon_template: "mdi:flash"

switch:
  - platform: template
    switches:
      smart_plug_switch:
        unique_id: smart_plug_switch
        value_template: "{{ state_attr('sensor.smart_plug', 'power') }}"
        availability_template: "{{ not is_state('sensor.smart_plug', 'unavailable') }}"
        turn_on:
          service: xiaomi_miio_raw.sensor_raw_command
          data:
            entity_id: sensor.smart_plug
            method: set_properties
            params:
              - did: power
                siid: 2
                piid: 1
                value: true
        turn_off:
          service: xiaomi_miio_raw.sensor_raw_command
          data:
            entity_id: sensor.smart_plug
            method: set_properties
            params:
              - did: power
                siid: 2
                piid: 1
                value: false
回复

使用道具 举报

0

主题

18

帖子

183

积分

注册会员

Rank: 2

积分
183
金钱
165
HASS币
0
发表于 2021-3-18 06:13:56 | 显示全部楼层
在 HACS 商店中,直接搜索添加“Xiaomi MIoT”
回复

使用道具 举报

9

主题

135

帖子

745

积分

高级会员

Rank: 4

积分
745
金钱
610
HASS币
0
发表于 2021-12-11 10:06:31 | 显示全部楼层
关注一下,最近买了几个这种插座,还挺好用
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-5-3 12:35 , Processed in 0.088315 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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