There are few ways to install AppDaemon (as Hass.io addon, via pip, via pip in venv). I don’t use Hass.io so I can’t help you.
Ah, you meant it like that…
Hmm, and the other way with automations you have to have the sensors and thermostat with the same name or…?
Yes, you have to have entities with similar names eg. climate.thermostat_kitchen
and sensor.temperature_kitchen
to use python_script
version.
okey, will try that instead…
would it be possible to get some more detailed instructions?
for me it is not clear at all how to install and how to set up at the end
for example:
You can install this script via HACS or just download thermostat_update.py
file and save it in /config/python_scripts
folder.
both options are not working
Both options are working. With HACS you can install script from Home Assistant UI. There is readme file in repository and in HACS with configuration example. Ask a specific question and I’ll try to help.
Ok, so i copy that file to that specific folder.
Than what?
Is this “configuration” to be put in configuration.yaml or automatisation.yaml? (Looks more like an automisation than a configuration. If it needs to be in automatisation please rename automatisation and not configuration, thid is missleading)
Furthermure: if this is working, are the thermostats than working with the google assistant? (Right now they are visible but everything is greyed out and i can’t set a setpoint temp)
in conifgurtation.yaml, i get an error when checking the config in the HA UI.
so I have put it in the automtions.yaml. That’s fine, checking the log, I see the following:
## Log Details (ERROR)
Sun Sep 22 2019 15:55:41 GMT+0200 (Mitteleuropäische Sommerzeit)
Error while executing automation automation.update_thermostats. Service not found for call_service at pos 1: Unable to find service python_script/thermostat_update
it is installed via HACS!!
and here the error code if working with the app deamon
[19:08:07] INFO: Starting AppDaemon...
2019-09-22 19:08:09.533036 INFO AppDaemon Version 3.0.5 starting
2019-09-22 19:08:09.533542 INFO Configuration read from: /config/appdaemon/appdaemon.yaml
2019-09-22 19:08:09.536344 INFO AppDaemon: Starting Apps
2019-09-22 19:08:09.544687 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2019-09-22 19:08:09.806022 INFO AppDaemon: HASS: HASS Plugin Initializing
2019-09-22 19:08:09.806799 INFO AppDaemon: HASS: HASS Plugin initialization complete
2019-09-22 19:08:09.807449 INFO Dashboards are disabled
2019-09-22 19:08:09.807716 INFO API is disabled
2019-09-22 19:08:12.617603 INFO AppDaemon: HASS: Connected to Home Assistant 0.99.2
2019-09-22 19:08:13.281243 INFO AppDaemon: Got initial state from namespace default
2019-09-22 19:08:14.731451 INFO AppDaemon: Reading config
2019-09-22 19:08:14.737418 WARNING AppDaemon: Error loading configuration
2019-09-22 19:08:14.737865 WARNING AppDaemon: parser says
2019-09-22 19:08:14.738670 WARNING AppDaemon: in "<unicode string>", line 7, column 1:
������������sensor:��sensor.temperature ...
^
2019-09-22 19:08:14.739077 WARNING AppDaemon: could not find expected ':' while scanning a simple key
2019-09-22 19:08:14.739619 WARNING AppDaemon: File '/config/appdaemon/apps/thermostats-update/apps.yaml' invalid structure - ignoring
2019-09-22 19:08:14.741087 WARNING AppDaemon: ------------------------------------------------------------
2019-09-22 19:08:14.741493 WARNING AppDaemon: Unexpected error loading config file: /config/appdaemon/apps/thermostats-update/._apps.yaml
2019-09-22 19:08:14.742112 WARNING AppDaemon: ------------------------------------------------------------
2019-09-22 19:08:14.747882 WARNING AppDaemon: Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/appdaemon/appdaemon.py", line 1677, in read_config_file
config_file_contents = yamlfd.read()
File "/usr/lib/python3.7/codecs.py", line 322, 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
2019-09-22 19:08:14.748987 WARNING AppDaemon: File '/config/appdaemon/apps/thermostats-update/._apps.yaml' invalid structure - ignoring
2019-09-22 19:08:14.749628 INFO AppDaemon: /config/appdaemon/apps/thermostats-update/apps.yaml added or modified
2019-09-22 19:08:14.748283 WARNING AppDaemon: ------------------------------------------------------------
2019-09-22 19:08:14.750275 INFO AppDaemon: /config/appdaemon/apps/thermostats-update/._apps.yaml added or modified
2019-09-22 19:08:14.750812 INFO AppDaemon: /config/appdaemon/apps/thermostats-update/apps.yaml added or modified
2019-09-22 19:08:14.751350 INFO AppDaemon: /config/appdaemon/apps/thermostats-update/._apps.yaml added or modified
2019-09-22 19:08:14.752345 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2019-09-22 19:08:14.753263 INFO AppDaemon: Adding /config/appdaemon/apps/thermostats-update to module import path
2019-09-22 19:08:14.754581 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/thermostats-update/thermostats-update.py - ignoring
2019-09-22 19:08:14.756555 INFO AppDaemon: App initialization complete
Honestly I don’t understand your logs, once python_script, once AppDaemon. I don’t know what you are doing. Which script do you use? If you use python_script version you should have python_script:
in configuration and automation rule in your automations.yaml file.
as explained, I tried everything, nothing is working for me.
I never tried both at same time (just to be clear) one after the other one.
as zou are now coming up with ou should have python_script:
in configuration and automation rule in your automations.yaml file (these are the details on my initial request)
Could you give a detailed step by step instruction which files need to be added, which files need to be edited and with which code.
since it is “easier” with the deamon app, I would like to get that one up and running. But it looks like something is wrong with the apps.yaml and I can’t find instructions what should be entered where.
here a reason why I don’t know what is correct:
in HACS:
thermostats_update:
module: thermostats-update
class: ThermostatsUpdate
in Github
thermostats_update:
module: thermostats-update
class: HeatingThermostatsUpdate
on each page, something different is explained, and it is really hard to understand what needs to be done in order to get it up and running.
If you want use python_script version:
- save script file to
/config/python_scripts
folder - add
python_script:
toconfiguration.yaml
file - add automation rule to
automations.yaml
file
If you want use AppDaemon version:
- save app file to AppDaemon apps folder
- add app configuration to
apps.yaml
file
That was mistake. Fixed. Thanks.
it’s working now thanks a lot.
little optimization (maybe there is a reason why you did differently)
by changing
attributes={"current_temperature": current_temp})
to
attributes={"current_temperature": float(current_temp)})
the thermostat will also work with the google assistant
edit:
the following has to be added to work with the assistant
"hvac_modes": [
"heat",
"off"
],
I have to check how this can be done via the daemon
Hi Bieniu
Nice script!
I’m having a similar but different challenge. My heatit z-wave thermostat do report back the temperature, but not the state (idle,heating). However it generate a switch entity which I can use to determine the state. I’m not an expert in python however I may try and modify your script to set the idle/heating state based on switch state. Or might this be something that you would later include?
You can easily modify my script and use it with argument state_only: true
to achieve what you need.
@Bieniu, I use your script. And it works great for me. But I want to change the format of my entities. Now I want to use sensor.livingroom_temperature and climate.livingroom_thermostat.
But I don’t know how to edit the automation to make it work with this entity format.
I tried this. But that doesn’t work.
Can you help me with that?
service: python_script.heating_thermostat_update
data_template:
thermostat: "{% if 'thermostat' in trigger.entity_id %}\n {{ trigger.entity_id\
\ }}\n{% else %}\n climate.*_thermostat{{ trigger.entity_id | replace('sensor.*_temperature',\
\ '') }}\n{% endif %}"
sensor: "{% if 'sensor' in trigger.entity_id %}\n {{ trigger.entity_id }}\n\
{% else %}\n sensor.*_temperature{{ (trigger.entity_id | replace('climate.*_thermostat',\
\ '')) }}\n{% endif %}"
heat_state: auto
Try this:
service: python_script.heating_thermostat_update
data_template:
thermostat: >-
{% if "thermostat" in trigger.entity_id %}
{{ trigger.entity_id }}
{% else %}
climate.{{ trigger.entity_id | replace('sensor.', '') | replace('_temperature', '') }}_thermostat
{% endif %}
sensor: >-
{% if "sensor" in trigger.entity_id %}
{{ trigger.entity_id }}
{% else %}
sensor.{{ trigger.entity_id | replace('climate.', '') | replace('_thermostat', '') }}_temperature
{% endif %}
Thanks!
My entities are changed a bit the last hour again
They are:
- sensor.huiskamer_temperatuur
- climate.radiatorknop_huiskamer
I edited my automatomation:
alias: Heating Update Thermostats
trigger:
platform: state
entity_id:
- sensor.huiskamer_temperatuur
- climate.huiskamer_radiatorknop
condition:
condition: template
value_template: "{% if 'radiatorknop' in trigger.entity_id and trigger.to_state.attributes.current_temperature\
\ == none %}\n true\n{% elif 'sensor' in trigger.entity_id %}\n true\n{% else\
\ %}\n false\n{% endif %}"
action:
service: python_script.heating_thermostat_update
data_template:
thermostat: >-
{% if "radiatorknop" in trigger.entity_id %}
{{ trigger.entity_id }}
{% else %}
climate.{{ trigger.entity_id | replace('sensor.', '') | replace('_temperatuur', '') }}_radiatorknop
{% endif %}
sensor: >-
{% if "sensor" in trigger.entity_id %}
{{ trigger.entity_id }}
{% else %}
sensor.{{ trigger.entity_id | replace('climate.', '') | replace('_radiatorknop', '') }}_temperatuur
{% endif %}
heat_state: auto
But it doesn’t work yet
This is in my log:
Expected thermostat entity_id, got: None.
Can you check what I do wrong?
Edit:
After a reboot this morning it did work. Thanks!
Hello,
I found that the python script is working but I’m just wondering how to put a condition in automation script to set up a temperature in different rooms depending of time of the day.
I don’t understand what do you mind. You want to use current_temperature
as a condition?