Getting close. So the notice triggered this time but errored. Got:
2019-12-14 19:15:05 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.dryer_send_alert_when_dryer_is_finished. Invalid data for call_service at pos 1: Service notify.ios_johniosapp
notify.ios_sueiosapp does not match format <domain>.<name>
Below are the conditions and actions for notifying when done:
condition:
condition: and
conditions:
- condition: time
before: '22:30:00'
after: '06:30:00'
- condition: state
entity_id: group.everyone
state: 'home'
- condition: state
entity_id: input_select.dryer_status
state: Dry
- condition: template
value_template: >
{% if states.automation.dryer_send_alert_when_dryer_is_finished.last_triggered is not none %}
{% if as_timestamp(now()) | int - as_timestamp(states.automation.dryer_send_alert_when_dryer_is_finished.attributes.last_triggered) | int > 1800 %} true {% else %} false
{% endif %}
{% else %}
false
{% endif %}
action:
- service_template: >
{% if (is_state('device_tracker.john_s_iphone_unifi', 'home')) and (is_state('device_tracker.sue_s_iphone_unifi', 'home')) %}
notify.ios_johniosapp
notify.ios_sueiosapp
{% elif is_state('device_tracker.john_s_iphone_unifi', 'home') %}
notify.ios_johniosapp
{% elif is_state('device_tracker.sue_s_iphone_unifi', 'home') %}
notify.ios_sueiosapp
{% endif %}
data:
message: 'The dryer has finished and is ready to be emptied'
title: 'Dryer'
- service: input_select.select_option
data:
entity_id: input_select.dryer_status
option: Idle
Think I might have figured out part of it. Since updating to the 2.0 version of iOS app, the notify statements are different now. I fixed those but now getting nothing. May be due to my value_template not sending more than once in 30 minutes.
That said, if I manually trigger the action above, nothing happens even with the fixed notify statements and the status doesn’t change to Idle.
No, still getting the same error when it tries to send: does not match format .
because the config checker doesn’t validate any logic inside of a template because it could be anything that the user thinks will work.
Then when the code runs the system will find that you put two services in the same service call and that’s when it will give you an error.
you can test it by removing the template and leaving the the two services under the call and it will then give an error on the config check.
Like this:
action:
- service:
notify.ios_johniosapp
notify.ios_sueiosapp
data:
message: 'The dryer has finished and is ready to be emptied'
title: 'Dryer'
- service: input_select.select_option
data:
entity_id: input_select.dryer_status
option: Idle
Thanks for the info. What is the right way to create a “service” group? I keep all my groups in a separate groups.yaml but questioning if I can’t do this and have to put it somewhere else and format it differently? Saw things like this:
So I’ve pointed my notify content in configuration.yaml to:
notify: !include entities/notify.yaml
In notify.yaml I did:
- platform: group
name: John and Sue
services:
- service: mobile_app_jiphone
- service: mobile_app_siphone
and in my automation.yaml the action is doing:
action:
- service_template: >
{% if (is_state('device_tracker.john_s_iphone_unifi', 'home')) and (is_state('device_tracker.sue_s_iphone_unifi', 'home')) %}
notify.john_and_sue
{% elif is_state('device_tracker.john_s_iphone_unifi', 'home') %}
notify.mobile_app_jiphone
{% elif is_state('device_tracker.sue_s_iphone_unifi', 'home') %}
notify.mobile_app_siphone
{% endif %}
data:
message: 'The dryer has finished and is ready to be emptied'
title: 'Dryer'
- service: input_select.select_option
data:
entity_id: input_select.dryer_status
option: Idle
Still erroring. The individual ones work if like I’m not home Sue gets alerts but when both home it doesn’t seem to work. I have a bunch of these in the logs:
I used to get those errors all the time too just recently but I could never narrow it down to where they were coming from. Then they just stopped coming in.
But if there are no errors then that means its happy with the template portion syntax. Now you just have to figure out why there is no notification.
Try to send a notification using the services page and using that notification group to see if that will work. Then move on from there depending on what you find out from that test.