Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


peejayw

1913 posts

Uber Geek
+1 received by user: 123


#295823 26-Apr-2022 17:11
Send private message

I have a simple automation that I want to run during two time periods in the day, 5-7am and again at 5-9pm. I though maybe I could use the condition type of OR but that isnt working. The only other way I can think of is to use two automations, one for each time period but that seems very clunky, is there a better way? Thanks.





 I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.


Create new topic
eonsim
403 posts

Ultimate Geek
+1 received by user: 192

Trusted

  #2907047 26-Apr-2022 17:57
Send private message

Can't you simply add a second trigger?

 

There is a button in the GUI, or in yaml might look like this:

 

 

 

alias: Autmationname
description: ''
trigger:
  - platform: time
    at: '23:00:00'
  - platform: time
    at: '00:00:00'




peejayw

1913 posts

Uber Geek
+1 received by user: 123


  #2907051 26-Apr-2022 18:07
Send private message

The time isn't the trigger, its a condition. The trigger is a temperature being reached, the action is to turn on a fan but I only want it to happen during those two time periods, outside of those time periods I dont want the action to run. Hope that makes sense.





 I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.


davidcole
6099 posts

Uber Geek
+1 received by user: 1465

Trusted

  #2907054 26-Apr-2022 18:31
Send private message

Could use a time of day sensor. It’s just been added to the helpers ui. And it will set a Boolean for each time period.

So is MORNING was 0500-0700 and EVENING was 1700-2100 then during those time a Boolean for MORNING would be set, likewise the evening.

I use these (an idea I pulled from openHAB). And use it for controlling heating. Similar periods to you. I also define the 0700-1700 as DAY which is used for other things





Previously known as psycik

Home Assistant: Gigabyte AMD A8 Brix, Home Assistant with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave, Shelly Humidity and Temperature sensors
Media:Chromecast v2, ATV4 4k, ATV4, HDHomeRun Dual
Server
Host Plex Server 3x3TB, 4x4TB using MergerFS, Samsung 850 evo 512 GB SSD, Proxmox Server with 1xW10, 2xUbuntu 22.04 LTS, Backblaze Backups, usenetprime.com fastmail.com Sharesies Trakt.TV Sharesight 




Ge0rge
2114 posts

Uber Geek
+1 received by user: 2060

Trusted
Lifetime subscriber

  #2907055 26-Apr-2022 18:32
Send private message

I do things like that using the NodeRed add on. Very easy to create that sort of rule as a flow.

russelo
332 posts

Ultimate Geek
+1 received by user: 43


  #2907065 26-Apr-2022 19:01
Send private message

Use Node-red. Very easy for complex automations.

CrunchiePotatoes
12 posts

Geek
+1 received by user: 3


  #2907068 26-Apr-2022 19:09
Send private message

As @davidcole said - create two "times of day" helpers - Can be created in the "helpers" tab next to automations.

 

Then you can easily add either of those helpers being true as conditions to your automation

 

 


 
 
 
 

Shop now for Lego sets and other gifts (affiliate link).
peejayw

1913 posts

Uber Geek
+1 received by user: 123


  #2907086 26-Apr-2022 20:40
Send private message

Thanks everyone, looks like I need to learn about helpers next 😁




 I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.


catdog
107 posts

Master Geek
+1 received by user: 17


  #2907110 26-Apr-2022 23:03
Send private message

peejayw:

The time isn't the trigger, its a condition. The trigger is a temperature being reached, the action is to turn on a fan but I only want it to happen during those two time periods, outside of those time periods I dont want the action to run. Hope that makes sense.



Can you post your (not working) automation?

An OR condition can work, but you need to be careful with how you set up the trigger.

If the temperature threshold is reached at say 4pm, then the automation will not start as expected. However, once it gets past 5pm then likely nothing will happen if the temperature remains above your threshold. The automation needs to be re-triggered again after 5pm to then re-evaluate the conditions before it can run.


davidcole
6099 posts

Uber Geek
+1 received by user: 1465

Trusted

  #2907112 26-Apr-2022 23:28
Send private message

I have a controller automation that pretty much does this.  I stopped using it if favour of a thermostat entity and setting minimums.

 

you trigger off a temp change, the only run if morning, evening and temp threshold 





Previously known as psycik

