freitdav / BDRthermostatHA

BDR (Baxi, De Dietrich, Remeha) thermostat custom component integration for Home Assistant
GNU General Public License v3.0
48 stars 21 forks source link

Remeha etwist #8

Closed dacowiec closed 1 year ago

dacowiec commented 2 years ago

Hi,

I was able to connect to my Remeha etwist thermostat by for some reason not all of de info is vissible to me. there are only 3 entities available

I also attach the config of the dashboard

See the log below Logger: homeassistant.components.sensor Source: custom_components/bdr_thermostat/BdrAPI.py:195 Integration: Sensor (documentation, issues) First occurred: 09:47:34 (2 occurrences) Last logged: 09:47:34

bdr_thermostat: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 477, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 702, in async_device_update await task File "/config/custom_components/bdr_thermostat/sensor.py", line 207, in async_update status = await self._bdr_api.get_status() File "/config/custom_components/bdr_thermostat/BdrAPI.py", line 195, in get_status api_endpoint = self.capabilities["centralHeatingZones"]["statusUri"] KeyError: 'statusUri'

2022-08-19 10_01_31- 2022-08-19 10_04_27-

jghaanstra commented 1 year ago

I can confirm this on my Remeha eTwist. No climate device was added and only two entities where added in my case (errors and water temp.). The app recognises the eTwist as model GTW-16 which I'm not sure that is correct as this is a different device. Although I can live without the extra entities not having the climate device unfortunately makes the integration rather useless. Is there something I can do to help, I dont have any real developer skills but I'm willing to test stuff.

I did notice my error is a little different so I'm posting this here as well, perhaps it helps.

bdr_thermostat: Error on device update!
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.10/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.10/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 477, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 702, in async_device_update
    await task
  File "/config/custom_components/bdr_thermostat/sensor.py", line 93, in async_update
    water_pressure = await self._bdr_api.get_water_pressure()
  File "/config/custom_components/bdr_thermostat/BdrAPI.py", line 240, in get_water_pressure
    return await self.async_get_request(api_endpoint)
  File "/config/custom_components/bdr_thermostat/BdrAPI.py", line 139, in async_get_request
    return response.json() if response else response
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

So I tried re-adding it but it gave the same result. I did see a new 403 error in the log that is related. Perhaps its an issue with communication with the cloud server of BDR Thermea Group.

ERROR with get request to https://ruapi.remoteapp.bdrthermea.com/v1.0/system/gateway/connection: 403
jghaanstra commented 1 year ago

Ok, the issue seems to be that the Remeha eTwist uses a different endpoint for the status.

On https://github.com/freitdav/BDRthermostatHA/blob/7c0056dc49243d3876c2f9f20b9afeac88785283/custom_components/bdr_thermostat/BdrAPI.py#L195 it should not be api_endpoint = self.capabilities["centralHeatingZones"]["statusUri"] but api_endpoint = self.capabilities["centralHeatingZones"]["uri"] + '/status' to read the status object of the eTwist.

Here is the complete output of the capabilities endpoint.

{
    "centralHeatingZones": [{
        "name": "CIRCA ",
        "uri": "/central-heating-zone/1E1000000000010",
        "coolingSupported": false,
        "timeProgramsUri": "/central-heating-zone/1E1000000000010/time-programs",
        "timeProgramActivitiesUri": "/central-heating-zone/1E1000000000010/time-program-activities",
        "putSetpointScheduleUri": "/central-heating-zone/1E1000000000010/setpoint/schedule",
        "putSetpointManualUri": "/central-heating-zone/1E1000000000010/setpoint/manual",
        "putSetpointAntiFrostUri": "/central-heating-zone/1E1000000000010/setpoint/anti-frost",
        "putSetpointTemporaryOverrideUri": "/central-heating-zone/1E1000000000010/setpoint/temporary-override",
        "putSetpointHolidayUri": "/central-heating-zone/1E1000000000010/setpoint/holiday",
        "paramsMaxPreheatUri": "/central-heating-zone/1E1000000000010/parameters/max-pre-heat",
        "paramsHeatingCurveUri": "/central-heating-zone/1E1000000000010/parameters/heating-curve",
        "paramsHeatingCoolingSpeedUri": "/central-heating-zone/1E1000000000010/parameters/heating-cooling-speed",
        "paramsAntiFrostHolidayUri": "/central-heating-zone/1E1000000000010/parameters/anti-frost-and-holiday-setpoint"
    }],
    "domesticHotWaterZones": [{
        "name": "DHW Primary",
        "uri": "/domestic-hot-water-zone/1E1000000000011",
        "timeProgramsUri": "/domestic-hot-water-zone/1E1000000000011/time-programs",
        "putSetpointScheduleUri": "/domestic-hot-water-zone/1E1000000000011/setpoint/schedule",
        "putSetpointReducedUri": "/domestic-hot-water-zone/1E1000000000011/setpoint/anti-frost",
        "putSetpointComfortUri": "/domestic-hot-water-zone/1E1000000000011/setpoint/comfort",
        "putSetpointTemporaryOverrideUri": "/domestic-hot-water-zone/1E1000000000011/setpoint/temporary-override",
        "putSetpointHolidayUri": "/domestic-hot-water-zone/1E1000000000011/setpoint/holiday",
        "parametersUri": "/domestic-hot-water-zone/1E1000000000011/parameters"
    }],
    "producers": [{
        "name": "GTW-16",
        "statusUri": "/producers/1E1000000000",
        "powerSettingsUri": "/producers/1E1000000000/parameters/power-settings"
    }],
    "system": {
        "waterPressureUri": "/system/water-pressure",
        "gatewayUri": "/system/gateway",
        "historyUri": "/system/errors/history",
        "locationUri": "/system/location",
        "connectionUri": "/system/gateway/connection",
        "errorStatusUri": "/system/error-status",
        "applianceTimeUri": "/system/appliance-time",
        "flowTemperatureUri": "/system/flow-temperature",
        "deviceInformationUri": "/system/device-information"
    }
}
rubkec commented 1 year ago

