野生程序员
发布于 2023-09-17 / 405 阅读 / 0 评论 / 0 点赞

homeassist MQTT Discovery设备自发现

教程

homeassist MQTT Discovery设备自发现_hass mqtt_欧阳睿的博客-CSDN博客

mqtt自动发现设备

人体存在设备

添加设备

topic

homeassistant/binary_sensor/garden/config

内容

{
    "name":"garden",
    "device_class":"motion",
    "state_topic":"homeassistant/binary_sensor/garden/state",
    "unique_id":"motion01ad",
    "device":{
        "identifiers":[
            "01ad"
        ],
        "name":"Garden"
    }
}

设置设备状态

主题topic

homeassistant/binary_sensor/garden/state

内容

ON

或者

OFF

删除设备

主题 topic

homeassistant/binary_sensor/garden/config

内容

{}

开关设备

添加设备

主题

homeassistant/switch/smarthome/config

内容

{
    "device": {
        "identifiers": "mytest-sw",
        "manufacturer": "HA HA",
        "model": "MY vir-sw",
        "name": "MY vir-sw"
    },
    "name": "test_switch",
    "command_topic": "homeassistant/switch/smarthome/set",
    "state_topic": "homeassistant/switch/smarthome/state",
    "payload_on": 1,
    "payload_off": 0,
    "state_on": 1,
    "state_off": 0,
    "unique_id": "motion01ad1"
}

设置设备状态

主题

homeassistant/switch/smarthome/state

内容

1

0

删除设备

主题

homeassistant/switch/smarthome/config

内容

{}


评论