Automation and swimming pool

Hi,

I’m an openhab user who wants to migrate to home assistant. I succeed to migrate most of my devices and add some automation rules.

Unfortunatly one of the last is hard to realize.

Here is the data I need as input:

  • temperature: for example: 24 °c
  • start time = for example 8h00
  • stop time = (température /2 +start time)

I need to automate this as my pump is on a 8h00.

What can I use to setup a stop time and eventually update stop time if temperature raise in the afternoon.

I see template but I’m to new to home assistant to know what to do.

Someone got One idea, please.

1 Like

I see this as 3 automations, and one sensor.
Automation 1 triggers on time (8h00) turns on the heater, and sets the initial stop time and stores it in the sensor
Automation 2 is triggered on temperature changes, and updates the stop time sensor
Automation 3 is triggered on time >= stop_time and turns off the heater.

2 Likes

Hi Treno,

First, thank you for your help !

Yeah I agree about the 3 automations and sensor.

Here is what I create:

- alias: "Start pump"
  trigger:
    platform: time
    # When 'after' is used, you cannot also match on hour, minute, seconds.
    # Military time format.
    after: '08:00:00'
  action:
    - service: notify.haxmpp
      data:
        message: "Start pump"

But how to store in a sensor, I must do a template sensor ?

Edit:

From my knowledge, The difficulty is to convert decimal format to hours:minutes.

There is an easy way allready available in home assistant.

I succeed to divide my temperature by 2 and add my start time in template zone in HA but I have to convert that to send a readable time.

But before that I really need to know how to store to a sensor a time value. Can you help me by an example ?

Thanks.

Edit2:

I think I have to play with value_template ?

There are a couple of ways to store dates to sensors. They are both pretty complex.
The first way is to do an API call to save your value.

You can do the API call from a shell command.

I chose to do this in with a bash script and a command line sensor.
You can see my post about how I did it here:

regarding date_time conversions and math. Here’s a template that will help you understand. Just paste this into the template editor to see how dates and times are edited.

#datetime
{{now()}}
#timestamp
{{as_timestamp(now())}}
add 1 hour (3600 seconds)
{{as_timestamp(now())+ (1*60*60)}}
display as local time
{{(as_timestamp(now())+ (1*60*60))  | timestamp_local}}
display just the hour
{{(as_timestamp(now())+ (1*60*60))  | timestamp_custom("%H",true)}}

Hi Treno,

Thank you for all your informations, I will try template editor and probably a command line sensor.

I tell you if ok.

Thank you again.

Re hi , :grinning:

Really bigggggggggggg thanks !!!

With your example and small reflexion: Here is my template directly without any shell !

{{ (((states.sensor.temperature_piscine.state  | multiply (0.5))-  (states.sensor.temperature_piscine.state  | multiply (0.5)) |round |int)*3600|round|int)+((states.sensor.temperature_piscine.state  | multiply (0.5)| round|int)*3600)+8*3600}}

The 8+3600 is that I begin at 8h00 but I will add later the right hour.

The time is in seconds so I can convert and do what, Ho yes I will migrate soon to HA.

:sunglasses:

1 Like

Hi Sellig, I’m making a Hot Tub project to my new home and don’t know anything about hardware for it.
What controller are you using/know to integrate Pump, Temp and Water level?
Thanks.