Heaty will die, Schedy be born!

But if it works as I think (the x:-command overrrides all the v:-commands), why is the “next” part even needed?

The Next() is returned in case you’re not in vacation mode and then causes the next rule to be evaluated. This is the regular inline if-else syntax of Python.

EDIT: If you want to see how your particular schedule is evaluated, you can add the debug: true setting and observe the log, once when vacation mode is on and once when it’s off. You can spot the schedule evaluation part easily, it’s all these indented/nested lines.

EDIT 2: Here is the relevant part about Next and the other control result types.

Hi,

I’m moving from FHEM to Home Assistant. Thermostat is a Homematic HM-CC-TC named climate.az_ht_heizung (of course there are some more). Raspberrymatic .OVA with HM-CFG-USB is used to communicate with the Homematic devices. The thermostat is visible in Lovelace, the temperature is reported and can be changed there. No problems so far.

I’ve setup schedy with the following configuration:

schedy_heating:
  module: hass_apps_loader
  class: SchedyApp

  actor_type: thermostat
  off_temp: 6
  supports_hvac_modes: false

  schedule_append:
  - value: 17

  rooms:
    az:
      actors:
        climate.az_ht_heizung:
      schedule:
      - value: 22
        rules:
        - weekdays: 1-4,7
          start: "10:00"
          end: "21:30"
        - weekdays: 5,6
          start: "10:00"
          end: "22:00"

However this doesn’t work. AppDaemon doesn’t report anything unusual:

2019-12-24 11:02:09.784663 INFO AppDaemon: Initializing app schedy_heating using class SchedyApp from module hass_apps_loader
2019-12-24 11:02:09.788188 INFO schedy_heating: *** Welcome to schedy 0.7.0, running on AppDaemon 3.0.5.
2019-12-24 11:02:09.791268 INFO schedy_heating: *** 
2019-12-24 11:02:09.794351 INFO schedy_heating: *** This is an app from the hass-apps package.
2019-12-24 11:02:09.797472 INFO schedy_heating: ***   DOCS: https://hass-apps.readthedocs.io/en/stable/
2019-12-24 11:02:09.800674 INFO schedy_heating: *** 
2019-12-24 11:02:09.803663 INFO schedy_heating: *** You like this app, want to honor the effort put into
2019-12-24 11:02:09.806855 INFO schedy_heating: *** it, ensure continuous development and support?
2019-12-24 11:02:09.810709 INFO schedy_heating: *** Then please consider making a donation.
2019-12-24 11:02:09.813577 INFO schedy_heating: ***   DONATE: https://hass-apps.readthedocs.io/en/stable/#donations
2019-12-24 11:02:09.816444 INFO schedy_heating: *** Thank you very much and enjoy schedy!
2019-12-24 11:02:09.819166 INFO schedy_heating: *** 
2019-12-24 11:02:09.829094 INFO schedy_heating: --- Actor type is: 'thermostat'
2019-12-24 11:02:09.854293 INFO schedy_heating: --> [R:az] [A:climate.az_ht_heizung] Received value of 12.0��.
2019-12-24 11:02:09.941236 INFO schedy_heating: *** Initialization done.
2019-12-24 11:02:10.946110 INFO AppDaemon: Reading config
2019-12-24 11:02:10.966331 INFO AppDaemon: /config/appdaemon/apps/schedy_heating.yaml added or modified

But there are some errors in the HomeAssistant Log:

2019-12-24 11:01:50 ERROR (SyncWorker_1) [pyhomematic.devicetypes.generic] HMDevice._getNodeData: SET_TEMPERATURE not found in {'SETPOINT': [2]}
2019-12-24 11:01:50 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 40, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 73, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 136, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 123, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/api/__init__.py", line 355, in post
    domain, service, data, True, self.context(request)
  File "/usr/src/homeassistant/homeassistant/core.py", line 1235, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 205, in handle_service
    self._platforms.values(), func, call, service_name, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 336, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 358, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 405, in async_set_hvac_mode
    await self.hass.async_add_executor_job(self.set_hvac_mode, hvac_mode)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/homematic/climate.py", line 149, in set_hvac_mode
    self._hmdevice.MODE = self._hmdevice.MANU_MODE
  File "/usr/local/lib/python3.7/site-packages/pyhomematic/devicetypes/thermostats.py", line 73, in MODE
    self.actionNodeData(mode, set_data)
  File "/usr/local/lib/python3.7/site-packages/pyhomematic/devicetypes/generic.py", line 346, in actionNodeData
    return self._setNodeData(name, self.ACTIONNODE, data, channel)
  File "/usr/local/lib/python3.7/site-packages/pyhomematic/devicetypes/generic.py", line 361, in _setNodeData
    (name, data, nodeChannel))
