Heaty will die, Schedy be born!

@roschi Yes this works but I have troubles in combining it with holiday mode and away mode for which I do have input booleans. Would it be possible to add the state of a boolean simply to the constraints of a schedule l for example:
weekdays: 7
input_boolean.holidays: ‘true’

Snap; I have been thinking of the same idea. Rather than a boolean I’d suggest a Schedy instance ‘state’. For me I’d probably want 3; ‘home’ (i.e. days when we are usually home) ‘working’ (days we are at work and school) and ‘away’ (days when we are totally away).

So perhaps a means of specifying this ‘state’, and what the states are and then in the rule, a means of specifying it like weekdays for instance (so same rule could be for both ‘home’ and ‘working’).

I know this can be done in a similar way using snippets but this may be cleaner.

@taste and @baz123 Sorry, but this won’t come.

It would be another concept one had to understand, and there are sub-schedules exactly for that purpose. You don’t even have to use schedule snippets if you need the rules in question at one place only.

EDIT: Here’s the example for reference. https://hass-apps.readthedocs.io/en/latest/apps/schedy/schedules/expressions/examples.html#conditional-sub-schedules-using-break

1 Like

Hi roschi,
I’m having some trouble configuring Schedy properly in my setup.
First of all, my thermostats (Homematic) don’t have an “off” mode. They are off if the temperature ist set to 4,5°C. Additionally, they have “auto” and “manual” modes (besides ‘boost’, ‘comfort’, ‘lowering’).
Here’s the relevant part of my configuration:

actor_templates:
  default:
    opmode_on: "auto"
    opmode_off: "manual"
    off_temp: 4.5

rooms:
  bathroom:
    friendly_name: Bad
    allow_manual_changes: true
    rescheduling_delay: 0
    actors:
      climate.badthermostat:
        template: default
    schedule:
      - value: 17

So I want the thermostat to be “manual 4,5°C” if it should be on, otherwise it schould be in “auto” mode.
But with that config, I’m not able to manually set the thermostat mode to “manual”. It always changes back to “auto”:

2018-12-30 15:34:13.788399 INFO schedy: --> [R:Bad] [A:climate.badthermostat] Received value of OFF.
2018-12-30 15:34:14.616881 INFO schedy: <-- [R:Bad] Value set to OFF.  [manual]
2018-12-30 15:34:14.820677 INFO schedy: --> [R:Bad] [A:climate.badthermostat] Received value of 4.5��.
2018-12-30 15:34:14.861176 INFO schedy: --> [R:Bad] [A:climate.badthermostat] Received value of 17.0��.
2018-12-30 15:34:15.080022 INFO schedy: --> [R:Bad] [A:climate.badthermostat] Received value of 4.5��.

The other problem I have is: I want to write an expression that aborts the rule if the thermostat in question is set to “manual”. That’s what I have so far:

schedule_prepend:
  - x: |
      for entity in filter_entities('climate', schedy_room=room_name):
        if state(entity, attribute = "mode") == 'manual':
          Abort()

To be honest, I haven’t programmed much in Python and especially not for Home Assistant/Appdaemon, so it would be awesome if you could put me in the right direction!

Hi @marank

When you set opmode_off: manual, Schedy assumes that the value is OFF when the thermostat is in manual mode and vice-versa, that it should set the operation mode to manual when your schedule evaluates to OFF

It would be helpful to know what the auto and manual modes actually do. Is auto something that prevents adjustments from the controller/gateway (don’t know how that’s called in Homematic)?
I think the right way would be to disable operation mode support and always keep the thermostat in manual mode, but can’t say for sure without knowing how the modes work.

Regarding your second issue, I don’t think what you’re trying there is what you really want, or do you want Schedy to ignore a room completely when one of its thermostats is set to manual mode? If yes, then it should be:

schedule_prepend:
  - x: |
      for entity in filter_entities('climate', schedy_room=room_name):
        if state(entity, attribute = "operation_mode") == 'manual':
          result = Abort()
          break
      else:
        result = Skip()

EDIT: Although that could be done easier as well, but let’s wait to see if you really want it.

Thanks for your quick answer @roschi!
As you assumed correctly, manual mode prevents any automatic temperature changes from the schedule configured in the Homematic gateway. My goal is to move entirely away from the gateway schedules to schedy.
That said, it would be awesome if I could somehow mimic the default behaviour of the thermostat: If it is set to ‘manual’, Schedy should in fact ignore the room completely. That’s what I wanted to achieve with the statement in schedule_prepend. The schedule should be applied only in ‘auto’ mode.
Additionally, if I set it to ‘OFF’, it should switch to manual so that the schedule doesn’t override the temperature at any time.
I hope that clears things up a bit.

