Dryer code not triggering

I have a Zooz Zen15 power strip connected to my washer and dryer. Setup some code for it. Right now I have for example in my automations file:

- id: set_dryer_active
  alias: "[Dryer] Set dryer active when power detected"
  trigger:
    - platform: numeric_state
      entity_id: sensor.dryer_power
      above: 10
  condition:
    condition: or
    conditions:
      - condition: state
        entity_id: sensor.dryer_status
        state: Idle
      - condition: state
        entity_id: sensor.dryer_status
        state: Running
  action:
    - service: input_select.select_option
      data:
        entity_id: input_select.dryer_status
        option: Running

For the input select I have:

dryer_status:
  name: Dryer Status
  options:
    - Idle
    - Running
    - Dry
  initial: Idle

I just kicked on the dryer and the status still shows Idle. Any ideas?

image

By the way, this is in the logs, I think it’s related:

2019-12-14 11:04:48 WARNING (MainThread) [asyncio] socket.send() raised exception.

Try input_select.dryer_status instead of sensor.dryer_status

I’m trying to figure out the need for those conditions at all. I’m not seeing it.

Thanks. I totally forgot to create my sensor for the dryer status for the dryer. Did it for the washer but not the dryer.

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 .

you can’t use two services in a single service call.

So your first if statement in the action isn’t valid because its calling two notify services.

OK. Before I change this, may be a dumb question, but why does this validate as “OK” thru HA? Is that check just checking indents or something?

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:

- platform: group
  name: all_devices
  services:
    - service: notify.ios_johniosapp
    - service: notify.ios_sueiosapp

The above won’t validate in groups.yaml or removing the platform won’t as well.

you may have seen something similar to that in the docs but your implementation of it is wrong.

here is the docs section I’m referring to:

I’ve never used it but it looks like it needs to go in the “notify:” section of your config.

Then you can call the service on the notify group with the desired message as in the example at the bottom of that same page.

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:

2019-12-16 06:21:43 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-12-16 06:21:43 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-12-16 06:21:43 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-12-16 06:21:43 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-12-16 06:21:43 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-12-16 06:46:31 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140022536160336] Client exceeded max pending messages [2]: 512
2019-12-16 06:46:31 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140022536160336] Client exceeded max pending messages [2]: 512
2019-12-16 06:46:31 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140022536160336] Client exceeded max pending messages [2]: 512
2019-12-16 06:46:31 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140022536160336] Client exceeded max pending messages [2]: 512
2019-12-16 06:46:31 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140022536160336] Client exceeded max pending messages [2]: 512

What’s the error?

the errors you are listing don’t have anything to do with the notification template (I don’t think…).

One thought was perhaps there are to many updates and it’s flooding HA.

possibly but I kind of doubt it.

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.