HomeAssistant Controme yaml creator

I have written a small PowerShell script, which creates the Controme yaml by reading out the Controme api.
As a model I have taken the yaml of @mafrank link.
Only the URL of the Contromservers in must be adapted.
Have fun testing.

1 Like

Thank you, terrific! I generated my yaml in a matter of seconds!
I am a complete newbi with HA (coming from OpenHab). Can you please explain how I now can use the yaml and integrate?
How do I create an automation that items are updated every 10min?
Thanks a ton,
Matthias

Hey @mroggi, I have implemented as follows:

  1. create a sensors folder in your config folder
  2. copy the controme.yaml into the sensors folder
  3. extend your configuration.yaml with the following value sensors: !include_dir_merge_list sensors
    image
    4.after that you should find your Controme rooms in the Cassio

Wow, super! Thanks for the detailed explanations. I will try it tomorrow!

1 Like

Thanks again for the detailed explanations! I implemented it and YAML configuration is ok!
However, next to the entities I can an exclamation mark. When I click on the entity I get the message:

Diese Entität (“sensor.controme_buero_solltemperatur”) hat keine eindeutige ID, daher können die Einstellungen nicht über die UI verwaltet werden. Schaue in der Dokumentation nach für mehr Details.
(sorry, in German but it seems you are German too)

I do not see any values. Do you know what is the problem?

This is normal behavior, just add the sensor to a dashboard.

Thank you. I added to the dashboard, but values stay “unknown”. It seems that the Controme API is not called or values are not extracted. Given that the YAML was generated the initial call to Controme was working (from another computer). I also have it up an running on OpenHab on the same machine.
Any ideas how I can analyse this and get to a solution? Sorry for the basic questions, but really new to HA and all its secrets.
Help much appreciated.

I also just switched from openhab to hassio 2 weeks ago, can you manually access the API without credentials?

Yes I can. For reading I can access, for writing I need to use credentials.

When you enter sensor.controme_(room name in Controme), do you get no suggestions or do the sensors just not provide any values?

Hello @flame4ever!

Thank you for the script! I tried to use it, but I get the following error:

PS C:\Home-Assistant-Controme-yaml-creator-main\source\controme.ps1
Invoke-RestMethod : []
In C:\Home-Assistant-Controme-yaml-creator-main\source\controme.ps1:8 Zeichen:24
+ $ContromeRestRequest = Invoke-RestMethod -Uri $URL
+                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

I’ve changed the $ContromeServerURL to my ContromeServer IP. Do I need to ask Controme to unlock the API for me? According to their support page I need to send them an email with the request to unlock (API – Controme Support Center).

Hello @elektron303,

  1. possibly this will help.
    grafik
    ssl - Powershell Invoke-RestMethod over HTTPS - Stack Overflow

  2. Which powershell version do you have, you can query this in powershell with “$PSVersionTable”?
    grafik

  3. How do you run the ps1?

regards flame4ever

Did a bit of research on the issue. The API works and provides me with all the information I need. However, it makes no difference if I call:
http://192.168.188.100/get/json/v1/1/temps/
http://192.168.188.100/get/json/v1/1/temps/1/
http://192.168.188.100/get/json/v1/1/temps/5/
It always gives me the full json of the entire house.

The extraction does not seem to work. I get the error:

Logger: homeassistant.helpers.template
Source: helpers/template.py:1914
First occurred: 18:42:55 (14 occurrences)
Last logged: 21:57:59

Template variable warning: 'dict object' has no attribute 'name' when rendering '{{ value_json[0]["name"] }}'

Also I get:

Logger: homeassistant.helpers.template_entity
Source: helpers/template_entity.py:108
First occurred: 18:43:11 (8 occurrences)
Last logged: 18:43:11

TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'offsets'') while processing template 'Template("{{ states.sensor.controme_kueche.attributes["offsets"]["Wetter"]["raum"] | round(2) }}")' for attribute 'offset_wetter_raum' in entity 'sensor.controme_kueche_total_offset'
TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'sensoren'') while processing template 'Template("{{ states.sensor.controme_kueche.attributes["sensoren"][0]["wert"] | round(2) }}")' for attribute '_attr_native_value' in entity 'sensor.controme_kueche_sensor_0'
TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'sensoren'') while processing template 'Template("{{ states.sensor.controme_kueche.attributes["sensoren"][0]["letzte_uebertragung"] }}")' for attribute 'letzte_uebertragung' in entity 'sensor.controme_kueche_sensor_0'
TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'sensoren'') while processing template 'Template("{{ states.sensor.controme_kueche.attributes["sensoren"][0]["name"] }}")' for attribute 'name' in entity 'sensor.controme_kueche_sensor_0'
TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'sensoren'') while processing template 'Template("{{ states.sensor.controme_kueche.attributes["sensoren"][0]["beschreibung"] }}")' for attribute 'beschreibung' in entity 'sensor.controme_kueche_sensor_0'

