Automation not working/trigger right - CCU + Sonoff switch

Hi, first thanks for a great software!

I have installed HA on ubuntu 20.04, not as VM/OS.
Then debmatic CCU for Homematic IP radiator valves HmIP-eTRV-2.
My problem is that automation is not triggered right, i.e. it triggers sometimes.
I want to my automation turn on/off switch (heating pump) based on current temperature, but it doesn’t always.

  1. automation - pump off based on temperature
    trigger:
platform: numeric_state
entity_id: climate.elternzimmer
attribute: current_temperature
above: '22.0'
below: '30.0'

condition - heating only during night in bedroom:

condition: time
after: '18:00:00'
before: '09:00:00'
  1. action
service: switch.turn_off
data: {}
entity_id: switch.sonoff_10005b5bca_2
  1. automation - pump onbased on temperature
    trigger:
platform: numeric_state
entity_id: climate.elternzimmer
attribute: current_temperature
above: '15.0'
below: '22.0'

condition:

condition: time
after: '18:00:00'
before: '09:00:00'

action:

service: switch.turn_on
data: {}
entity_id: switch.sonoff_10005b5bca_2

Manually turn switch on/off works without problems. But after that automation is not fired at all.
Execute trigger manually also work. But even if trigger is false, is this ok? For example temp is over 22.0 and when i execute automation manually it turn on switch/pump.

I was watching this for days to thinking maybe i will see some logic but no success.

In log i can see that CCU values are updated ever minute:

2020-11-11 06:39:36 DEBUG (SyncWorker_30) [pyhomematic._hm] ServerThread.getAllSystemVariables: Getting all System variables via JSON-RPC
2020-11-11 06:39:36 DEBUG (SyncWorker_30) [pyhomematic._hm] RPCFunctions.jsonRpcPost: Method: Session.login
2020-11-11 06:39:36 DEBUG (SyncWorker_30) [pyhomematic._hm] RPCFunctions.jsonRpcPost: API-Endpoint: http://192.168.178.39:80/api/homematic.cgi
2020-11-11 06:39:36 DEBUG (SyncWorker_30) [pyhomematic._hm] RPCFunctions.jsonRpcPost: Method: SysVar.getAll
2020-11-11 06:39:36 DEBUG (SyncWorker_30) [pyhomematic._hm] RPCFunctions.jsonRpcPost: API-Endpoint: http://192.168.178.39:80/api/homematic.cgi
2020-11-11 06:39:36 DEBUG (SyncWorker_30) [pyhomematic._hm] RPCFunctions.jsonRpcPost: Method: Session.logout
2020-11-11 06:39:36 DEBUG (SyncWorker_30) [pyhomematic._hm] RPCFunctions.jsonRpcPost: API-Endpoint: http://192.168.178.39:80/api/homematic.cgi

Thanks for help.

numeric_state triggers only happen when the above or below threshold is crossed.

so, in your “off” automation it will only trigger when the temperature goes below 22 then back to above 22 or it goes above 30 then back to below 30. And it will be the same with the other automation.

using an “above” and “below” number in a single automation doesn’t make sense to me if you are trying to control the temperature of something by controlling a switch.

And next your condition isn’t correct.

there is never a time it will be after 1800 and before 0900 at the same time. All times are in reference to midnight. So what you are saying there is that the time has to be between 1800 and midnight AND between midnight and 0900 at the same time.

you need to split that condition into two ‘or’ conditions:

condition: or
  conditions:
    - condition: time
      after: '18:00:00'
    - condition: time
      before: '09:00:00'

When you execute an automation manually all of the triggers and conditions are ignored.

That explain all. Thank you very much. Do you have some soloution for me?

I’m not sure what you are asking.

I gave you a direct solution for the second part and gave you guidance on the first part.

remove the “above:” or “below:” section for the appropriate trigger.

Have you considered using the Generic Thermostat integration?