Heaty will die, Schedy be born!

Good morning all,

Two bugs had found their way into Schedy 0.8.0, which were now eliminated with Schedy 0.8.1. I strongly recommend to upgrade in order to restore normal operation!

Best regards
Robert

I have Schedy set up to drop the temperature when we leave home and that all works.

What I would like to do is to increase the temperature by 0.5deg from the current temperature when I return.

Ive tested this in Dev-Tools >Template and it works:

{{ states('sensor.current_home_temp')|float+0.5}}

Reading through the docs I thought this might work by creating a automation like this:

- alias: Increase heating on return
  initial_state: 'on'
  trigger: []
  action:
      - event: schedy_set_value
        event_data:
          app_name: schedy_heating
          room_name: home
          v: "states('sensor.current_home_temp')|float+0.5"
          rescheduling_delay: 60

But this isn’t working. I have tried the automation with a fixed value as ‘v’ and it works but trying to create a variable value isn’t working. Any ideas please.

IIRC it has to be x for calculated values.

I have tried ‘x’ in above template line and still doest work including placing the line in “{{ }}”

That string isn’t evaluated by Home Assistant as a template, it’s just passed straight to Schedy.

In your case, I’d go another route:

  1. Create a template binary_sensor that is on for 60 minutes after you returned home, or - if that is easier - alternatively an input_boolean that you turn on when you return home and then off again after 60 minutes.
  2. Add a schedule rule which adds 0.5 if this binary_sensor/input_boolean is on.

I got the code from the bottom of this page and was trying to rework it

https://hass-apps.readthedocs.io/en/stable/apps/schedy/events.html

Is it not possible to pass a variable back to Schedy to set ‘v’ instead of a fixed value?

The adding of 0.5 is to the current room temperature, so I need to get that and +0.5 to it, hence my template

Im only manually triggering it at the moment till I can get it to work, hence no trigger

You can use x with the event, but then you have to pass an expression like you would write it in Schedy itself, e.g. Python, not in the Home Assistant template syntax.

Are you sure that you want to set a fixed temperature for 60 minutes after you return home instead of following the schedule + some offset?

EDIT: A possible expression would be:

x: "0.5 + float(state('...'))"

Yes, the reason behind this is if we return home late at night and the schedule has drop the temperature to the overnight setting of 16deg, the sensor.current_home_temp temperature will start to drop as the room temperature falls, what ever it drops to I only want to add 0.5 to the new dropped temperature setting to force the boiler on for a short while and don’t want the temperature setting to return to its day setting of 21.5 for 60mins or what ever we end up setting the rescheduling_delay too.

Hope this makes sense.

Ok, then try the expression I gave you. It should work.

Yes it does thank you

- x: 0.5 + float(state('sensor.current_home_temp'))

I just entered it in as a single line and the temperature increased so I’ll work on that to get the desired results Im after. Thanks again.

Just to be sure, you passed x: ... as data to the schedy_set_value event and did not add it as a rule to your schedule, right? I ask because in your previous post you started the line with a -, which made me think you might have added it as a schedule rule.

Thank you, I added the line above into Schedy to test it and it worked, I then added the line without the ‘-’ into my automation and it work so that’s great. I know realise what @baz123 meant, I wasn’t sure at the time.

I will now look at doing what I want in Schedy instead of using the automation because of the concern regarding expressions_from_events: true. Thanks guys for your help.

I will now look at doing what I want in Schedy instead of using the automation because of the concern regarding expressions_from_events: true.

I think you are safe as long as your HA has authentication in place. And you can further reduce the attack surface by running AppDaemon as an unprivileged user. I don’t know your environment, but as long as it’s a Docker-based thing without sensitive data mounted into it you should be fine. But yes, it’s something to think about.

BTW, you could use event_data_template instead of event_data and then do what you wanted to do originally: evaluate the template in HA and just pass the result to Schedy via v. That way, you don’t need to enable expressions_from_events.

1 Like

Yep, works. Thanks

- alias: Increase heating on return
  initial_state: 'on'
  trigger: []
  action:
      - event: schedy_set_value
        event_data_template:
          v: "{{ states('sensor.current_home_temp')|float+0.5 }}"
          app_name: schedy_heating
          room_name: home
          rescheduling_delay: 60

Now I can set the trigger and conditions.

2 Likes

Looks great, thanks for sharing.

unfortunately I cannot install schedy or the hass-apps :frowning:

All files created:

apps $ pwd
/root/config/appdaemon/apps

apps $ cat requirements.txt 
hass-apps

apps $ cat hass_apps_loader.py 
# This is just a stub which makes the app classes available for AppDaemon.

from hass_apps.loader import *

AppDaemon4 log:

2020-02-12 17:08:59.461391 WARNING Error: ------------------------------------------------------------
2020-02-12 17:08:59.459364 WARNING Error: Traceback (most recent call last):
File “/usr/lib/python3.8/site-packages/appdaemon/app_management.py”, line 788, in check_app_updates
await utils.run_in_executor(self, self.read_app, mod[“name”], mod[“reload”])
File “/usr/lib/python3.8/site-packages/appdaemon/utils.py”, line 276, in run_in_executor
response = future.result()
File “/usr/lib/python3.8/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/lib/python3.8/site-packages/appdaemon/app_management.py”, line 580, in read_app
self.modules[module_name] = importlib.import_module(module_name)
File “/usr/lib/python3.8/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 671, in _load_unlocked
File “”, line 783, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/config/appdaemon/apps/hass_apps_loader.py”, line 3, in
from hass_apps.loader import *
ModuleNotFoundError: No module named ‘hass_apps’

2020-02-12 17:08:59.451352 WARNING Error: ------------------------------------------------------------
2020-02-12 17:08:59.450062 WARNING Error: Unexpected error loading module: /config/appdaemon/apps/hass_apps_loader.py:
2020-02-12 17:08:59.448490 WARNING Error: ------------------------------------------------------------

@broken.pipe What kind of AppDaemon installation is this?

I installed the AppDaemon 4 from the Addon Store

So that’s hassio, but you followed the instructions for installation in a Docker environment. The hassio steps are a bit different but described in the docs.