First automation with sonoff S60ZBTPF to make simple Miele dryer able to send notification after finish - simply not working as intended

Dear All,

I am having some trouble to create a simple automation which sends a notification to my phone when the waschingmachine is finished.

I read the following posts:

and

From the official post and from the community forum I also decided to create a helper to support the automation. Everything is looping around the Watt / Power part of the Sonoff smart plug.

Here is the code from HA:

alias: Dryer
description: some description here?
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.dryer_helper
    from:
      - "off"
    to:
      - "on"
conditions:
  - condition: numeric_state
    entity_id: sensor.miele_dryer_power
    below: 2
actions:
  - action: notify.mobile_app_bob_iphone
    metadata: {}
    data:
      message: DRYER READY
mode: single

I used entity to make code simpler and understandable as well. In short here is what is happening:

binary_sensor.dryer_helper is a treshlod helper with an only upper limit of 300 Watts. Currently the dryer is not running so the helper is OFF, when the dryer reaches a running state it turns to ON and this should “fire” the automation.
The condition which should be checked is also easy, as soon as the dryer sonoff smart plug sensor reaches a below 2 Watt value, send me a notification to my phone.

The helper works, i tested that, but the automation somehow not, as I do not get the notification.

I tried to debug it somehow to run it manually (that’s why i added the post above) because it drove me crazy that even that the helper was OFF state not changed, the full automation ran :smiley: now i know that it is “normal”.

For me what is also interesting (and i hope i understand correctly) the trigger which fires / starts the automation as first step, but after that is done (even if the helper turns later off on off on 1000 times) the automation MUST BE in running state and now waiting for the condition to be met. In this case I should see it somewhere that it is running in HA and waiting for next step. However I cannot see this anywhere. I really do not know that the trigger or the condition is wrong now :frowning:

I have a power diagram about the dryer behaviour. It starts from 0W runs up to 900W, keeps it, then there is a 192W cooling time, then back to 0W. There are no jumps it is solid. Unlike a washing machine where the Watt jumps up and down based on if the drum rotates or water is heated etc…

So i am stuck here and I have no clue how to debug further.

Any help or tips would be highly appreciated.

Thank you!

it’s not working like that - when trigger is active, automation is started, it checks all conditions and if there are none met - automation is finished and it’s waiting for another trigger.

so now, when your automation is triggered [dryer on], it checks conditions - power is over 2 as it is working, and so the automation finishes without other actions.

quick and dirty idea:

instead of binary_sensor helper, create input_boolean that would be turned on when dryer is working [maybe create additional automation, that turns on the boolean when power threshold is met]

trigger main automation on power change. you don’t have to be specific, just trigger: state, entity_id: and that’s all.
condition for this automation would be:
dryer_power below 2
AND
input_boolean state on

then:
turn off dryer
set input_boolean to off

that way dryer would be turned off only if it was working earlier; and “working” state won’t be turned off accidentaly [I guess that your binary_sensor “turns off” when power is too low, and that’s additional obstacle]

This is what I do for my washing machine, which uses a threshold sensor to decide if the machine is off or on.
Then all I do is have an automation that says if the threshold sensor is below the threshold for 2 mins then send notification

description: Notifies mobile when washing load finished
triggers:
  - entity_id:
      - binary_sensor.washing_machine_on
    from: "on"
    to: "off"
    for:
      hours: 0
      minutes: 2
      seconds: 0
    trigger: state
conditions: []
actions:
  - alias: Send notification and update washing counter
    parallel:
      - action: notify.mobile_app_db
        metadata: {}
        data:
          message: Washing machine is done
          data:
            tag: washing_machine
      - action: counter.increment
        metadata: {}
        data: {}
        target:
          entity_id: counter.washing_load_counter
mode: single```
1 Like

Thank you for that !
Do you have a hint for future debuging to see what is running and what is not? (other than developer tool / states)

However since you wrote that automation is actually RUNS THROUGH, there is not much to debug… so might be a stupid question from my side :slight_smile: I think I am looking for something like in VBA where I can go line by line, but maybe here there is no such thing.

I noted your solution as well in the other reply :slight_smile:

Again thanks for your answer !

Hi bugwan,

thank you for your tip. I took the code and right now I am testing this. Let’s see :slight_smile:

Hi sender,

i am aware of this solution, the reason why I do not wanted to do this:

  1. i wanted to understand how automation works so i can also build my own if there is no blueprint, and from pejotigrek answer i see i made a big mistake as a start assuming the automation waits for the condition to be met :slight_smile:
  2. i like that solution, and it could well be that i switch over to that later, but then I need to learn how to install blueprints etc :smiley: :smiley: so far i wanted to do some low level easy stuff before I run a full blown code.

in other words: learing to drive on a 15 years old suzuki, before i buy and sit into my bently :smiley: :smiley: :smiley: basics first before the advance awesome stuff

for automations check /config/automation and traces [in menu with three dots next to the automation] - you can see step by step what’s going on with the automations/scripts, what conditions are met etc.

What I do. Using line current sensors…
Automation: Home-Assistant-Config/automation2/Basement_A2.yaml at bc549269b4e0643924b4eb727ddcc4465b3a8bf9 · SirGoodenough/Home-Assistant-Config · GitHub

Templates: Home-Assistant-Config/templates/binary_sensor/machine_tmpl.yaml at bc549269b4e0643924b4eb727ddcc4465b3a8bf9 · SirGoodenough/Home-Assistant-Config · GitHub

Hi,

thanks for that library, i am going to check those scripts. I already did for a few and this is also looks like advance stuff :slight_smile:

Now my script is working (i took the advice from @bugwan ) just modified the Watt helper and the time delay as my washers are a bit different. What surprised me that I also got notification when I am NOT AT HOME. I thought because of this HTTPS and new update stuff (i cannot connect for example to my home assistant anymore if i am not at home…) the notifications also won’t work outside of the “choosen” wifi, but it works :slight_smile: so i am happy.

Next step to create a Siri announcement, next to the notification. I know that there is a way to do text-to-speach with Siri, I have a tiny homepod, which is connected to HA as well. So I am tweaking my code now to that direction :slight_smile:
If any of you already achived this, and if you can copy that part of the code here, that would be awesome !

Thank you !