msvisser / remeha_home

Remeha Home integration for Home Assistant
69 stars 18 forks source link

Feature request: 'outside temperature' sensor #6

Closed adebree closed 1 year ago

adebree commented 1 year ago

As a user coming from the BDR Thermostat integration I'm missing one feature, and that's exposing the 'outside temperature' probe/sensor as an HA sensor. Since the Remeha Home app does show it as well, I assume this outside probe/sensor is available on the API. Unfortunately, the Remeha App (on iOS at least) seems to have implemented SSL pinning, so I'm unable to log the request/response to verify.

msvisser commented 1 year ago

I've had a quick look at the information that I'm getting from the API. The following information about outdoor temperature is available for me:

[custom_components.remeha_home.coordinator] outdoorTemperature: None
[custom_components.remeha_home.coordinator] outdoorTemperatureInformation:
{
  'outdoorTemperatureSource': 'Unknown',
  'internetOutdoorTemperature': None,
  'applianceOutdoorTemperature': None,
  'utilizeOutdoorTemperature': None,
  'internetOutdoorTemperatureExpected': False,
  'isDayTime': True,
  'weatherCode': 'Sunny',
  'cloudOutdoorTemperature': 4,
  'cloudOutdoorTemperatureStatus': 'Ok'
}
[custom_components.remeha_home.coordinator] outdoorTemperatureSource: Unknown

For me the only useful information is the outdoorTemperatureInformation.cloudOutdoorTemperature, but I'm not sure if other people do have information in the outdoorTemperature field.

Do you have some sort of external temperature sensor with your system, or are you relying on the cloud based temperature information?

adebree commented 1 year ago

My system does indeed have a physical outdoor / outside temperature sensor. With some pointers I could try to make that same response dump for my system?

msvisser commented 1 year ago

You can try applying this patch to coordinator.py and enabling debug logging.

diff --git a/custom_components/remeha_home/coordinator.py b/custom_components/remeha_home/coordinator.py
index a7edf34..26bff16 100644
--- a/custom_components/remeha_home/coordinator.py
+++ b/custom_components/remeha_home/coordinator.py
@@ -72,6 +72,10 @@ class RemehaHomeUpdateCoordinator(DataUpdateCoordinator):
                     via_device=(DOMAIN, appliance_id),
                 )

+            _LOGGER.debug("outdoorTemperature: %s", appliance["outdoorTemperature"])
+            _LOGGER.debug("outdoorTemperatureInformation: %s", appliance["outdoorTemperatureInformation"])
+            _LOGGER.debug("outdoorTemperatureSource: %s", appliance["outdoorTemperatureSource"])
+
         return data

     def get_appliance(self, appliance_id: str):

That should print out all the outdoor temperature information on every update (every minute).

055Richard commented 1 year ago

Hallo, Is there a dump with all remeha attributes/fields in the api? Maybe more fields are useful.

msvisser commented 1 year ago

@055Richard here is the output that is provided by the dashboard API call, which contains most of the useful information.

{'appliances': [{'activeThermalMode': 'Idle',
                 'applianceConnectionStatus': 'Connected',
                 'applianceId': '...appliance-guid...',
                 'applianceOnline': True,
                 'applianceType': 'Boiler',
                 'autoFilling': {'mode': 'Disabled', 'status': 'Standby'},
                 'autoFillingMode': 'Disabled',
                 'capabilityCooling': False,
                 'capabilityEnergyConsumption': True,
                 'capabilityMultiSchedule': True,
                 'capabilityPowerSettings': False,
                 'capabilityPreHeat': True,
                 'capabilityUtilizeOutdoorTemperature': False,
                 'climateZones': [{'activeComfortDemand': 'Idle',
                                   'activeHeatingClimateTimeProgramNumber': 1,
                                   'applianceId': '...appliance-guid...',
                                   'capabilityCooling': False,
                                   'capabilityFirePlaceMode': True,
                                   'climateZoneId': '...climate-zone-guid...',
                                   'currentScheduleSetPoint': 16.0,
                                   'firePlaceModeActive': False,
                                   'name': 'Woonkamer',
                                   'nextSetpoint': 19.0,
                                   'nextSwitchTime': '2022-11-19T17:00:00Z',
                                   'preHeat': {'active': False,
                                               'enabled': False},
                                   'roomTemperature': 16.0,
                                   'setPoint': 16.0,
                                   'setPointMax': 30.0,
                                   'setPointMin': 5.0,
                                   'zoneIcon': 3,
                                   'zoneMode': 'Scheduling',
                                   'zoneType': 'CH'}],
                 'currentTimestamp': None,
                 'errorStatus': 'Running',
                 'gasCalorificValue': None,
                 'hasOverwrittenActivityNames': False,
                 'holidaySchedule': {'active': False,
                                     'endTime': '0001-01-01T00:00:00Z',
                                     'startTime': '0001-01-01T00:00:00Z'},
                 'hotWaterZones': [{'activeDwhTimeProgramNumber': 1,
                                    'applianceId': '...appliance-guid...',
                                    'boostDuration': None,
                                    'boostModeEndTime': None,
                                    'capabilityBoostMode': False,
                                    'comfortSetPoint': 60.0,
                                    'dhwStatus': 'Idle',
                                    'dhwTemperature': 27.7,
                                    'dhwType': 'Combi',
                                    'dhwZoneMode': 'Scheduling',
                                    'hotWaterZoneId': '...hot-water-zone-guid...',
                                    'name': 'DHW',
                                    'nextSwitchActivity': 'Reduced',
                                    'nextSwitchTime': '2022-11-19T22:00:00Z',
                                    'reducedSetpoint': 15.0,
                                    'setPointMax': 65.0,
                                    'setPointMin': 45.0,
                                    'setPointRanges': {'comfortSetpointMax': 65.0,
                                                       'comfortSetpointMin': 45.0,
                                                       'reducedSetpointMax': 45.0,
                                                       'reducedSetpointMin': 25.0},
                                    'targetSetpoint': 60.0,
                                    'zoneType': 'DHW'}],
                 'houseName': 'Home',
                 'operatingMode': 'AutomaticHeating',
                 'outdoorTemperature': None,
                 'outdoorTemperatureInformation': {'applianceOutdoorTemperature': None,
                                                   'cloudOutdoorTemperature': 2,
                                                   'cloudOutdoorTemperatureStatus': 'Ok',
                                                   'internetOutdoorTemperature': None,
                                                   'isDayTime': True,
                                                   'outdoorTemperatureSource': 'Unknown',
                                                   'utilizeOutdoorTemperature': None,
                                                   'weatherCode': 'Sunny'},
                 'outdoorTemperatureSource': 'Unknown',
                 'pairingStatus': 'Paired',
                 'waterPressure': 1.5,
                 'waterPressureOK': True}]}
