用esp32做的一个espresens传感器,显示手机位于哪个房间,想配置成device_tracker。问了chatgpt,然后再综合自己的传感器,写出如下的代码,但是加载不成功,不能重启ha。请问各位大佬,这个还能配置吗,具体怎么写。显示:重新启动 Home Assistant 失败
The system cannot restart because the configuration is not valid: Platform error device_tracker.template - No module named 'homeassistant.components.template.device_tracker'
代码
device_tracker:
- platform: template
devices:
chaodeiphone15:
friendly_name: "Chaode iPhone 15"
value_template: >-
{% if is_state('sensor.chaodeiphone15', 'livingroom') or
is_state('sensor.chaodeiphone15', 'masterbedroom') or
is_state('sensor.chaodeiphone15', 'secondbedroom') %}
home
{% elif is_state('sensor.chaodeiphone15', 'not_home') %}
not_home
{% else %}
unknown
{% endif %}
wendeiphone15pro:
friendly_name: "Wende iPhone 15 Pro"
value_template: >-
{% if is_state('sensor.wendeiphone15pro', 'livingroom') or
is_state('sensor.wendeiphone15pro', 'masterbedroom') or
is_state('sensor.wendeiphone15pro', 'secondbedroom') %}
home
{% elif is_state('sensor.wendeiphone15pro', 'not_home') %}
not_home
{% else %}
unknown
{% endif %}