Thanks for the code snippet! I realized it could indeed be written shorter:

- x: "Abort() if not is_empty(filter_entities('climate', schedy_room=room_name, operation_mode='manual')) else Skip()"

@marank Ok, I think I got it now.

Altough that’s a uncommon way of setting it up, I see nothing that should prevent it from working, at least not at first glance.

Is setting up a schedule on/off switch as shown in the examples no option for you? Because you could then disable operation mode support in Schedy and have a more common setup. But as I said - as long as it works :slight_smile:

EDIT: Ah, the is_empty() helper is exactly what I was aiming at. Should work that way.

Hm… disabling opmode support was an interesting hint I didn’t thought of… In my case, I don’t really need it indeed because the thermostat is off if the temperature is at a specific level. That way, I don’t lose the manual/auto functionality either because schedy doesn’t touch them and only checks them for a certain value.

It sure is an option, but it’s not as accessible than a physical button on the thermostat, at least for my house mates :slight_smile:

I’ll test it with disabled op mode support, thanks you so much for helping me!

Yes, the additional comfort is a valid point.

But keep in mind that, as soon as you set it to OFF by a schedule, it won’t come back on automatically because schedules are then disabled.

Why is that? Are thermostats with a set temperature that equals OFF not considered for scheduling?

No, but you abort scheduling when a thermostat in the room is in manual operation mode with your custom rule.

And turning it into manual operation mode is what Schedy does when your schedule evaluates to OFF, because you set opmode_off: manual.

Okay, got you.
But having

actor_templates:
  default:
    supports_opmodes: false
    off_temp: 4.5

prevents this, doesn’t it?

@roschi

Yes I am using that example. I think I have it working now with only one failure mode left. This is if I set the away mode while it was in the ‘on’ state it will never get off again.

This is my complete code, ope for suggestions to simplify :slight_smile:

      schedule:
      - x: "Abort() if is_on('input_boolean.away') else Skip()" # Do run any schedule if away is set
      - x: "'on' if float(state('sensor.filtered_outside_temp') or 0) < 5 else Skip()"
    # Holiday's/ Vacation
        rules:
        - x: "Skip() if is_on('input_boolean.holidays') else Break()"
        - { start: "09:00", end: "10:30" }
        - v: 'off'
        - x: "Break()" # Avoid further processing of rules

    # Monday - Friday
      - x: "'on' if float(state('sensor.filtered_outside_temp') or 0) <  5 else Skip()"
        weekdays: 1-5
        rules:
        - { start: "06:30", end: "07:00"}
        
    # Saturday
        weekdays: 6
        rules:
        - { start: "08:30", end: "10:00"}
      
    # Sunday
        weekdays: 7
        rules:
        - { start: "09:00", end: "10:30" }
        
      - v: 'off'

      actors:
        switch.bath_room_floor:
1 Like

@marank Yes, as long as a temperature of 4.5 does turn the thermostat off, that should be fine.

What do you expect the switch to be when away mode is enabled? Probably off.

schedule:
- x: "'on' if float(state('sensor.filtered_outside_temp') or 0) < 5 else Skip()"
  rules:
  - x: "Break() if is_on('input_boolean.away') else Skip()"

  - rules:
    - x: "Skip() if is_on('input_boolean.holidays') else Break()"
    - { start: "09:00", end: "10:30" }

  - weekdays: 1-5
    rules:
    - { start: "06:30", end: "07:00"}
        
- v: 'off'

The weekend is left for you to be done.

1 Like

@roschi
Thanks a lot this really helps to simplify. Did not now you could nest the rules too to avoid the problem that other rules are still processed. Adding the weekend should be straight forward :slight_smile:

And indeed it needs to be ‘off’ when in away mode

Yes, that’s what sub-schedules are cool for. BTW, you could just have returned "off" instead of Abort() and had solved it as well.

I like this better :+1: thanks again

Hi roschi,
I’m having some trouble sending the reschedule event to shedy. Whenever I trigger the reschedule event I receive the following AppDaemon Warning:

 WARNING AppDaemon: Incorrect signature type for callback <lambda>(), should be f(self, kwargs) - discarding

The rescheduling is triggered as follows:

action:
  - event: schedy_reschedule
    event_data:
        app_name: "schedy_heating"
        mode: "reset"
        room: "bathroom"

I hope you can point me in the right direction. If u need further details, please let me know. Thanks in advance.

@hagihog Never seen that, post the AD debug logs of the time the event is fired, +/- 5 seconds please.