TypeError: %i format: a number is required, not NoneType

What’s wrong here?

Best regards
Jens

Hi @breti

Schedy calls the climate.set_temperature service with {"entity_id": "...", "temperature": 22}. Try calling that service with the correct entity id from the Home Assistant dev tools. If that doesn’t work, Schedy won’t work either. Additionally, try to restart Home Assistant so that Schedy forgets its stored state.

EDIT: If this service call doesn’t work, there probably is something wrong with the homematic component.

Hi @roschi,

thanks a lot!

I’ve tried calling the service with these parameters:

Dienst:
climate.set_temperature

Entität:
climate.az_ht_heizung

Servicedaten (YAML, optional)
entity_id: climate.az_ht_heizung
temperature: 20

It works just fine, it takes some minutes but temperature changed from 22 to 20 °C. No message in the log.

I’ve restarted HA, same messages as before:

2019-12-24 14:08:18 ERROR (SyncWorker_17) [pyhomematic.devicetypes.generic] HMDevice._getNodeData: SET_TEMPERATURE not found in {'SETPOINT': [2]}
2019-12-24 14:08:18 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 40, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 73, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 136, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 123, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/api/__init__.py", line 355, in post
    domain, service, data, True, self.context(request)
  File "/usr/src/homeassistant/homeassistant/core.py", line 1235, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 205, in handle_service
    self._platforms.values(), func, call, service_name, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 336, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 358, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 405, in async_set_hvac_mode
    await self.hass.async_add_executor_job(self.set_hvac_mode, hvac_mode)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/homematic/climate.py", line 149, in set_hvac_mode
    self._hmdevice.MODE = self._hmdevice.MANU_MODE
  File "/usr/local/lib/python3.7/site-packages/pyhomematic/devicetypes/thermostats.py", line 73, in MODE
    self.actionNodeData(mode, set_data)
  File "/usr/local/lib/python3.7/site-packages/pyhomematic/devicetypes/generic.py", line 346, in actionNodeData
    return self._setNodeData(name, self.ACTIONNODE, data, channel)
  File "/usr/local/lib/python3.7/site-packages/pyhomematic/devicetypes/generic.py", line 361, in _setNodeData
    (name, data, nodeChannel))
TypeError: %i format: a number is required, not NoneType

EDIT:

Just noticed that clicking the flame or the power icon in lovelace

grafik

triggers this message:

Fehler beim Aufrufen des Service climate/set_hvac_mode. %i format: a number is required, not NoneType	

Seems to be related? Do you know where to report this?

Hmm, you set supports_hvac_modes to false, so Schedy never touches the HVAC mode, just the temperature. Could you try to change the target temperature in your schedule back and forth, e.g. between 20 and 22? AppDaemon will restart the app automatically and you should see the new value being set in Schedy’s log. Schedy will also tell you when the new value has been received back from the thermostat or when it re-sends the value due to missing response.

EDIT:

Seems to be related? Do you know where to report this?

I’m not sure, maybe open an issue for Home Assistant on GitHub?

Ah, found it!

You put off_temp and supports_hvac_modes into top level Schedy config, however they are actor specific settings and should go into an actor template, e.g. into the default template:

actor_templates:
  default:
    ...

Otherwise they just have no effect. I’ll try to improve config validation so that it spits out an error in such cases.

Aaaaaah… I’m very sorry! I’ve adjusted the configuration accordingly and get back to you soon…

Many thanks!

Looks good! :+1:

Configuration:

schedy_heating:
  module: hass_apps_loader
  class: SchedyApp

  actor_type: thermostat
  actor_templates:
    default:
      off_temp: 6
      supports_hvac_modes: false

  schedule_append:
  - value: 17

  rooms:
    az:
      actors:
        climate.az_ht_heizung:
      schedule:
        - v: 22.0
          start: "7:00"
          end: "15:40"
        - v: 23.0
          start: "15:40"
          end: "15:50"
        - v: 24.0
          start: "15:50"
          end: "16:00"
        - v: 22.0
          start: "16:00"
          end: "16:10"
        - v: 23.0
          start: "16:10"
          end: "16:20"
        - v: 24.0
          start: "16:20"
          end: "16:30"
        - v: 22.0
          start: "16:30"
          end: "22:00"

