I am trying to insert a effective ‘not’ into a value template ‘if and’ test.
I want to test that a state is not a specific value within the below code
trigger:
platform: template
value_template: >
"{% if
(is_state('device_tracker.cory','not_home')) and
(is_state('device_tracker.corypixel','not_home')) and
(is_state('device_tracker.pixel','not_home'))
%}true{% endif %}"
I want to add to this a test that the state of a sensor is not a specific value. Sort or like below.
trigger:
platform: template
value_template: >
"{% if
(is_state('device_tracker.me','not_home')) and
(is_state('device_tracker.mypixel','not_home')) and
(is_state('device_tracker.mybtpixel','not_home')) and
(is_not_state('device_tracker.mymqttpixel','home'))
%}true{% endif %}"
The mqtt (owntracks) tracker will have extra states other than ‘not_home’ according to actual location, like ‘work’. So I want to just trigger when it is in a state that is not ‘home’.
Is there a way to do this withing the existing value_template test?