adebree commented 1 year ago

@msvisser this is what my installation returns atm:

{
  'outdoorTemperatureSource': 'Wired', 
  'internetOutdoorTemperature': 3.0, 
  'applianceOutdoorTemperature': 3.0, 
  'utilizeOutdoorTemperature': None, 
  'internetOutdoorTemperatureExpected': False, 
  'isDayTime': True, 
  'weatherCode': 'light fog', 
  'cloudOutdoorTemperature': 3, 
  'cloudOutdoorTemperatureStatus': 'Ok'
}

I think it's applianceOutdoorTemperature I'm looking for, as the name suggests the most direct to be the attached physical sensor. Having outdoorTemperatureSource to Wired might suggest this too?

msvisser commented 1 year ago

I think that looks right. Although I'm not sure what the difference between internetOutdoorTemperature and cloudOutdoorTemperature is.

Can you check that the outdoorTemperature field reports the correct temperature too? If so, I could simply add a sensor with that value, which would result in Unavailable for anyone without an outdoor temperature sensor.

Would anyone have a use for the cloud based outdoor temperature? I don't think it would be very useful, but maybe someone has different ideas.

adebree commented 1 year ago

What currently is set in outdoorTemperate seems to be what I expect. I have no log seen where internetOutdoorTemperature has a different value to applianceOutdoorTemperature.

Regarding cloudOutdoorTemperature I did some investigation:

My running theory is that cloudOutdoorTemperature is some external weather service, that just uses the geographical location of the installation. I move the 'home' of my installation to Marrakech, Morocco and to Madrid, Spain secondly:

outdoorTemperatureInformation before moving:

2023-02-15 08:57:06.153 DEBUG (MainThread) [custom_components.remeha_home.coordinator] outdoorTemperatureInformation: {'outdoorTemperatureSource': 'Wired', 'internetOutdoorTemperature': 1.0, 'applianceOutdoorTemperature': 1.0, 'utilizeOutdoorTemperature': None, 'internetOutdoorTemperatureExpected': False, 'isDayTime': True, 'weatherCode': 'light fog', 'cloudOutdoorTemperature': -1, 'cloudOutdoorTemperatureStatus': 'Ok'}

After moving to Morocco:

2023-02-15 09:06:19.534 DEBUG (MainThread) [custom_components.remeha_home.coordinator] outdoorTemperatureInformation: {'outdoorTemperatureSource': 'Wired', 'internetOutdoorTemperature': 1.5, 'applianceOutdoorTemperature': 1.5, 'utilizeOutdoorTemperature': None, 'internetOutdoorTemperatureExpected': False, 'isDayTime': None, 'weatherCode': None, 'cloudOutdoorTemperature': None, 'cloudOutdoorTemperatureStatus': 'NoGridCell'}

After moving to Madrid:

2023-02-15 09:09:21.133 DEBUG (MainThread) [custom_components.remeha_home.coordinator] outdoorTemperatureInformation: {'outdoorTemperatureSource': 'Wired', 'internetOutdoorTemperature': 1.5, 'applianceOutdoorTemperature': 1.5, 'utilizeOutdoorTemperature': None, 'internetOutdoorTemperatureExpected': False, 'isDayTime': True, 'weatherCode': 'partly cloudy', 'cloudOutdoorTemperature': 7, 'cloudOutdoorTemperatureStatus': 'Ok'}
msvisser commented 1 year ago

Thanks for doing some research on the cloudOutdoorTemperature. Your results match with what I was expecting. For now I don't think there is any use for exposing this value to Home Assistant, but let me know if I'm wrong.

I have released v0.1.7 which now contains the outdoor temperature sensor. When there is no outdoor temperature sensor it will just result in "Unknown".

With that, I think this feature request is done, so I'm closing the issue.

adebree commented 1 year ago

Thank you, looking good :)

rdeveen commented 1 year ago

Thanks for doing some research on the cloudOutdoorTemperature. Your results match with what I was expecting. For now I don't think there is any use for exposing this value to Home Assistant, but let me know if I'm wrong.

@msvisser Thanks for creating this HA component. Is looking and working very nice!

I don't have an external temperature sensor so the outdoor temperature is shown as "Unknown". It would be nice if in that case the cloudOutdoorTemperature is shown as a fallback scenario.

A simple implementation is something like this:

        if self.entity_description.device_class == SensorDeviceClass.TEMPERATURE:
            if value is None:
                return self.coordinator.get_appliance(self.appliance_id)["outdoorTemperatureInformation"]["cloudOutdoorTemperature"]

Or maybe use the property "capabilityOutdoorTemperature": false in the json?

Could you you have a look at it?