ScottS
November 10, 2023, 11:41pm
1
I’m using the below as condition in Scripts. This worked up until I believe last update. After entering 0 now, the script doesn’t ask to be saved, therefor, the field is not allowing this. Why?
What I’ve decided to use temporarily, is a Not Below 1 Condition.
condition: numeric_state
entity_id: zone.home
above: 0
enabled: true
In place of, I’ve tried adding the below value template in Template Condition, but it does not work. Thoughts on this?
value_template: {{ states.person | selectattr('state', 'eq', 'home') | list | count > 0 }}
My template:
# Home Occupancy
- trigger:
- platform: state
entity_id: zone.home
not_to:
- unknown
- unavailable
- platform: event
event_type: custom_home_occupancy
binary_sensor:
- name: "Home Occupied"
state: >
{% if trigger.platform == 'event' %}
{{ trigger.event.data.state }}
{% else %}
{{ trigger.to_state.state | int | bool }}
{% endif %}
zone.home State Attributes:
latitude: 3
longitude: -9
radius: 100
passive: false
persons:
- person.jen
- person.scott
editable: true
icon: mdi:home
friendly_name: Home
123
(Taras)
November 11, 2023, 12:47am
2
Please post the script that contains the failing Numeric State Condition.
ScottS
November 11, 2023, 2:54pm
3
Script:
What’s weird, is it shows the ‘0’ in YAML code, but visually it’s not there AND the script doesn’t work.
alias: Living Room - Set Scene (Duplicate)
sequence:
- condition: numeric_state
entity_id: zone.home
above: 0
- condition: state
entity_id: binary_sensor.sleep_state
state: "off"
- choose:
- alias: If it's a holiday
conditions:
- not:
- condition: state
entity_id: sensor.holiday_light_color
state: white
sequence:
- service: light.turn_on
data:
brightness_pct: 100
color_name: "{{ states('sensor.holiday_light_color') }}"
target:
device_id: 61ce75c8c194fc5bf517be3cc7e0a6aa
- conditions:
- condition: sun
after: sunset
sequence:
- service: scene.turn_on
target:
entity_id: scene.living_room_night
metadata: {}
- conditions:
- condition: sun
after: sunrise
sequence:
- service: scene.turn_on
target:
entity_id: scene.living_room_day
metadata: {}
default:
- service: light.turn_on
data:
brightness_pct: 50
target:
device_id: 61ce75c8c194fc5bf517be3cc7e0a6aa
alias: Determine Day or Night
mode: single
ScottS
November 12, 2023, 1:16pm
4
I rebooted server again today, changed the Condition back to Above 0. Although the ‘0’ still does not appear visually, the script works as it should. Not sure what the issue was, but none of the scripts I am using this Condition in was working.