mine works with the etwist, HA recorgnized them as an CU-GH08

freitdav commented 1 year ago

Ok, the issue seems to be that the Remeha eTwist uses a different endpoint for the status.

On

https://github.com/freitdav/BDRthermostatHA/blob/7c0056dc49243d3876c2f9f20b9afeac88785283/custom_components/bdr_thermostat/BdrAPI.py#L195 it should not be api_endpoint = self.capabilities["centralHeatingZones"]["statusUri"] but api_endpoint = self.capabilities["centralHeatingZones"]["uri"] + '/status' to read the status object of the eTwist.

Here is the complete output of the capabilities endpoint.

{
    "centralHeatingZones": [{
        "name": "CIRCA ",
        "uri": "/central-heating-zone/1E1000000000010",
        "coolingSupported": false,
        "timeProgramsUri": "/central-heating-zone/1E1000000000010/time-programs",
        "timeProgramActivitiesUri": "/central-heating-zone/1E1000000000010/time-program-activities",
        "putSetpointScheduleUri": "/central-heating-zone/1E1000000000010/setpoint/schedule",
        "putSetpointManualUri": "/central-heating-zone/1E1000000000010/setpoint/manual",
        "putSetpointAntiFrostUri": "/central-heating-zone/1E1000000000010/setpoint/anti-frost",
        "putSetpointTemporaryOverrideUri": "/central-heating-zone/1E1000000000010/setpoint/temporary-override",
        "putSetpointHolidayUri": "/central-heating-zone/1E1000000000010/setpoint/holiday",
        "paramsMaxPreheatUri": "/central-heating-zone/1E1000000000010/parameters/max-pre-heat",
        "paramsHeatingCurveUri": "/central-heating-zone/1E1000000000010/parameters/heating-curve",
        "paramsHeatingCoolingSpeedUri": "/central-heating-zone/1E1000000000010/parameters/heating-cooling-speed",
        "paramsAntiFrostHolidayUri": "/central-heating-zone/1E1000000000010/parameters/anti-frost-and-holiday-setpoint"
    }],
    "domesticHotWaterZones": [{
        "name": "DHW Primary",
        "uri": "/domestic-hot-water-zone/1E1000000000011",
        "timeProgramsUri": "/domestic-hot-water-zone/1E1000000000011/time-programs",
        "putSetpointScheduleUri": "/domestic-hot-water-zone/1E1000000000011/setpoint/schedule",
        "putSetpointReducedUri": "/domestic-hot-water-zone/1E1000000000011/setpoint/anti-frost",
        "putSetpointComfortUri": "/domestic-hot-water-zone/1E1000000000011/setpoint/comfort",
        "putSetpointTemporaryOverrideUri": "/domestic-hot-water-zone/1E1000000000011/setpoint/temporary-override",
        "putSetpointHolidayUri": "/domestic-hot-water-zone/1E1000000000011/setpoint/holiday",
        "parametersUri": "/domestic-hot-water-zone/1E1000000000011/parameters"
    }],
    "producers": [{
        "name": "GTW-16",
        "statusUri": "/producers/1E1000000000",
        "powerSettingsUri": "/producers/1E1000000000/parameters/power-settings"
    }],
    "system": {
        "waterPressureUri": "/system/water-pressure",
        "gatewayUri": "/system/gateway",
        "historyUri": "/system/errors/history",
        "locationUri": "/system/location",
        "connectionUri": "/system/gateway/connection",
        "errorStatusUri": "/system/error-status",
        "applianceTimeUri": "/system/appliance-time",
        "flowTemperatureUri": "/system/flow-temperature",
        "deviceInformationUri": "/system/device-information"
    }
}

Based on this reply, Remeha eTwist users feel free to change the code accordingly. Thank you jghaanstra. Closing this as solved.

jghaanstra commented 1 year ago

Closing this as solved. How is this solved? The issue has been identified but not solved in any way.

For people who bump into this issue and have the same unsupported Remeha eTwist model (GTW-16), here is a customized version of the app with a customized status URL and removed waterpressure and outside temp sensor entities (as these are by default not available for this thermostat model and give issue with the current code). Also you will not be able to set the operatingMode as there is no endpoint available to do so (it will return an error). Unfortunately I lack the coding skills to create a pull request to merge support for this model into this component without breaking the support for other devices.

https://github.com/jghaanstra/BDRthermostatHA

freitdav commented 1 year ago

As is written in the project's disclaimer - use at your own risk and consider doing changes that suit your needs. Apparently Remeha has little bit different API implementation. I have no means to verify or to test any changes nor the issue itself. You posted all the API endpoints Remeha provides and with that everyone is able to change my code accordingly. Understand please that this is a hobby project of mine, having only the De Dietrich heat pump and Smart TC App. There are more and more issues with Remeha brand, however I am not an official support nor developer. Therefore, solved.

dacowiec commented 1 year ago

I've add the change to the api file and can confirm that I can now see the temperature of my etwist.