Hi,
Having another hair-pulling moment… I’ve added a second movement binary sensor to my binary_sensors.yaml include and I’m getting the following error:
2018-12-09 00:36:36 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 343, in _async_add_entity
raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: binary_sensor.movement
I’m running hass on a R Pi 3B+, version 83.3.
Relevant part of configuration.yaml:
##########################################################
# Includes
##########################################################
automation: !include includes/automations.yaml
device_tracker: !include includes/device_tracker.yaml
group: !include includes/groups.yaml
media_player: !include includes/mediaPlayers.yaml
script: !include includes/scripts.yaml
sensor: !include includes/sensors.yaml
switch: !include includes/switches.yaml
zone: !include includes/zones.yaml
binary_sensor: !include includes/binary_sensors.yaml
binary_sensors.yaml:
# Binary sensors
# Hank Motion Sensor Stairs
- platform: template
sensors:
movement:
friendly_name: "Motion on Stairs"
device_class: motion
value_template: "{{ is_state('sensor.hank_unknown_type0300_id0012_burglar_2', '8') }}"
# Hank Motion Living Room
- platform: template
sensors:
movement:
friendly_name: "Motion in Living Room"
device_class: motion
value_template: "{{ is_state('sensor.hank_unknown_type0300_id0012_burglar_3', '8')
or is_state('sensor.hank_unknown_type0300_id0012_burglar_4', '8') }}"
# Workday sensor
- platform: workday
country: SE
I’m surely missing something obvious but it’s late so I’m begging for help. Anyone?
Thanks in advance!
Ed
Solved it!
Realised i didn’t declare a unique name for the different sensors! I had defined the first sensor as ‘movement’ - a really ambiguous name looking back on it… Anyway this is the corrected binary_sensors.yaml if anyone is as stupid as me:
# Binary sensors
# Hank Motion Sensor Stairs
- platform: template
sensors:
motion_stairs:
friendly_name: "Motion on Stairs"
device_class: motion
value_template: "{{ is_state('sensor.hank_unknown_type0300_id0012_burglar_2', '8') }}"
# Hank Motion Living Room
- platform: template
sensors:
motion_livingroom:
friendly_name: "Motion in Living Room"
device_class: motion
value_template: "{{ is_state('sensor.hank_unknown_type0300_id0012_burglar_3', '8')
or is_state('sensor.hank_unknown_type0300_id0012_burglar_4', '8') }}"
# Workday sensor
- platform: workday
country: SE
123
(Taras)
December 9, 2018, 2:11am
3
Technically speaking, what you created there are template_sensors .
You can list all template_sensors under the same heading like this:
# Hank Motion Sensors
- platform: template
sensors:
motion_stairs:
friendly_name: "Motion on Stairs"
device_class: motion
value_template: "{{ is_state('sensor.hank_unknown_type0300_id0012_burglar_2', '8') }}"
motion_livingroom:
friendly_name: "Motion in Living Room"
device_class: motion
value_template: "{{ is_state('sensor.hank_unknown_type0300_id0012_burglar_3', '8') or is_state('sensor.hank_unknown_type0300_id0012_burglar_4', '8') }}"
As of version 0.81 you should list the entity_id of sensors within the template.
# Hank Motion Sensors
- platform: template
sensors:
motion_stairs:
friendly_name: "Motion on Stairs"
device_class: motion
entity_id:
- sensor.hank_unknown_type0300_id0012_burglar_2
value_template: "{{ is_state('sensor.hank_unknown_type0300_id0012_burglar_2', '8') }}"
motion_livingroom:
friendly_name: "Motion in Living Room"
device_class: motion
entity_id:
- sensor.hank_unknown_type0300_id0012_burglar_3
- sensor.hank_unknown_type0300_id0012_burglar_4
value_template: "{{ is_state('sensor.hank_unknown_type0300_id0012_burglar_3', '8') or is_state('sensor.hank_unknown_type0300_id0012_burglar_4', '8') }}"
1 Like
Thanks for the constructive feedback!