Log:

2019-12-24 15:37:31.871973 INFO schedy_heating: --> [R:az] [A:climate.az_ht_heizung] Received value of 22.0��.
2019-12-24 15:40:00.151332 INFO schedy_heating: <-- [R:az] Value set to 23.0��.  [scheduled]
2019-12-24 15:40:30.005255 WARNING schedy_heating: !!! [R:az] [A:climate.az_ht_heizung] Re-sending value due to missing confirmation.
2019-12-24 15:41:00.004878 WARNING schedy_heating: !!! [R:az] [A:climate.az_ht_heizung] Re-sending value due to missing confirmation.
2019-12-24 15:41:30.005325 WARNING schedy_heating: !!! [R:az] [A:climate.az_ht_heizung] Re-sending value due to missing confirmation.
2019-12-24 15:42:00.004984 WARNING schedy_heating: !!! [R:az] [A:climate.az_ht_heizung] Re-sending value due to missing confirmation.
2019-12-24 15:42:30.004568 WARNING schedy_heating: !!! [R:az] [A:climate.az_ht_heizung] Re-sending value due to missing confirmation.
2019-12-24 15:42:31.875841 INFO schedy_heating: --> [R:az] [A:climate.az_ht_heizung] Received value of 23.0��.
2019-12-24 15:50:00.150500 INFO schedy_heating: <-- [R:az] Value set to 24.0��.  [scheduled]
2019-12-24 15:50:30.003979 WARNING schedy_heating: !!! [R:az] [A:climate.az_ht_heizung] Re-sending value due to missing confirmation.
2019-12-24 15:51:00.005658 WARNING schedy_heating: !!! [R:az] [A:climate.az_ht_heizung] Re-sending value due to missing confirmation.
2019-12-24 15:51:30.004735 WARNING schedy_heating: !!! [R:az] [A:climate.az_ht_heizung] Re-sending value due to missing confirmation.
2019-12-24 15:52:00.005143 WARNING schedy_heating: !!! [R:az] [A:climate.az_ht_heizung] Re-sending value due to missing confirmation.
2019-12-24 15:52:30.005225 WARNING schedy_heating: !!! [R:az] [A:climate.az_ht_heizung] Re-sending value due to missing confirmation.
2019-12-24 15:52:51.147848 INFO schedy_heating: --> [R:az] [A:climate.az_ht_heizung] Received value of 24.0��.
2019-12-24 16:00:00.151578 INFO schedy_heating: <-- [R:az] Value set to 22.0��.  [scheduled]
2019-12-24 16:00:28.170609 INFO schedy_heating: --> [R:az] [A:climate.az_ht_heizung] Received value of 22.0��.
2019-12-24 16:10:00.184474 INFO schedy_heating: <-- [R:az] Value set to 23.0��.  [scheduled]
2019-12-24 16:10:07.681761 INFO schedy_heating: --> [R:az] [A:climate.az_ht_heizung] Received value of 23.0��.
2019-12-24 16:20:00.150738 INFO schedy_heating: <-- [R:az] Value set to 24.0��.  [scheduled]
2019-12-24 16:20:17.921359 INFO schedy_heating: --> [R:az] [A:climate.az_ht_heizung] Received value of 24.0��.
2019-12-24 16:30:00.150438 INFO schedy_heating: <-- [R:az] Value set to 22.0��.  [scheduled]
2019-12-24 16:30:30.005130 WARNING schedy_heating: !!! [R:az] [A:climate.az_ht_heizung] Re-sending value due to missing confirmation.
2019-12-24 16:30:53.186031 INFO schedy_heating: --> [R:az] [A:climate.az_ht_heizung] Received value of 22.0��.

There’s a warning:

2019-12-24 15:36:13.887121 WARNING schedy_heating: !!! [R:az] [A:climate.az_ht_heizung] HVAC mode support has been disabled, but the modes ['heat', 'off'] seem to be supported. Maybe disabling it was a mistake?

So we’ve confirmed there’s an issue with the homematic integration of the HM-CC-TC component? It reports HVAC modes “off” and “heat” are supported, but it doesn’t really support them, right?

I’m sure it doesn’t support anything but “heat”. There’s no “off” setting even in Homematic CCU GUI.

The log looks good, although your thermostats react a bit delayed sometimes. But that’s probably due to the way the homematic gear works. The warning about the HVAC modes can safely be ignored.

