Hello,
I’m trying to setup a series of simple entities that reflect the direction/vector across any two motion sensors, and from there build some clever automations that watch those entities.
I have a template with two test sensors working, but I can’t seem to get the “unique_id” property to reflect in HA’s interface.
The below just gives me an entity named “sensor.test_a”:
- unique_id: asdf
- sensor:
name: a_to_b
state: >
{{ is_state("binary_sensor.roomA_sensor_motion", "on") and
is_state("binary_sensor.roomB_sensor_motion", "on") }}
I’ve also tried this (to no avail):
- sensor:
unique_id: asdf
name: a_to_b
state: >
{{ is_state("binary_sensor.roomA_sensor_motion", "on") and
is_state("binary_sensor.roomB_sensor_motion", "on") }}
Any help would be appreciated.
1 Like
nm, somehow I got it working. For future reference:
i removed the ‘name’ field and just left ‘unique_id’ in place that half-worked
then i replaced the name field (above unique_id this time, not sure it matters), and now it shows up correctly
Could be that the entity had to be created first, and then renamed in the template?
francisp
(Francis)
December 25, 2021, 4:43am
3
You can create an unique_id immediately:
- name: "House electricity energy"
unique_id: '0a7476cc-d6c1-40ba-8ae1-606518c3497f'
unit_of_measurement: 'kWh'
state: >
{{ ((states("sensor.mains_consumed_energy") | float(0)) + (states("sensor.upstairs_consumed_energy") | float(0)) + (states("sensor.extra_consumed_energy") | float(0)) )| round(2) }}
availability: >
{{ not 'unavailable' in
[ states('sensor.mains_consumed_energy'),
states('sensor.upstairs_consumed_energy'),
states('sensor.extra_consumed_energy') ] }}
device_class: energy
state_class: total_increasing
4 Likes