Heaty will die, Schedy be born!

Perfect, thank you. It‘s starting and working now :slight_smile:

stupid question, but what do i do with adjacent times? can the end time be the new beginning time, or do i need a time offset?

- { v: 30, start: "21:30", end: "22:00" }
- { v: 20, start: "22:01", end: "06:00" }

i have added a very simple configuration. unfortunately it switches off all my thermostats and sets them to the lowest temperature. am i still missing something?

schedy_heizung:
  module: hass_apps_loader
  class: SchedyApp

  actor_type: thermostat

  schedule_append:
    - v: "OFF"

  rooms:
    Wohnzimmer:
      actors:
        climate.wohnzimmer:
      schedule:
        - v: 19
          rules:
            - weekdays: 1-5
              rules:
                - { v: 23, start: "05:15", end: "07:30" }
            - weekdays: 6-7
              rules:
                - { v: 23, start: "07:00", end: "22:00" }

Log:
2020-02-18 17:51:57.857146 INFO schedy_heizung: --> [R:Wohnzimmer] [A:climate.wohnzimmer] Received value of OFF.

I think they can be the same time because in one case it is less than and the other greater than (I think).

stupid question, but what do i do with adjacent times? can the end time be the new beginning time

Yes, there needs to be no offset.

i have added a very simple configuration. unfortunately it switches off all my thermostats and sets them to the lowest temperature. am i still missing something?

This schedule sets 23 degrees on weekdays from 5:15 to 7:30 only, the rest of the day, it falls back to OFF, which you specified in schedule_append. I think you wanted to specify the 23 instead of the 19 so that it counts for all rules inside the sub-schedules and leave out the 23’s in the sub-schedules completely. If you want to set 19 degrees as a fallback for all other times, set it in schedule_append instead of OFF.

1 Like

As an addition: The 19 degrees you set in the outmost rule in your schedule actually has no effect at all, since you overwrite it with a 23 in every sub-schedule.

Thank you very much for your replies :slight_smile:

I thought the 19 degrees are used as fallback value if no rule is set. I’ll set the value as a rule if necessary.
There is one problem i still have to solve. I usually use the ‘auto’ setting of the thermostats. Unfortunately it throws me an error that schedy can’t find/use this setting.

[A:climate.livingroom] Unknown HVAC mode 'auto', ignoring thermostat.

With the thermostat actor type in Schedy, you have to pick one HVAC mode you use in operation and configure that as the hvac_mode_on parameter of the actor. The default value is heat. If you want to change it for all actors, best way is to set it in the default actor template:

actor_templates:
  default:
    hvac_mode_on: auto

EDIT: All the possible settings and more details can be found in the docs.

After weeks of try and error, I think i got it. I want to share it with you. Maybe someone can benefit from it. Or maybe I got some tips for improvements.

At first, I got four rooms. Wohnesszimmer, Bad, Büro, Schlafzimmer.

Every radiator will be shut down, if the outside temperature is above 15°C.
Room Wohnesszimmer:
Three rules, one for holidays, workday and weekend.
On holidays I will keep the house warm all day long, except nobody is at home.
On weekends i got the same rules like on holidays, except that it works on every saturday and sunday.
On workdays I got a simple plan to keep the house warm between specific times.
Also the other rooms got a simple plan, but this plan will only be active if somebody is at home.

The outside temperature comes from weather sensor from met.no integration.
Holidays are coming from a group of calenders. These calenders are subscribed, so I dont have to keep them updated.
Group.haus is a group of all people who live here. If somebody is at home, a input_boolean of this person is set to true. All of these inputs are in one group.

