Heaty - a flexible heating control, facilitating schedules and manual intervention

operation_mode has to be an attribute reflecting the operation mode currently in use. You should use the developer area in HA to check the climate entity’s attributes and verify all are there.

That’s weird. how can I check an attribute which is not there? Could you read the python script from this custom component? I have a snippet here:

import asyncio
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
import homeassistant.components.remote as remote

from homeassistant.components.climate import (ClimateDevice, PLATFORM_SCHEMA,
                                              STATE_ON, STATE_OFF, STATE_IDLE, STATE_HEAT, STATE_COOL, STATE_AUTO,
                                              ATTR_OPERATION_MODE, ATTR_OPERATION_LIST, ATTR_MAX_TEMP, ATTR_MIN_TEMP,
                                              ATTR_CURRENT_TEMPERATURE, ATTR_TARGET_TEMP_STEP, ATTR_FAN_MODE,
                                              ATTR_FAN_LIST, ATTR_AWAY_MODE,
                                              SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_FAN_MODE,
                                              SUPPORT_ON_OFF, SUPPORT_AWAY_MODE)
from homeassistant.const import (ATTR_UNIT_OF_MEASUREMENT, ATTR_TEMPERATURE, CONF_NAME, CONF_CUSTOMIZE)
from homeassistant.helpers.event import async_track_state_change
from homeassistant.helpers.restore_state import async_get_last_state
from homeassistant.core import callback
from voluptuous import ALLOW_EXTRA

_LOGGER = logging.getLogger(__name__)

The strange thing is that I see ATTR_OPERATION_MODE in from homeassistant.components.climate import

I don’t know. Just importing something doesn’t mean actually using it. Head over to the developer area in HA and check the attributes of your climate entity. As long as there is no proper operation_mode and temperature, there is nothing Heaty can do. Ask the developers of the climate platform you’re using if unsure.

ok then I dunno how he impleneted this component :slight_smile: service call operation_mode works well so far in automations but indeed they are not expsed in attributes… I’ll ask the dev to adapt this.

temperature is well there. thanks so far… and sorry to keep you busy with this :slight_smile:

I just found also another snipped which clearly shows me that operation_mode is used in attributes:

if state is not None:
            self._current_operation = state.attributes.get(ATTR_OPERATION_MODE, self._current_operation)
            self._target_temperature = state.attributes.get(ATTR_TEMPERATURE, self._target_temperature)
            self._enabled_flags = state.attributes.get(ATTR_SUPPORTED_FEATURES, self._enabled_flags)
            self._current_fan_mode = state.attributes.get(ATTR_FAN_MODE, self._current_fan_mode)
            self._on = state.attributes.get(ATTR_POWER, STATE_OFF) == STATE_ON
            self._away = state.attributes.get(ATTR_AWAY_MODE, STATE_OFF) == STATE_ON

I will have to check when i am at home.

This just shows that it tries to use the operation_mode attribute as a fallback to learn about it’s own state, not that it ever set’s the attribute.

Servus Robert Schindler…danke erst einmal für deine Hilfe. Ich habe das Problem dass das Attribut Operation_mode nicht als Attribute bei der Komponente ausgegeben wird beim Dev der custom Komponente bekannt gemacht…muss erstmal auf Antwort warten da ich nicht weiß wie man sowas behebt .

Thanks so far and I’ll revert as soon. As I git a Feedback

Yes, that’s something to be done in the custom component. As a last resort, you could disable operation mode support in Heaty and only rely on temperatures. You’d then of course need to set off_temp for the thermostat as well and always let it in the desired heating mode.

The component is strange …it also has a power attribute… I have to turn it manually on and then I get the operation modes … I’ll have to talk to the component dev to know how we can in life this … I use all the same devices (Xiaomi ir blasters) and some have operation mode off some Off with capital letter … that’s weirdo as I setup each component the same way . Fir the moment I have less time to debig and watch at this …renovating my new bathroom has priority but once it’s finished I’ll have to setup Hass from scratch as also my leave network start to bug. I’ll revert asap I’ll have finished my bathroom :wink: thanks so far

thats quite normal.
you cant change the mode from a device that is off.
the same as with lights. you cant change the color from a light that is off.

I have some automations running which just set operation mode .I guess this fires on directly? I’ve some Xiaomi devices which just work fine …some not. Attributes have capital or small letters with “off” and “Off”