Posting the entire json here as a reference:

[{"etagenname": "EG", "id": 1, "raeume": [{"total_offset": 0.6000000000000001, "name": "K\u00fcche", "offsets": {"Wetter": {"raum": 0.6000000000000001, "haus": 0.0}, "Jahreskalender": {"raum": 0.0, "haus": 0.0}, "Wochenkalender": {"raum": 0.0, "haus": 0.0}}, "sensoren": [{"raumtemperatursensor": true, "letzte_uebertragung": "27.07.2022 21:52", "name": "10_31_42_d0_02_08_00_73", "wert": 23.44, "beschreibung": "Kueche"}], "solltemperatur": 23.0, "temperatur": 23.44, "id": 1}, {"total_offset": 0.6000000000000001, "name": "Wohnzimmer", "offsets": {"Wetter": {"raum": 0.6000000000000001, "haus": 0.0}, "Jahreskalender": {"raum": 0.0, "haus": 0.0}, "Wochenkalender": {"raum": 0.0, "haus": 0.0}}, "sensoren": [{"raumtemperatursensor": true, "letzte_uebertragung": "27.07.2022 21:52", "name": "10_70_ab_db_02_08_00_8c", "wert": 22.81, "beschreibung": "Wohnzimmer"}], "solltemperatur": 23.6, "temperatur": 22.81, "id": 3}, {"total_offset": 0.6000000000000001, "name": "G\u00e4stetoilette", "offsets": {"Wetter": {"raum": 0.6000000000000001, "haus": 0.0}}, "sensoren": [{"raumtemperatursensor": true, "letzte_uebertragung": "27.07.2022 21:53", "name": "10_57_97_db_02_08_00_1a", "wert": 22.87, "beschreibung": "Gaestetoilette"}], "solltemperatur": 20.0, "temperatur": 22.87, "id": 4}, {"total_offset": 0.6000000000000001, "name": "Eingangsbereich", "offsets": {"Wetter": {"raum": 0.6000000000000001, "haus": 0.0}}, "sensoren": [{"raumtemperatursensor": true, "letzte_uebertragung": "27.07.2022 21:52", "name": "10_ad_5c_d0_02_08_00_61", "wert": 22.12, "beschreibung": "Eingang"}], "solltemperatur": 21.8, "temperatur": 22.12, "id": 17}]}, {"etagenname": "1OG", "id": 2, "raeume": [{"total_offset": 0.6000000000000001, "name": "Kinderzimmer Anna", "offsets": {"Wetter": {"raum": 0.6000000000000001, "haus": 0.0}, "Wochenkalender": {"raum": 0.0, "haus": 0.0}}, "sensoren": [{"raumtemperatursensor": true, "letzte_uebertragung": "27.07.2022 21:51", "name": "10_a0_6a_d0_02_08_00_33", "wert": 23.87, "beschreibung": "Anna"}], "solltemperatur": 22.5, "temperatur": 23.87, "id": 5}, {"total_offset": 0.6000000000000001, "name": "Kinderzimmer Benjamin", "offsets": {"Wetter": {"raum": 0.6000000000000001, "haus": 0.0}, "Wochenkalender": {"raum": 0.0, "haus": 0.0}}, "sensoren": [{"raumtemperatursensor": true, "letzte_uebertragung": "27.07.2022 21:51", "name": "10_cf_b6_db_02_08_00_3f", "wert": 24.56, "beschreibung": "Benjamin"}], "solltemperatur": 21.4, "temperatur": 24.56, "id": 6}, {"total_offset": 0.6000000000000001, "name": "Kinderbad", "offsets": {"Wetter": {"raum": 0.6000000000000001, "haus": 0.0}, "Wochenkalender": {"raum": 0.0, "haus": 0.0}}, "sensoren": [{"raumtemperatursensor": true, "letzte_uebertragung": "27.07.2022 21:52", "name": "10_ef_b5_db_02_08_00_c7", "wert": 24.12, "beschreibung": ""}], "solltemperatur": 22.0, "temperatur": 24.12, "id": 7}, {"total_offset": 0.6000000000000001, "name": "HK1", "offsets": {"Wetter": {"raum": 0.6000000000000001, "haus": 0.0}, "Wochenkalender": {"raum": 0.0, "haus": 0.0}}, "sensoren": [{"raumtemperatursensor": true, "letzte_uebertragung": "27.07.2022 21:53", "name": "VSensor*1", "wert": 24.12, "beschreibung": "HK1"}], "solltemperatur": 20.0, "temperatur": 24.12, "id": 16}, {"total_offset": 0.6000000000000001, "name": "Medienraum", "offsets": {"Wetter": {"raum": 0.6000000000000001, "haus": 0.0}, "Wochenkalender": {"raum": 0.0, "haus": 0.0}}, "sensoren": [{"raumtemperatursensor": true, "letzte_uebertragung": "27.07.2022 21:52", "name": "10_9b_f7_da_02_08_00_66", "wert": 23.44, "beschreibung": ""}], "solltemperatur": 20.700005, "temperatur": 23.44, "id": 18}]}, {"etagenname": "2OG", "id": 3, "raeume": [{"total_offset": 0.6000000000000001, "name": "Schlafzimmer", "offsets": {"Wetter": {"raum": 0.6000000000000001, "haus": 0.0}}, "sensoren": [{"raumtemperatursensor": true, "letzte_uebertragung": "27.07.2022 21:53", "name": "10_4c_b3_da_02_08_00_d1", "wert": 24.0, "beschreibung": ""}], "solltemperatur": 18.0, "temperatur": 24.0, "id": 10}, {"total_offset": 0.6000000000000001, "name": "B\u00fcro", "offsets": {"Wetter": {"raum": 0.6000000000000001, "haus": 0.0}}, "sensoren": [{"raumtemperatursensor": true, "letzte_uebertragung": "27.07.2022 21:52", "name": "10_3c_94_db_02_08_00_6f", "wert": 23.25, "beschreibung": ""}], "solltemperatur": 22.5, "temperatur": 23.25, "id": 11}, {"total_offset": 2.6, "name": "Elternbad", "offsets": {"Wetter": {"raum": 0.6000000000000001, "haus": 0.0}, "Wochenkalender": {"raum": 2.0, "haus": 0.0}}, "sensoren": [{"raumtemperatursensor": true, "letzte_uebertragung": "27.07.2022 21:52", "name": "10_55_d7_da_02_08_00_12", "wert": 20.62, "beschreibung": ""}], "solltemperatur": 22.5, "temperatur": 20.62, "id": 12}, {"total_offset": 0.6000000000000001, "name": "HK2", "offsets": {"Wetter": {"raum": 0.6000000000000001, "haus": 0.0}, "Wochenkalender": {"raum": 0.0, "haus": 0.0}}, "sensoren": [{"raumtemperatursensor": true, "letzte_uebertragung": "27.07.2022 21:52", "name": "VSensor*3", "wert": 20.5, "beschreibung": "HK2"}], "solltemperatur": 19.5, "temperatur": 20.5, "id": 15}, {"total_offset": 0.6000000000000001, "name": "Flur", "offsets": {"Wetter": {"raum": 0.6000000000000001, "haus": 0.0}, "Jahreskalender": {"raum": 0.0, "haus": 0.0}, "Wochenkalender": {"raum": 0.0, "haus": 0.0}}, "sensoren": [{"raumtemperatursensor": true, "letzte_uebertragung": "27.07.2022 21:51", "name": "10_e0_d5_da_02_08_00_7d", "wert": 23.19, "beschreibung": ""}], "solltemperatur": 17.200006, "temperatur": 23.19, "id": 19}]}]

Please send me your Controme.yaml by pm.

Hat es geholfen?

Ich hab das Problem gefunden:

API – Controme Support Center:

API gibt nichts aus

Bitte prüfen Sie in diesem Fall zunächst, ob Sie die korrekte Haus-ID verwenden. Aus unterschiedlichen Gründen ist die ID manchmal „2“ und nicht „1“. Der korrekte Endpunkt ist deshalb bei einigen Systemen z.b.

/get/json/v1/2/temps

und nicht

/get/json/v1/1/temps

Vielleicht kannst du das noch in deine Doku aufnehmen :slight_smile:
Danke für deine Hilfe und dein Skript!

//Edit: Und man sollte keine Umlaute (wie Küche oder Büro), dann klappt alles :wink:

1 Like

I use the Rest-Client add-on via Firefox for this:


You can use the client as follows:

After that, you should see your room displayed.

Ich habe es hinzugefügt, danke für deine Analysen!

Thanks for your great work.
Is it also possible to set the temperature of the room sensors?

Unfortunately not yet, I have created a topic “Set temperature of a rest api heater with the rest api - #7 by flame4ever” but unfortunately no one can help me here.