schedy_heating:  # This is our app instance name.
  module: hass_apps_loader
  class: SchedyApp
  schedule_prepend:
    # Schalte alle Heizkörper aus, wenn Außentemperatur über 15C
    - x: "'Off' if float(state('weather.home', 'temperature') or 0) > 15 else Next()"

  watched_entities:
    - "group.haus"
    - "weather.home:temperature"
  actor_type: thermostat
  rooms:
    wohnesszimmer:
      watched_entities:
      - "group.ferien_und_feiertage"
      actors:
        climate.egwohnzimmerheizung_links_mode_2:
        climate.egesszimmerheizung_links_mode_3:
        climate.egesszimmerheizung_rechts_mode_4:
        climate.egwohnzimmerheizung_rechts_mode:
      schedule:
      - v: 18
        rules:   
        # Regelung Ferien-------------------------------------------------------
        - rules:
          # aktiviere Plan in den Ferien
          - x: "Next() if is_on('group.ferien_und_feiertage') else Break()"
          
          - rules:
            # aber nur wenn Haus aktiv
            - x: "Next() if is_on('group.haus') else Break()"
            - { v: 21, start: "06:00", end: "23:00" }
        # Regelung Wochenende---------------------------------------------------
        - weekdays: 6-7
          rules:
          - rules:
            # aktiviere Heizung wenn jemand Zuhause
            - x: "Next() if is_on('group.haus') else Break()"
            - { v: 21, start: "06:00", end: "23:00" }
        # Regelung Wochentage---------------------------------------------------
        - weekdays: 1-4
          rules:
          - { v: 21, start: "13:00", end: "22:00" }
        - weekdays: 5
          rules:
          - { v: 21, start: "11:30", end: "23:00" }
      - v: 18  
    schlafzimmer:
      actors:
        climate.dgschlafzimmerheizung_mode:
      schedule:
      - v: 16
        rules:
        - rules:
          - x: "Break() if is_off('group.haus') else Next()"
          - { v: 18, start: "00:00", end: "07:30" }
        - v: 16
    
    buero:
      actors:
        climate.dgbueroheizung_mode:
      schedule:
        - v: 18
          rules: 
          - rules:
            - x: "Break() if is_off('group.haus') else Next()"
            - { v: 22, start: "13:00", end: "20:00" }
          - v: 18
     
    bad:
      actors:
        climate.dgbadheizung_mode:
      schedule:
        - v: 18
          rules:
          - rules:
            - x: "Break() if is_off('group.haus') else Next()"
            - { v: 23, start: "05:00", end: "09:00" }
            - { v: 23, start: "18:00", end: "22:00" }
          - v: 18
3 Likes

Hi @Se7enair and thanks for sharing your config. Looks cool!

I’ll try to comment on it (or parts of it) during the next days. There are some unnecessarily complex sub-schedule constructs, but nothing really problematic, at least not at first glance.

Best regards
Robert

thanks a lot for your configuration. could you explain a little bit more how to implement the group for holidays and vacations?

I started with the integration for Google Calendar.

Set it up to get connection to the calendar.
After that I subscribed to a public calender with holidays.



I subscribed to calenders for holidays in bavaria and swabian and also to school holidays in bavaria.
Additionally to that I started a new calender on which I collect all my holidays from work.
(I didnt found a way to summarize all the subscribed calenders into one)

In every calender there is a whole day event if the day is “free”.

After that I made a group of the calenders I just subscribed.

group:
  Ferien_und_Feiertage:
    name: Ferien und Feiertage
    icon: mdi:calendar-star
    entities:
      - calendar.ferien_bayern
      - calendar.feiertage_baden_wurttemberg
      - calendar.feiertage_bayern
      - calendar.urlaub_christoph

This generates a group, which will be “on” if there is a whole day event in one of these calenders.

This group can be integrated to schedy as a entity which can be on or off.
Anmerkung 2020-02-26 103630

At first I started with the workday sensor from HA. The problem was, that there are no school holidays and also my holidays from work. I should enter every single day into my config.yaml. The method with the calendar is easier and prepared for all future holidays.

3 Likes

perfect, thank you! i am trying to find an alternative to the google calendar. maybe i can integrate my existing nextcloud calendar.

Just use the CalDAV integration:

Subcribe to any public calendar should not be a problem for nextcloud. Otherwise you can make your own events in the calendar.

1 Like

I made a small correction.
Added v:18 at the last line from my holiday rules. The room changed to the rules for normal workdays when nobody is at home.
I didnt discovered this, because i didnt get this case in the last days, or i dont recognized it.

rules:   
        # Regelung Ferien-------------------------------------------------------
        - rules:
          # aktiviere Plan in den Ferien
          - x: "Next() if is_on('group.ferien_und_feiertage') else Break()"
          
          - rules:
            # aber nur wenn Haus aktiv
            - x: "Next() if is_on('group.haus') else Break()"
            - { v: 21, start: "06:00", end: "23:00" }
            - v:18

Hi @Se7enair

I modified your config and added some comments.