As I said I’ll have to stick into it once my work is done and the server has its place .at the moment it’s jus true mess and working on it is a pita. Thanks so far guys to help me out here .

Hi all,

I’m just cross-linking to the new thread about Schedy.

Thanks for using Heaty.

Best regards
Robert

Hi,
first of all I want to thank roschi for this great project!
Nice to see that you want to push it to the next level allowing schedules for more home assistant components!

Sadly, I discovered heaty only a week ago and since than I still haven’t figured out how to solve the errors I run into on my home assistant server. :frowning:

Hopefully someone can help me solve these errors so that I can finally use heaty.

My home assistant is based on hassbian running on a raspberry pi 3. The TLS certificate used for home assistant is signed by my own ca. The self-signed root certificate of the ca is imported to the system’s ca-certificates.

I installed appdaemon using hassbian-scripts and hass-apps into the same virtual environment as appdaemon.
First I ran into the same problem described here, but after removing the entry from my config the errors described below showed up.
HADashboard is working so I don’t think appdaemon itself is the problem. Also adding the line

cert_verify: False

to my appdaemon.yaml does not change anything.

These are my configuration and log files:
appdeamon.yaml:

secrets: /home/homeassistant/.homeassistant/secrets.yaml
log:
  accessfile: /home/homeassistant/appdaemon/logs/access.log
  errorfile: /home/homeassistant/appdaemon/logs/error.log
  logfile: /home/homeassistant/appdaemon/logs/appdaemon.log
  log_generations: 3
  log_size: 1000000
appdaemon:
  threads: 10
  plugins:
    HASS:
      type: hass
      ha_url: 'https://192.168.1.2:8123'
      ha_key: !secret http_password
      cert_path: '/etc/ssl/certs/ca-certificates.crt'
      #cert_verify: False
hadashboard:
  dash_url: http://192.168.1.2:5050
  dash_ssl_certificate: !secret ssl_certificate
  dash_ssl_key: !secret ssl_key
  dash_password: !secret dash_password

apps.yaml:

heaty_full:
  module: hass_apps_loader
  class: HeatyApp

  thermostat_defaults:
    # These two settings can be used to tweak the names of the
    # operation modes.
    # (default: heat)
    opmode_heat: manual
    # (default: "off")
    opmode_off: "away"

  window_sensor_defaults:

  schedule_prepend:

  schedule_append:

  schedule_snippets:

  rooms:

    wohnzimmer:
      thermostats:
        climate.wohnzimmer_thermostat:
      schedule:
      - { temp: 22, start: "08:00", end: "22:00", weekdays: "1,2,3,4,5,6,7" }
      - { temp: 16 }

log:

2018-10-03 14:17:18.909181 INFO AppDaemon Version 3.0.1 starting
2018-10-03 14:17:18.929449 INFO Configuration read from: /home/homeassistant/appdaemon/appdaemon.yaml
2018-10-03 14:17:18.935559 INFO AppDaemon: Starting Apps
2018-10-03 14:17:18.937332 WARNING config_dir: /home exists, but is not writeable, owner: root
2018-10-03 14:17:18.945983 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2018-10-03 14:17:19.024541 INFO AppDaemon: HASS: HASS Plugin Initializing
2018-10-03 14:17:19.025841 INFO AppDaemon: HASS: HASS Plugin initialization complete
2018-10-03 14:17:19.026842 INFO Starting Dashboards
2018-10-03 14:17:19.075131 INFO API is disabled
2018-10-03 14:17:19.499291 INFO AppDaemon: HASS: Connected to Home Assistant 0.78.3
2018-10-03 14:17:19.785281 INFO AppDaemon: Got initial state from namespace default
2018-10-03 14:17:21.684713 INFO AppDaemon: Reading config
2018-10-03 14:17:21.731799 INFO AppDaemon: /home/homeassistant/appdaemon/apps/apps.yaml added or modified
2018-10-03 14:17:21.732824 INFO AppDaemon: /home/homeassistant/appdaemon/apps/apps.yaml added or modified
2018-10-03 14:17:21.733970 INFO AppDaemon: App 'heaty_full' added
2018-10-03 14:17:21.735070 INFO AppDaemon: Adding /home/homeassistant/appdaemon/apps to module import path
2018-10-03 14:17:21.736724 INFO AppDaemon: Loading App Module: /home/homeassistant/appdaemon/apps/hass_apps_loader.py
2018-10-03 14:17:21.754195 INFO AppDaemon: Initializing app heaty_full using class HeatyApp from module hass_apps_loader
2018-10-03 14:17:22.323078 INFO heaty_full: *** Welcome to heaty (version 0.16.0)!
2018-10-03 14:17:22.328689 INFO heaty_full: ***
2018-10-03 14:17:22.333095 INFO heaty_full: *** This is an app from the hass-apps package.
2018-10-03 14:17:22.337253 INFO heaty_full: ***   DOCS: https://hass-apps.readthedocs.io/en/stable/
2018-10-03 14:17:22.341628 INFO heaty_full: ***
2018-10-03 14:17:22.345913 INFO heaty_full: *** If you like this app and want to honor the effort put into it,
2018-10-03 14:17:22.350088 INFO heaty_full: *** please consider a donation.
2018-10-03 14:17:22.354579 INFO heaty_full: ***   DONATE: https://hass-apps.readthedocs.io/en/stable/#donations
2018-10-03 14:17:22.358928 INFO heaty_full: *** Thank you very much and enjoy heaty!
2018-10-03 14:17:22.363138 INFO heaty_full: ***
2018-10-03 14:17:22.377796 INFO heaty_full: --- Heaty id is: 'default'
2018-10-03 14:17:22.412057 ERROR heaty_full: !!! [R:wohnzimmer] [T:climate.wohnzimmer_thermostat] Unknown operation mode, ignoring thermostat.
2018-10-03 14:17:22.771094 INFO AppDaemon: App initialization complete

errorlog:

2018-10-03 14:17:22.741032 WARNING AppDaemon: ------------------------------------------------------------
2018-10-03 14:17:22.742376 WARNING AppDaemon: Unexpected error running initialize() for heaty_full
2018-10-03 14:17:22.743074 WARNING AppDaemon: ------------------------------------------------------------
2018-10-03 14:17:22.758274 WARNING AppDaemon: Traceback (most recent call last):
  File "/srv/appdaemon/lib/python3.5/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/srv/appdaemon/lib/python3.5/site-packages/urllib3/connectionpool.py", line 343, in _make_request
    self._validate_conn(conn)
  File "/srv/appdaemon/lib/python3.5/site-packages/urllib3/connectionpool.py", line 849, in _validate_conn
    conn.connect()
  File "/srv/appdaemon/lib/python3.5/site-packages/urllib3/connection.py", line 356, in connect
    ssl_context=context)
  File "/srv/appdaemon/lib/python3.5/site-packages/urllib3/util/ssl_.py", line 372, in ssl_wrap_socket
    return context.wrap_socket(sock)
  File "/usr/lib/python3.5/ssl.py", line 385, in wrap_socket
    _context=self)
  File "/usr/lib/python3.5/ssl.py", line 760, in __init__
    self.do_handshake()
  File "/usr/lib/python3.5/ssl.py", line 996, in do_handshake
    self._sslobj.do_handshake()
  File "/usr/lib/python3.5/ssl.py", line 641, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:720)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/appdaemon/lib/python3.5/site-packages/requests/adapters.py", line 445, in send
    timeout=timeout
  File "/srv/appdaemon/lib/python3.5/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/srv/appdaemon/lib/python3.5/site-packages/urllib3/util/retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='192.168.1.2', port=8123): Max retries exceeded with url: /api/services/climate/set_operation_mode (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:720)'),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/appdaemon/lib/python3.5/site-packages/appdaemon/appdaemon.py", line 1575, in init_object
    init()
  File "/srv/appdaemon/lib/python3.5/site-packages/hass_apps/common.py", line 91, in initialize
    self.initialize_inner()
  File "/srv/appdaemon/lib/python3.5/site-packages/hass_apps/heaty/app.py", line 93, in initialize_inner
    room.apply_schedule()
  File "/srv/appdaemon/lib/python3.5/site-packages/hass_apps/heaty/room.py", line 320, in apply_schedule
    self.set_temp(temp, scheduled=True, force_resend=force_resend)
  File "/srv/appdaemon/lib/python3.5/site-packages/hass_apps/heaty/room.py", line 118, in set_temp
    result = therm.set_temp(target_temp, force_resend=force_resend)
  File "/srv/appdaemon/lib/python3.5/site-packages/hass_apps/heaty/thermostat.py", line 309, in set_temp
    "temp": temp,
  File "/srv/appdaemon/lib/python3.5/site-packages/hass_apps/heaty/thermostat.py", line 342, in _set_temp_resend_cb
    self.app.call_service(opmode_service, **attrs)
  File "/srv/appdaemon/lib/python3.5/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
    return func(*args, **kwargs)
  File "/srv/appdaemon/lib/python3.5/site-packages/appdaemon/plugins/hass/hassapi.py", line 455, in call_service
    apiurl, headers=headers, json=kwargs, verify=certpath
  File "/srv/appdaemon/lib/python3.5/site-packages/requests/api.py", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/srv/appdaemon/lib/python3.5/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/srv/appdaemon/lib/python3.5/site-packages/requests/sessions.py", line 512, in request
    resp = self.send(prep, **send_kwargs)
  File "/srv/appdaemon/lib/python3.5/site-packages/requests/sessions.py", line 622, in send
    r = adapter.send(request, **kwargs)
  File "/srv/appdaemon/lib/python3.5/site-packages/requests/adapters.py", line 511, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='192.168.1.2', port=8123): Max retries exceeded with url: /api/services/climate/set_operation_mode (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:720)'),))

