I’m using this condition in an automation to notify me if a new version is available:
i’m using a value_template to notify me if there is a new version available - is there any way I can set it so that it won’t notify me if the available version contains beta?
so == means equal
!= means not equal
Is there a code for does not contain?
that’s my current so i’d like to add a condition to ignore it if it contains beta as well
I’m sub’d to beta but rolled back due to xiaomi issues and I keep getting notifications every 5 mins. I know I could unsub to beta…
{{ states.sensor.hass_current_version.state != states.sensor.hass_installed_version.state and states.sensor.hass_current_version.state != "unavailable" and not "beta" in states.sensor.hass_current_version.state != true }}
In the template checker this comes up as False and if I change and not to and it is true
This may work. It depends on what hass_current_version.state returns. I’m guessing a string.
With that in mind, the only typo i see is that you don’t have quotes around beta. Also, you can simplify the last and check and reorganize the order. Reorganizing the order will save time make it so checks are done in the appropriate order:
"{{ states.sensor.hass_current_version.state != 'unavailable' and 'beta' not in states.sensor.hass_current_version.state and states.sensor.hass_current_version.state != states.sensor.hass_installed_version.state }}"
the order is done like this because if its ‘unavailable’, it will return false without evaluating the other and statements.
I was looking for the same logic as your condition.
I can’t find the sensor sensor.hass_current_version and sensor.hass_installed_version in my Hassio- instalation.
Any idea if Hassio has some similar sensor hidden in the system?
- platform: version
name: HA Current Version
- platform: rest
resource: https://pypi.python.org/pypi/homeassistant/json
name: HA upstream
value_template: '{{ value_json.info.version }}'
scan_interval: 14400
The automation:
trigger:
platform: state
entity_id: sensor.ha_upstream
condition:
condition: template
value_template: "{{ states.sensor.ha_current_version.state != states.sensor.ha_upstream.state and
states.sensor.ha_current_version.state != 'unavailable' and
'b' in states.sensor.sensor.ha_upstream != true }}"