Schedy heating with dependencies outside climate entity

Hi all,

I need some help to have schedy appdaemon scheduling my heating working.
Below my schedy.yaml:

# Schedy thermostats
schedy_heating:
  module: hass_apps_loader
  class: SchedyApp
  actor_type: thermostat

  schedule_snippets:
    appartment:
# At given times the themperature should be 22 degree celsius
    - { v: 21, start: "06:30", end: "08:00", weekdays: "1-5", weeks: "1-9, 44-52" }
    - { v: 21, start: "16:30", end: "23:00", weekdays: "1-5", weeks: "1-9, 44-52" }
    - { v: 21, start: "07:00", end: "23:00", weekdays: "6-7", weeks: "1-9, 44-52" }
# On all other times the temperature should be 19 degree celsius
    - { v: 19, weekdays: "1-7", weeks: "1-13, 40-52" }

  schedule_prepend:
  - x: "Mark(OFF, Mark.OVERLAY) if not is_empty(filter_entities('binary_sensor', window_room=room_name, state='on')) else Skip()"
  schedule_append:
  - v: "OFF"

  rooms:
    living:
      actors:
        climate.living:
      watched_entities:
      - binary_sensor.rf_terrace
      schedule:
      - x: "IncludeSchedule(schedule_snippets['appartment'])"
      rescheduling_delay: 60

In home assistant, my climate.living:

hvac_modes:
  - heat
  - 'off'
current_temperature: 18
min_temp: 5
max_temp: 22
temperature: 19
hvac_action: heating
preset_mode: null
preset_modes:
  - none
  - away
friendly_name: thermostat
supported_features: 17

The link between my schedy.yaml and my climate.living works as coded. In order for my heating to work accordingly however there is a dependency with 3 other entities, i.e.:

Climate.living state triggered from off to heat:

  • switch.easyplus + switch.boiler if state = on do nothing, otherwise turn_on

  • input_number.setpoint_living set_state = climate.living; attribute temperature, e.g. 21

In my opinion the way forward would be through python_script or ideally directly through schedy app.

Looking forward for ideas.

Actually, I don’t fully understand your requirements. Could you explain in more detail what you’re trying to achieve?

So I have a proprietary automation system (Easyplus) that controls the valves and sets heating temperature.
I have a shell script that interfaces with Easyplus and I use a sonoff basic module to switch Easyplus on/off (switch.easyplus), I also have a Blitzwolf SPH6 to turn on/off my boiler (switch.boiler), and finally I have an input number (input_number.setpoint_living) to set temperature in Easyplus. This input number is linked with a shell command that interfaces directly with Easyplus ( shell_command_tmp_living: “/config/opt/bin/apex.sh 'setsetpoint 0, {{ states.input_number.setpoint_living.state | int }}”).

I hope it clarifies more.

But then it seems you don’t have climate entities at all, right?

EDIT: Or, better, where does the climate entity you described earlier come from? Can you correctly select a target temperature just by controlling the climate entity from Home Assistant UI, or is that not supported by your platform at all?

I don’t use Schedy, so I can’t help much there. But it seems that an AppDaemon app responsible for setting your thermostat setpoint should be aware of the mode the thermostat is in and should handle setting the setpoint again when that climate.living state changes from off to heat. So, for that piece of the puzzle, I would alter Schedy, or contact the Author to see if there’s a way to do this already.

For turning easyplus and the boiler on, this could be accomplished with a simple Home Assistant automation or an AppDaemon app.

In AppDaemon, something like:

def initialize(self):
  self.listen_state(self.climate_cb, 'climate.living', attribute='state')

def climate_cb(self, entity, attribute, old, new, kwargs):
  if old != "off" or new != "heat":
    return
  if self.get_state('switch.easyplus', attribute='state') != 'on':
    self.turn_on('switch.easyplus')
  if self.get_state('switch.boiler', attribute='state') != 'on':
    self.turn_on('switch.boiler')
1 Like

climate.living is configured in hass as follows:

  - platform: generic_thermostat
    name: living
    heater: switch.heating_living
    target_sensor: sensor.tmp_living
    min_temp: 5
    max_temp: 22
    ac_mode: false
    target_temp: 17
    hot_tolerance: 0.5
    min_cycle_duration:
      minutes: 5
    initial_hvac_mode: "off"
    away_temp: 17
    precision: 0.5

Where switch.heating_living turns on/off my valve and sensor.tmp_living reads the temperature from Easyplus.

Then you could write the same automation around switch.heating_living being “on” or "off. And since you store the temperature in an input_number, you could also include setting the setpoint at that time if Schedy isn’t doing it for you.

Hi @roschi is it possible to incorporate @swiftlyfalling suggestion in Schedy and how?

thanks

A lot of information @swiftlyfalling , I’ll need to take time to digest but I think that we’re almost there. Will get back to you, thanks again. Appdaemon approach seems very appealing.

I do nearly all of my automations in AppDaemon because I have access to more tools there and the code required is often quite a bit shorter than Home Assistant Automations with the same functionality.

Hi @merwone

The purpose of Schedy’s thermostat mode is to flexibly control a climate entity, including it’s HVAC mode and setpoint, nothing more. If your setup requires additional switches to be turned on and off depending on the climate’s current state, this has to be implemented separately, either by automations or, which I would prefer, by a second Schedy instance using the switch actor type and a room for each of your switches. That instance would then need to have rules like:

- x: "'on' if state('climate.living') == 'heat' else 'off'"

for the living room. You could then even declare a function in the expression_environment that takes a climate entity and returns whether it’s currently in heat state as a boolean to safe you some redundancy.

Today I tried to experiment with Schedy class switch and seperate app. I decided for a seperate because of my inexistent python knowledge.

in climate.yaml I have:

climate_heating:
  module: climate
  class: climate
  entities:
    - climate.living
    - climate.bath
    - climate.bed

In climate.py I have:

import appdaemon.plugins.hass.hassapi as hass

class climate(hass.Hass):

 def initialize(self):

   for climate in self.args["entities"]:
     self.listen_state(self.climate_cb, climate, attribute='state')

 def climate_cb(self, entity, attribute, old, new, kwargs):
   if old != "off" or new != "heat":
     return
   if self.get_state('switch.easyplus', attribute='state') != 'on':
     self.turn_on('switch.easyplus')
   if self.get_state('switch.boiler', attribute='state') != 'on':
     self.turn_on('switch.boiler')

The above works. Now I would like to add to climate.py to listen to climate, attribute temperate and run below shell_command:

`/config/opt/bin/apex.sh ‘setsetpoint 0, 22’``

Where 0 is dependent on room, living = 0, bath = 1 and bed = 2
Where 22 should be retrieved from climate.ROOM temperature.

Hints welcome, thanks.