2024年11月24日星期日 上午12:56:24

定时重启集成 reload integration write an automation to reload/restart an integration

7 个月 前
#30852 引用
定时重启集成
https://bbs.iobroker.cn/t/topic/16783


write an automation to reload/restart an integration





Note
Some Integrations need a HA restart after a reload. So this will not work with any integration.
0
7 个月 前
#30853 引用
要重启的集成的entry id,也就是它在Home Assistant中的唯一标识符。有多种方法可以获取集成的entry id,比如:

你可以在Home Assistant的配置文件夹中找到.storage文件夹,并打开core.config_entries文件,然后查看JSON文件中的entry_id。




Go for the entry id. This can be found in

~/.storage/core.config_entries

This is a hidden file and you should read / print it. Do not write to it (you’ve been warned). Search for your integration and pick the “entry_id”. Keep in mind: this ID may change on remove and re-install of your integration.

e.g:

{
                "entry_id": "cdf9a0aabf56211a7ab3ad70ac9f32af0",
                "version": 1,
                "domain": "harmony",
                "title": "harmony-hub",
                "data": {
                    "name": "harmony-hub",
                    "host": "192.168.x.x1"
                },
0
7 个月 前
#30854 引用


automation:
  - alias: "定时重启集成"
    trigger:
      - platform: time_pattern
        minutes: "/5" # 每隔五分钟触发一次
    action:
      - service: homeassistant.reload_config_entry
        data:
          entry_id: "xxxx" # 你的第一个集成entry id
      - service: homeassistant.reload_config_entry
        data:
          entry_id: "yyyy" # 你的第二个集成entry id
      - service: homeassistant.reload_config_entry
        data:
          entry_id: "zzzz" # 你的第三个集成entry id

0