MyCool
(mike)
August 20, 2021, 3:01am
1
trying to add this to my Driveway automation as I get lots of false activation’s when raining,
I’m unsure where to add this any help is much appreciated.
**condition: template**
** value_template: "{{ not is_state('weather.home', 'rainy') }}"**
- alias: Driveway Linecrossing MP3
trigger:
platform: state
entity_id:
- binary_sensor.driveway_line_crossing
- binary_sensor.driveway_field_detection
to: 'on'
action:
- service: media_player.volume_set
data_template:
entity_id:
- media_player.home_group_2
volume_level: 1
- service: media_player.play_media
data_template:
entity_id: media_player.home_group_2
media_content_type: 'music'
media_content_id: >
{% if is_state("input_select.mp3_driveway_alarm_list", "Yoda-BLR-Hmm-Ha") %}
http://192.168.1.100:8123/local/Yoda-BLR-Hmm-Ha.mp3
{%-elif is_state("input_select.mp3_driveway_alarm_list", "PulpFictionRemix") %}
http://192.168.1.100:8123/local/PulpFictionRemix_1.mp3
{%-elif is_state("input_select.mp3_driveway_alarm_list", "MessageAlert") %}
http://192.168.1.100:8123/local/MessageAlert.mp3
{%-elif is_state("input_select.mp3_driveway_alarm_list", "carlpoppa2") %}
http://192.168.1.100:8123/local/carlpoppa2.mp3
{% else %}
http://192.168.1.100:8123/local/carlpoppa2.mp3
{% endif %}
tom_l
August 20, 2021, 3:32am
2
Like this
- alias: Driveway Linecrossing MP3
trigger:
platform: state
entity_id:
- binary_sensor.driveway_line_crossing
- binary_sensor.driveway_field_detection
to: 'on'
condition:
- condition: not
conditions:
- condition: state
entity_id: weather.home
state: rainy
1 Like
MyCool
(mike)
August 20, 2021, 3:58am
3
Hey thanks Mate so would i go something like this below Thanks again
- alias: Driveway Linecrossing MP3
trigger:
platform: state
entity_id:
- binary_sensor.driveway_line_crossing
- binary_sensor.driveway_field_detection
to: 'on'
condition:
- condition: not
conditions:
- condition: state
entity_id: weather.home
state: rainy
action:
- service: media_player.volume_set
data_template:
entity_id:
- media_player.home_group_2
volume_level: 1
- service: media_player.play_media
data_template:
entity_id: media_player.home_group_2
media_content_type: 'music'
media_content_id: >
{% if is_state("input_select.mp3_driveway_alarm_list", "Yoda-BLR-Hmm-Ha") %}
http://192.168.1.100:8123/local/Yoda-BLR-Hmm-Ha.mp3
{%-elif is_state("input_select.mp3_driveway_alarm_list", "PulpFictionRemix") %}
http://192.168.1.100:8123/local/PulpFictionRemix_1.mp3
{%-elif is_state("input_select.mp3_driveway_alarm_list", "MessageAlert") %}
http://192.168.1.100:8123/local/MessageAlert.mp3
{%-elif is_state("input_select.mp3_driveway_alarm_list", "carlpoppa2") %}
http://192.168.1.100:8123/local/carlpoppa2.mp3
{% else %}
http://192.168.1.100:8123/local/carlpoppa2.mp3
{% endif %}
MyCool
(mike)
August 20, 2021, 4:11am
4
i get this error below
2021-08-20 16:09:58 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: [condition] is an invalid option for [automation]. Check: automation->condition. (See /config/configuration.yaml, line 77)
tom_l
August 20, 2021, 4:12am
5
No. See how mine lines condition up with trigger?
Yours is indented too far.
MyCool
(mike)
August 20, 2021, 4:14am
6
yes just seen it thanks, OMG copy n past mistake again
MyCool
(mike)
August 20, 2021, 4:33am
7
funny even when i run with weather sate changed to rainy via development tools the automation still runs I guess ill keep playing hopefully i can get it to work
MyCool
(mike)
August 20, 2021, 4:36am
8
Yes lol reboot solved Thank you very much mate much appreciated final code bellow just in case it could help anyone
- alias: Driveway Linecrossing MP3
trigger:
platform: state
entity_id:
- binary_sensor.driveway_line_crossing
- binary_sensor.driveway_field_detection
to: 'on'
condition:
- condition: not
conditions:
- condition: state
entity_id: weather.home
state: rainy
action:
- service: media_player.volume_set
data_template:
entity_id:
- media_player.home_group_2
volume_level: 1
- service: media_player.play_media
data_template:
entity_id: media_player.home_group_2
media_content_type: 'music'
media_content_id: >
{% if is_state("input_select.mp3_driveway_alarm_list", "Yoda-BLR-Hmm-Ha") %}
http://192.168.1.100:8123/local/Yoda-BLR-Hmm-Ha.mp3
{%-elif is_state("input_select.mp3_driveway_alarm_list", "PulpFictionRemix") %}
http://192.168.1.100:8123/local/PulpFictionRemix_1.mp3
{%-elif is_state("input_select.mp3_driveway_alarm_list", "MessageAlert") %}
http://192.168.1.100:8123/local/MessageAlert.mp3
{%-elif is_state("input_select.mp3_driveway_alarm_list", "carlpoppa2") %}
http://192.168.1.100:8123/local/carlpoppa2.mp3
{% else %}
http://192.168.1.100:8123/local/carlpoppa2.mp3
{% endif %}
- service: camera.snapshot
data:
entity_id: camera.driveway
filename: /config/www/images/driveway.jpg
- delay:
seconds: 2
- service: homeassistant.turn_on
entity_id: script.driveway_notify_alarm