Chlorine Automation Problem

Hey Guys,

i have a problem with a automation.

I want to start a device if a state of a mqtt entity device is to low. But it doesnt works. My Device ignore the state.

It is a chlorine pump for my Pool. I want to start this if the poolpump is working and the ORP stage (chlorine) is under 650.

If i make a test it works, but i think the attribute „state“ ist wrong, because the automation doesn‘t work, if the mqtt state is under 650

alias: Automatisch Chlor
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.garten_orp
    attribute: states
    below: '650'
condition:
  - condition: device
    type: is_off
    device_id: 48a7487xxxxxxxx
    entity_id: switch.nicht_vergeben_pooltechnik
    domain: switch
    for:
      hours: 1
      minutes: 0
      seconds: 0
  - condition: device
    type: is_on
    device_id: 1c78ab5b128xxxxxxxx
    entity_id: switch.poolpumpe
    domain: switch
action:
  - type: turn_on
    device_id: 48a7487xxxxxxxxx
    entity_id: switch.nicht_vergeben_pooltechnik
    domain: switch
  - delay:
      hours: 0
      minutes: 1
      seconds: 30
      milliseconds: 0
  - type: turn_off
    device_id: 48a7xxxxxxxxxx
    entity_id: switch.nicht_vergeben_pooltechnik
    domain: switch
mode: single

If i make a test it works, but i think the attribute „state“ ist wrong.

i hope someone could help me

Remove this line:

    attribute: states

so that the State Trigger looks like this:

trigger:
  - platform: numeric_state
    entity_id: sensor.garten_orp
    below: '650'

It will trigger when the value of sensor.garten_orp decreases from above 650 to below 650.

If the sensor’s value is already below 650, the Numeric State Trigger will not trigger. It only triggers at the moment the value crosses the threshold of 650.

Thx! I will try it.

Mh at this moment ist doesnt work.

I delete the line like your tipp. But today the automation doesn’t start.

Please show us the state and attributes of this entity. From the states panel in dev tools.

Bugger that was supposed to be a reply to @Pokulemon not @123

You mean this?

From the screenshot you posted, the sensor’s value is 634.0. When was the value higher than 650.0?

As explained earlier, a Numeric State Trigger will trigger only at the moment the value decreases from above the threshold of 650 to below 650. It triggers only when it crosses the threshold. As the value continues to decrease below 650, it doesn’t continue to trigger the automation.

Ok thx. I make it today over 670. but the automation doesnt work. Could it be the wrong state attribute?

I have make two other automations. They turn a device off after 2 hours. This two doesnt work too. Could it be my HASS ha some issue?

What is a ‘state attribute’?

Has it gone from over 650 to under 650? Merely getting it 670 is no use if it never goes downwards thru the transition.

At the automation screen i can choice some „forms“ states. Here a snapshot.

@nickrout Yeah yesterday and today.

According to the first screenshot you posted, the sensor’s state value is 634.0. The state value is not an attribute, it’s the entity’s de facto value.

See: State Object.

Your automation has two conditions and the first one can produce a result you may not have considered. Here’s what I mean:

  1. Let’s say the sensor’s value is 670.
  2. The pool pump has been operating for 50 minutes.
  3. The sensor’s value decreases to 648.
  4. The Numeric State Trigger triggers because the sensor’s value has decreased and crossed the threshold of 650.
  5. The first condition requires that the pump has been on for at least 1 hour.
  6. The first condition isn’t fulfilled because the pump has only been on for only 50 minutes.
  7. The action is not executed.
  8. Nothing will happen when the pump runs for more than 1 hour because the Numeric State Trigger has already triggered. It won’t trigger again until the sensor’s value first increases above 650 then decreases below 650.

You should examine the automation’s latest trace to get a better understanding of how it’s actually behaving.

Thx for the tipps.

I test this tomorrow with my Chlorine automation.

But i have a secon question. My poolpump automation doesn‘t work too.

After 8 hours the poolpump doesn‘t turn off. Why?

alias: 'Poolpumpe '
description: ''
trigger:
  - platform: time
    at: '09:00:00'
condition: []
action:
  - type: turn_on
    device_id: Xxxxxxxxx
    entity_id: switch.poolpumpe
    domain: switch
  - delay:
      hours: 8
      minutes: 0
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: Xxxxx
    entity_id: switch.poolpumpe
    domain: switch
mode: single

A lot can happen in 8 hours. Do you restart HA during this time?

Have you tried 2 automation, one to turn on, one to turn off?

Whenever you restart Home Assistant or execute Reload Automations, it terminates and restarts any automations that are in progress.

For example, imagine your automation is counting down its 8-hour delay and then you restart or reload. The delay will be cancelled, the remaining action won’t be executed, and the entire automation is restarted (it’s back to the point of waiting to be triggered).

When you use the Automation Editor to create or modify an automation, the moment you click its Save button it automatically executes Reload Automations. So if you edit and save any automation while the 8-hour delay is busy, the countdown is terminated (and it fails to turn off the pump).

Hey Guys!

Thx to all for you and your patience.

Today i have no time to control and „work“ with my automations.

And everything works perfect! I think my problem was, that I have edited them again and again.

Now everythings works great and i can enjoy my pool :slight_smile: