Events

Schedy introduces two new events it listens for and which you can emit from your custom Home Assistant automations or scripts in order to control Schedy’s behaviour.

  • schedy_reevaluate: Trigger a re-evaluation of schedules. Only use this event if you can’t express the criteria that should trigger a re-evaluation via the watched_entities configuration, e.g. when you need re-evaluation.based on time intervals instead of state changes. Parameters are:
    • room: the name (or list of names) of the room(s) to re-evaluate schedules for as defined in Schedy’s configuration (not the friendly_name) (default: null, which means all rooms)
    • mode: There are two different re-evaluation modes you can choose from. (default: "reevaluate")
      • "reevaluate": Re-evaluate the schedule and, if the result has changed compared to the previous evaluation, apply the new value to all actors in the room. If a re-scheduling timer is running, nothing is done until that timer goes off. This is the mode you normally want when notifying Schedy about state changes of entities used in your schedule. You can trigger a schedy_reevaluate event in this mode as often as you like without worrying about loosing manual value changes early.
      • "reset": Re-evaluate the schedule and set the resulting value to all actors in the room, no matter if it has changed or not. This mode also discardss a re-scheduling eventually planned for the future and instead performs one immediately. Use this mode in order to discard any manual adjustment at one of the actors, e.g. when presence state has changed or a master switch was toggled and you want to ensure all actors are updated. This is exactly what the built-in delayed re-scheduling does after manual adjustments when enabled.
  • schedy_set_value: Sets a given value for a room. Parameters are:
    • room: the name (or list of names) of the room(s) as defined in Schedy’s configuration (not the friendly_name)
    • value or v: a plain value as it could also have been generated by a schedule, as a simple alternative to expression
    • expression or x: an expression as it could also have been generated by a schedule, as an alternative to value
    • force_resend: whether to re-send the value to the actors even if it hasn’t changed due to Schedy’s records (default: false)
    • rescheduling_delay: a number of minutes after which Schedy should automatically switch back to the schedule; 0 disables automatic re-scheduling (default: the rescheduling_delay set in Schedy’s configuration for the particular room)

Note

In order to pass an expression to the schedy_set_value event, you need to set expressions_from_events: true in Schedy’s configuration. Beware the implications on security this has, as everybody with access to Home Assistant’s event bus can then execute arbitrary Python code on your machine with the privileges of the user AppDaemon runs as. Weigh for yourself on whether you really need this feature.

All events have an optional app_name parameter that can be submitted when you have multiple instances of Schedy running for different purposes and you want to address exactly one of these instances. Its value has to be the name of the app instance as configured in AppDaemon. If you omit this parameter, all Schedy instances will react to the event. The app name is the name you start the app’s configuration with:

schedy_heating:  # "schedy_heating" would be the value to use for app_name.
  module: hass_apps_loader
  class: SchedyApp
  # ...

This is an example Home Assistant script that turns the heating in the room named living to 25.0 degrees and switches back to the regular schedule after one hour, given that you use the thermostat actor type and yourr app instance is named schedy_heating, of course.

- alias: Hot for one hour
  sequence:
  - event: schedy_set_value
    event_data:
      app_name: schedy_heating
      room: living
      v: 25.0
      rescheduling_delay: 60