Home Assistant: Gigabyte AMD A8 Brix, Home Assistant with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave, Shelly Humidity and Temperature sensors
Media:Chromecast v2, ATV4 4k, ATV4, HDHomeRun Dual
Server
Host Plex Server 3x3TB, 4x4TB using MergerFS, Samsung 850 evo 512 GB SSD, Proxmox Server with 1xW10, 2xUbuntu 22.04 LTS, Backblaze Backups, usenetprime.com fastmail.com Sharesies Trakt.TV Sharesight 


eonsim
403 posts

Ultimate Geek
+1 received by user: 192

Trusted

  #2907113 26-Apr-2022 23:40
Send private message

Using something like appDaemon also works well if you're happy to write real code.

 

Is what your aiming for something like the following?

 

 

 

If temperature changes and the time is ((between a and b) or (between c and d)) check to see how the temperature relates to a target and do something (cool or heat)?


davidcole
6099 posts

Uber Geek
+1 received by user: 1465

Trusted

  #2907121 27-Apr-2022 06:38
Send private message

Another option is to use the simple thermostat.    And at morning and at evening set the thermostat target time to a temperature- eg 19)    And during the day, night (outside those periods) you set it lower eg 17

 

that’s the model I moved to.   But I made my own variant of the simple thermostat where you can also set a preset to boost which manually turns on the heating (or just whack up the temperature and the next time it enters the morning/evening time period it’s set back to my default of 19 degrees. 





Previously known as psycik

Home Assistant: Gigabyte AMD A8 Brix, Home Assistant with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave, Shelly Humidity and Temperature sensors
Media:Chromecast v2, ATV4 4k, ATV4, HDHomeRun Dual
Server
Host Plex Server 3x3TB, 4x4TB using MergerFS, Samsung 850 evo 512 GB SSD, Proxmox Server with 1xW10, 2xUbuntu 22.04 LTS, Backblaze Backups, usenetprime.com fastmail.com Sharesies Trakt.TV Sharesight 


HP

 
 
 
 

Shop now for HP laptops and other devices (affiliate link).
peejayw

1913 posts

Uber Geek
+1 received by user: 123


  #2907127 27-Apr-2022 07:46
Send private message

To explain what I am trying to do....

 

The room in question has a heat pump, a ceiling fan and two temperature sensors, one at ceiling height and one at floor level. With the help of members here I have made a template sensor that is the difference between the two temperatures, this is used in an automation to turn the ceiling fan on when the difference exceeds 1.5deg. Another automation turns the fan off when the difference drops below1deg. So far so good.

 

The heat pump is only turned on during the morning and evening time period mentioned and I dont want the fan turning on outside of this. I thought I could use OR conditions here but that doesn't seem to work. I would like to stick with using HA for this and preferably not get into Node Red.

 

This is the automation to date..

 

 

- id: '1649046539092'

 

  alias: Ceiling Fan On When Temp Diff above 1.5

 

  description: ''

 

  trigger:

 

  - platform: numeric_state

 

    entity_id: sensor.temperature_difference

 

    above: '1.5'

 

  condition:

 

  - condition: or

 

    conditions:

 

    - condition: time

 

      before: 08:30:00

 

      after: 05:30:00

 

    - condition: or

 

      conditions:

 

      - condition: time

 

        before: '21:00:00'

 

        after: '17:00:00'

 

  action:

 

  - service: switch.turn_on

 

    data: {}

 

    target:

 

      entity_id: switch.1000cc32f5

 

  mode: single

 

 

 

I will look into using Helpers as suggested, thanks.

 





 I'm supposed to respect my elders, but it's getting harder and harder for me to find one now.


davidcole
6099 posts

Uber Geek
+1 received by user: 1465

Trusted

  #2907225 27-Apr-2022 10:43
Send private message

Might be better to push that into pastebin since geekzone doesn't have code formatting.

 

 





Previously known as psycik

Home Assistant: Gigabyte AMD A8 Brix, Home Assistant with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave, Shelly Humidity and Temperature sensors
Media:Chromecast v2, ATV4 4k, ATV4, HDHomeRun Dual
Server
Host Plex Server 3x3TB, 4x4TB using MergerFS, Samsung 850 evo 512 GB SSD, Proxmox Server with 1xW10, 2xUbuntu 22.04 LTS, Backblaze Backups, usenetprime.com fastmail.com Sharesies Trakt.TV Sharesight 


Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.