So we’ve confirmed there’s an issue with the homematic integration of the HM-CC-TC component? It reports HVAC modes “off” and “heat” are supported, but it doesn’t really support them, right?

It reports these two modes being supported, which also causes the power and flame icons to be displayed in HA’s GUI, maybe you could report this to the ones who created the homematic integration for HA, but I don’t exactly know who’s responsible for it.

Wish you all the best and Frohe Weihnachten :slight_smile:

Hello Community
actual i m trying to setup Schedy but i have some troubles in getting it running.
My config looks like this

Bad:
      actors:
        climate.bd_heizung:
      schedule:
      - x: "Add(-4) if is_on('input_boolean.abwesenheit') else Next()"
      - v: 21
        rules:
        - weekdays: 1-7
          rules:
          - rules:
            - x: "Next() if heating_mode() == 'Zentralheizung' else Break()"
            - { start: "04:00", end: "21:30" }
          - rules:
            - x: "Next() if heating_mode() == 'Kachelofenbetrieb' else Break()"
            - { start: "04:00", end: "21:30" }
          - rules:
            - x: "Next() if heating_mode() == 'Urlaub' else Break()"
            - x: "Add(-4)"
            - { start: "00:00", end: "23:59" }
          - rules:
            - x: "Next() if heating_mode() == 'AUS' else Break()"

how can i raise the temperature every evening 18:30 to 23 degrees? but only if

input_boolean.abwesenheit == off 

or are there more mistakes in this config which i should improve?
frohe Weihnachten

Br David

Hi @Dreamoffice

how can i raise the temperature every evening 18:30 to 23 degrees? but only if

You already have a similar rule:

- x: "Add(-4) if is_on('input_boolean.abwesenheit') else Next()"

Just use that one as template and add start/end constraints.

or are there more mistakes in this config which i should improve?

Looks good so far, even though you could handle Zentralheizung and Kachelofenbetrieb with the same sub-schedule (if state(...) in ("foo", "bar",)) since times are all the same for both.

Additionally, the - { start: "00:00", end: "23:59" } could be replaced with just an empty dictionary - { }, which is perfectly valid and would fill the one minute long gap before midnight. Or you explicitly set "00:00" for both start and end, if you prefer this more explicit format.

frohe Weihnachten

Danke, ebenso!

Best regards
Robert

Hi Robert
thanks for your quick answer. but actually i have no glue how to do this:

could you please give me an example?

Thanks David

Sure, just limit the lifetime of the rule like you did with all your other rules, too, like so:

- x: "Add(12345) if is_off('input_boolean.abwesenheit') else Next()"
  start: "18:30"
  end: "21:00"

Hi Robert
i added now the following like this

Bad:
      actors:
        climate.bd_heizung:
      schedule:
      - x: "Add(-4) if is_on('input_boolean.abwesenheit') else Next()"
      - x: "Add(2) if is_off('input_boolean.abwesenheit') else Next()"
        start: "18:30"
        end: "21:00"
      - v: 21
        rules:
        - weekdays: 1-7
          rules:
          - rules:
            - x: "Next() if heating_mode() == 'Zentralheizung' else Break()"
            - { start: "04:00", end: "21:30" }
          - rules:
            - x: "Next() if heating_mode() == 'Kachelofenbetrieb' else Break()"
            - { start: "04:00", end: "21:30" }
          - rules:
            - x: "Next() if heating_mode() == 'Urlaub' else Break()"
            - { }
          - rules:
            - x: "Next() if heating_mode() == 'AUS' else Break()"

the part with the same sub-schedule i don t understand how to set it up.

Looks good.

the part with the same sub-schedule i don t understand how to set it up.

The point is that you’re using the exact same schedule rules for both Kachelofenbetrieb and Zentralheizung. That’s why you could handle both modes with one single sub-schedule. I gave you the Python if-syntax you’d have to use to check whether your input_select is set to one of two given values. Just apply it to the Kachelofen or the Zentralheizung sub-schedule and remove the other one. Then you can use one sub-schedule for both modes and don’t have to repeat yourself, given that this is what you want and the two modes should share the same schedule.

ok thanks.
i will try :slight_smile:

i will try :slight_smile:

Cool, don’t hesitate to ask again if you’ve got difficulties.

no glue
:frowning:

If you send me your phone number by mail (click on the author name listed in the metadata section on this page), I’ll call you back and can try to help you out quickly.