2018-10-03 14:17:22.759554 WARNING AppDaemon: ------------------------------------------------------------

Every help is appreciated! Thank you! :slight_smile:

why are you talking about certs etc.?
appdaemon is correctly up and running so dont look there for your problem.

you can find your problem in your log:

2018-10-03 14:17:22.412057 ERROR heaty_full: !!! [R:wohnzimmer] [T:climate.wohnzimmer_thermostat] Unknown operation mode, ignoring thermostat.

edit sorry i didnt see the error correct. ill take a closer look at that now.

Thank you for your answer!

I should have mentioned that I am aware of this error, sorry. :frowning:

I thought as the appdeamon log is talking about a ssl error the heaty error is unreleated to this and I planned to fix this after the ssl bug is fixed.

strange that you get an ssl error when AD seems to be running and the dashboard is working.

the ssl error is an error in your connection between AD and HA.
so with that problem nothing should work.

my advice in cases like this is every time:
install a proxy server like nginx for your connection outside and delete ssl setup in HA
then connect AD to HA localy without ssl

I would like to keep everything in home assistant itself including TLS, but if there is no other option to solve my problems I will use nginx.

I should have enough time to set up a reverse proxy on the weekend and hopefully this solves my problem. :slight_smile:

Again thank you for your help!

Hi there,
even with Schedy just around the corner I’d love to play around with Heaty to understand the basics.

I’m running Hass.io on a raspberry pi 3 and already fail installing / running heaty. I gave my best following the instructions but it seems like the “easy approach” doesn’t work :slight_smile:

Let me summarize what I did and you can most probably easily spot a silly mistake:
-I installed AppDeamon from the Hassio integrated “Install Add Ons” Menu
-I downloaded the Hass Apps (hass-apps-master) from git
-I copied the hass_apps folder into the AppDeamin/Apps folder: /config/appdaemon/apps/hass_apps
-Then I copied the hass_apps_loader.py into the apps folder and added the heaty minimal example to the apps.yaml in the apps folder.
Apps.yaml

heaty_minimal:
  # Obligatory settings that tell appdaemon where to find the app.
  # You shouldn't need to change these two.
  module: hass_apps_loader
  class: HeatyApp

  rooms:

    # Define such a block for each room you want to control.
    living:
      thermostats:
        climate.eurotronic_eur_spiritz_wall_radiator_thermostat_heat_9:
        climate.eurotronic_eur_spiritz_wall_radiator_thermostat_heat:
      schedule:
      # From Monday to Friday, set temperature to 20.5 °C from 7.45 am
      # to 10.00 pm.
      - { temp: 20.5, start: "07:45", end: "22:00", weekdays: 1-5 }
      # On weekends, set temperature to 20.5 °C from 8.15 am to 11.30 pm.
      - { temp: 20.5, start: "08:15", end: "23:30", weekdays: "6,7" }
      # At all other times, set temperature to 16 °C.
      - { temp: 16 }

Log:

2018-10-03 18:18:36.272994 INFO AppDaemon: Initializing app heaty_minimal using class HeatyApp from module hass_apps_loader
2018-10-03 18:18:36.300693 WARNING AppDaemon: ------------------------------------------------------------
2018-10-03 18:18:36.301962 WARNING AppDaemon: Unexpected error initializing app: heaty_minimal:
2018-10-03 18:18:36.304669 WARNING AppDaemon: ------------------------------------------------------------
2018-10-03 18:18:36.312081 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 2040, in check_app_updates
self.init_object(app)
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 1565, in init_object
self, name, self.logger, self.error, app_args, self.config, self.app_config, self.global_vars
  File "/config/appdaemon/apps/hass_apps/loader.py", line 28, in _proxy_loader
app_mod = _import_app_module(app_package)
  File "/config/appdaemon/apps/hass_apps/loader.py", line 24, in _import_app_module
return importlib.import_module(mod_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/appdaemon/apps/hass_apps/heaty/app.py", line 18, in <module>
from . import __version__, config, expr, util
  File "/config/appdaemon/apps/hass_apps/heaty/config.py", line 10, in <module>
from .room import Room
  File "/config/appdaemon/apps/hass_apps/heaty/room.py", line 16, in <module>
from .window_sensor import WindowSensor
  File "/config/appdaemon/apps/hass_apps/heaty/window_sensor.py", line 10, in <module>
import observable
ModuleNotFoundError: No module named 'observable'
2018-10-03 18:18:36.313315 WARNING AppDaemon: ------------------------------------------------------------
2018-10-03 18:39:58.070994 INFO AppDaemon: Reading config
2018-10-03 18:39:58.173935 WARNING AppDaemon: ------------------------------------------------------------
2018-10-03 18:39:58.175109 WARNING AppDaemon: Unexpected error loading config file: /config/appdaemon/apps/._apps.yaml
2018-10-03 18:39:58.176912 WARNING AppDaemon: ------------------------------------------------------------
2018-10-03 18:39:58.180496 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 1671, in read_config_file
config_file_contents = yamlfd.read()
  File "/usr/lib/python3.6/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 37: invalid start byte
2018-10-03 18:39:58.181566 WARNING AppDaemon: ------------------------------------------------------------
2018-10-03 18:39:58.182670 WARNING AppDaemon: File '/config/appdaemon/apps/._apps.yaml' invalid structure - ignoring
2018-10-03 18:39:58.186649 INFO AppDaemon: /config/appdaemon/apps/._apps.yaml added or modified
2018-10-03 19:00:43.765716 INFO AppDaemon: Reloading Module: /config/appdaemon/apps/hass_apps/heaty/._config.py
2018-10-03 19:00:43.767218 WARNING AppDaemon: No app description found for: ._config - ignoring
2018-10-03 19:21:20.163216 INFO AppDaemon: Reading config
2018-10-03 19:21:20.216792 WARNING AppDaemon: ------------------------------------------------------------
2018-10-03 19:21:20.217349 WARNING AppDaemon: Unexpected error loading config file: /config/appdaemon/apps/._apps.yaml
2018-10-03 19:21:20.217910 WARNING AppDaemon: ------------------------------------------------------------
2018-10-03 19:21:20.219341 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 1671, in read_config_file
config_file_contents = yamlfd.read()
  File "/usr/lib/python3.6/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 37: invalid start byte
2018-10-03 19:21:20.219934 WARNING AppDaemon: ------------------------------------------------------------
2018-10-03 19:21:20.221100 WARNING AppDaemon: File '/config/appdaemon/apps/._apps.yaml' invalid structure - ignoring
2018-10-03 19:21:20.223460 INFO AppDaemon: /config/appdaemon/apps/._apps.yaml added or modified

What did I miss?

@Nigggo Please have a look at the docs for the development version: https://hass-apps.readthedocs.io/en/latest/getting-started.html#a-note-for-hass-io-users

@Gunna That’s an issue with the connection between HA and AppDaemon, nothing Heaty-related. Sorry, but I can’t help you with that.

BTW, I use stunnel4 for the SSL proxying, very simple to set up and less overhead than nginx.

@roschi thank you so much! I must have ended up on an old version of the doc or missed the part about observable. Adding observable to the apps folder did the trick. Now I can keep practicing with the setup :slight_smile