schedy_heating:
  module: hass_apps_loader
  class: SchedyApp

  actor_type: thermostat

  schedule_prepend:
    # Schalte alle Heizkörper aus, wenn Außentemperatur über 15C
    # Better use the object OFF instead of the string 'OFF' here.
    - x: "OFF if float(state('weather.home', 'temperature') or 0) > 15 else Next()"

  watched_entities:
    - "group.haus"
    - "weather.home:temperature"

  rooms:
    wohnesszimmer:
      watched_entities:
      - "group.ferien_und_feiertage"
      actors:
        climate.egwohnzimmerheizung_links_mode_2:
        climate.egesszimmerheizung_links_mode_3:
        climate.egesszimmerheizung_rechts_mode_4:
        climate.egwohnzimmerheizung_rechts_mode:
      schedule:
        # Why this 18? No child rule is actually using it. I'd better set the high
        # temperature here and inherit it into the children.
      - v: 21
        rules:   
        # Regelung Ferien-------------------------------------------------------
        - rules:
          # These two conditions can simply be AND-ed and you save one sub-schedule.
          # aktiviere Plan in den Ferien wenn Haus aktiv
          - x: "Next() if is_on('group.ferien_und_feiertage') and is_on('group.haus') else Break()"
            # And we don't need the 21's anymore thanks to inheritance...
          - { start: "06:00", end: "23:00" }
        # Regelung Wochenende---------------------------------------------------
        - weekdays: 6-7
          rules:
          # Here was one unneeded level of sub-schedule.
          # aktiviere Heizung wenn jemand Zuhause
          - x: "Next() if is_on('group.haus') else Break()"
          - { start: "06:00", end: "23:00" }
        # Regelung Wochentage---------------------------------------------------
        - weekdays: 1-4
          rules:
          - { start: "13:00", end: "22:00" }
        - weekdays: 5
          rules:
          - { start: "11:30", end: "23:00" }
        # And this is the only fallback we need. It catches if nothing else did.
      - v: 18  

    schlafzimmer:
      actors:
        climate.dgschlafzimmerheizung_mode:
      schedule:
      # Again, this 16 is used nowhere, better inherit the high temp to child rules.
      - v: 18
        rules:
        # And removed an unneeded sub-schedule.
        - x: "Break() if is_off('group.haus') else Next()"
        # No need for the 18 here anymore.
        - { start: "00:00", end: "07:30" }
      # And pulled this one level up, out of the sub-schedule.
      - v: 16

    # Basically, buero and bad are same as schlafzimmer, maybe you can do it for
    # these yourself?
    
    buero:
      actors:
        climate.dgbueroheizung_mode:
      schedule:
        - v: 18
          rules: 
          - rules:
            - x: "Break() if is_off('group.haus') else Next()"
            - { v: 22, start: "13:00", end: "20:00" }
          - v: 18
     
    bad:
      actors:
        climate.dgbadheizung_mode:
      schedule:
        - v: 18
          rules:
          - rules:
            - x: "Break() if is_off('group.haus') else Next()"
            - { v: 23, start: "05:00", end: "09:00" }
            - { v: 23, start: "18:00", end: "22:00" }
          - v: 18

Hope it helps. Just ask if something isn’t clear to you.

Best regards
Robert

Yeah, thank you for your comments. Changed it.

The unneeded levels are from blind copy paste.
And it seems I didnt complety unterstand the thing with the fallback. Now it seems to be perfect.

Hi @roschi,

has there been a very recent update to Schedy? My temperature alert woke me up an hour ago as the heating didn’t work and despite restarts, the logfile gets spammed with these entries (everything was working fine until shortly after midnight):

2020-02-29 05:17:21.931668 WARNING AppDaemon: ------------------------------------------------------------
2020-02-29 05:17:22.740837 INFO HASS: Connected to Home Assistant 0.106.2
2020-02-29 05:17:22.750501 WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds
2020-02-29 05:17:22.935698 WARNING AppDaemon: ------------------------------------------------------------
2020-02-29 05:17:22.937044 WARNING AppDaemon: Unexpected error in scheduler loop
2020-02-29 05:17:22.938244 WARNING AppDaemon: ------------------------------------------------------------
2020-02-29 05:17:22.939948 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/appdaemon/scheduler.py", line 421, in loop
    next_entries = self.get_next_entries()
  File "/usr/lib/python3.8/site-packages/appdaemon/scheduler.py", line 335, in get_next_entries
    next_exec = datetime.datetime.now(pytz.utc).replace(year=3000)
ValueError: day is out of range for month

Ive woke up this morning to no heating, checked the logs and have the same error messages. Restated app, the heating came on but still have the error messages.

1 Like

Well, today is the 29th of February, this looks a lot like a leap year issue… :thinking:

1 Like

Hi all,

Sorry to hear you all have this issue (I do, too). This indeed is a leap year issue with AppDaemon (not Schedy), so I’m afraid I can’t do anything about it. Maybe @ReneTode knows what’s happening about it.

All I can say is that Schedy’s code itself is fully leap year-aware, so once the AppDaemon bug has been fixed, it should all work as intended in 2024. :slight_smile:

Best regards
Robert

2 Likes