bigmoby / fglair_for_homeassistant

❄️ FGLair heat pump controller integration
MIT License
48 stars 4 forks source link

Temperature polling seems to report erroneous temperature #82

Closed MisterScience5 closed 3 weeks ago

MisterScience5 commented 10 months ago

System Health details

System Information

version core-2023.11.2
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.6
os_name Linux
os_version 6.1.59
arch x86_64
timezone Europe/Oslo
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4993 Installed Version | 1.33.0 Stage | running Available Repositories | 1340 Downloaded Repositories | 18
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Easee EV Charger component_version | 0.9.55 -- | -- reach_easee_cloud | ok connected2stream | true
Home Assistant Supervisor host_os | Home Assistant OS 11.1 -- | -- update_channel | stable supervisor_version | supervisor-2023.11.3 agent_version | 1.6.0 docker_version | 24.0.6 disk_total | 30.8 GB disk_used | 13.5 GB healthy | true supported | true board | ova supervisor_api | ok version_api | ok installed_addons | ESPHome (2023.11.2), File editor (5.7.0), Terminal & SSH (9.8.1), Mosquitto broker (6.4.0), Piper (1.4.0), Whisper (1.0.0), Samba share (12.1.0)
Dashboards dashboards | 2 -- | -- resources | 1 views | 6 mode | storage
Recorder oldest_recorder_run | November 14, 2023 at 16:00 -- | -- current_recorder_run | November 19, 2023 at 11:20 estimated_db_size | 1461.08 MiB database_engine | sqlite database_version | 3.41.2

Checklist

Describe the issue

After upgrading to the latest version, temperature is clearly polled, but the values returned are not the same as the app. For example, the integration is currently reportin 20,8C, but the app reports 23C.

My heatpump is a Fujitsu ASYG09KMCDN/AOYG09KMCDN with the UTY-TFSXF2 WiFi-adapter.

bilde

Reproduction steps

Run the addon.

Debug logs

Update for climate.ovreberg_4 fails

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/pyfujitsugeneral/client.py", line 205, in api_wrapper
    json_response = await response.json()
                    ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 84, in json
    return await super().json(*args, loads=loads, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1104, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url=URL('https://ads-field-eu.aylanetworks.com/apiv1/dsns/AC000W026250573/properties.json')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 696, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 957, in async_device_update
    await self.async_update()
  File "/config/custom_components/fglair_heatpump_controller/climate.py", line 372, in async_update
    self._properties = await self._fujitsu_device.async_update_properties()
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyfujitsugeneral/splitac.py", line 66, in async_update_properties
    self.set_properties(await self._client.async_get_device_properties(self._dsn))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyfujitsugeneral/client.py", line 132, in async_get_device_properties
    response = await self.api_wrapper(
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyfujitsugeneral/client.py", line 235, in api_wrapper
    raise FGLairGeneralException() from exception
pyfujitsugeneral.exceptions.FGLairGeneralException: FGLairBaseException has been raised
Error fetching information from https://ads-field-eu.aylanetworks.com/apiv1/properties/550488923/datapoints.json - 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://ads-field-eu.aylanetworks.com/apiv1/properties/550488923/datapoints.json')
Error fetching information from https://ads-field-eu.aylanetworks.com/apiv1/devices.json - 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url=URL('https://ads-field-eu.aylanetworks.com/apiv1/devices.json')
Error fetching information from https://ads-field-eu.aylanetworks.com/apiv1/devices.json - 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url=URL('https://ads-field-eu.aylanetworks.com/apiv1/devices.json')
Error fetching information from https://ads-field-eu.aylanetworks.com/apiv1/dsns/AC000W026250573/properties.json - 0, message='Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8', url=URL('https://ads-field-eu.aylanetworks.com/apiv1/dsns/AC000W026250573/properties.json')
Error fetching information from https://ads-field-eu.aylanetworks.com/apiv1/devices.json - 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://ads-field-eu.aylanetworks.com/apiv1/devices.json')
Error fetching fglair_heatpump_controller data:

Diagnostics dump

No response

KINGCanty commented 8 months ago

Same issue. Installed this add on recently and it works great. But the temperatures are lower than the offical app and aircon remote. I have 2 aircons and one shows current temp as 21.9c when it’s 25c in the offical app and the other 22.4c when it’s 26c. So it doesn’t seem to be off by a standard amount.

bigmoby commented 5 months ago

Same issue. Installed this add on recently and it works great. But the temperatures are lower than the offical app and aircon remote. I have 2 aircons and one shows current temp as 21.9c when it’s 25c in the offical app and the other 22.4c when it’s 26c. So it doesn’t seem to be off by a standard amount.

@KINGCanty Have you set the offset parameter?

bigmoby commented 5 months ago

@MisterScience5 I'll try to understand if this issue is related by the AC model (IMHO yes)

bigmoby commented 4 months ago

Please reconfigure the component with a suitable offset value.

KINGCanty commented 4 months ago

Cheers I’ll give it a go.

babist1st commented 1 month ago

I think the difference between the FGLair app and the integration is due to wrongly converting the data reported.

I have been playing around with the aircon implementation trying to apply https://github.com/deiger/AirCon/pull/224 There a formula of round(value-5000)/50)/2 is used. In contrast to this integration that from what i have read in https://github.com/bigmoby/fglair_for_homeassistant/issues/5#issuecomment-1369382488 it assumes that the reported value is in Fahrenheit*100.

Taking that into consideration and converting the values reported in the first 2 posts of #82 the FGLair app seems to match the values reported in the integration

I assume a default offset value of 2 app: 23c vs 20,8c -> (23*100+5000)=7300 which is converted in the integration to (7300/100-32)*5/9=22,8 -2=20.8 app: 25c vs 21.9c -> (25*100+5000)=7500 which is converted in the integration to (7500/100-32)*5/9=23,9 -2=21.8 app: 26c vs 22.4c -> (26*100+5000)=7600 which is converted in the integration to (7600/100-32)*5/9=24,4 -2=22.4

Even the value from https://github.com/bigmoby/fglair_for_homeassistant/issues/5#issuecomment-1369382488 is converted assuming an offset of 0 this time.

Obviously, I have played around with values in my setup and the observations seem to agree and the values are more in line to what the temperature in the room should be without needing to apply an offset. I think that the conversion is done in https://github.com/bigmoby/pyfujitsugeneral since i couldn't find it in the code here. What I don't know is whether this is eu specific and if there is anything else to consider(such as rounding).

Perhaps @bigmoby or @chiefcomm could take a look at it?

bigmoby commented 1 month ago

Hi @babist1st and thank you for your analysis and hints! I'll investigate if the conversion algorithm is wrong also for me (eu). Thanks

bigmoby commented 4 weeks ago

@babist1st I just released this https://github.com/bigmoby/pyfujitsugeneral/releases/tag/2.0.28

babist1st commented 4 weeks ago

I made the changes locally to check if it works. (thankfully they were not a lot!) It seems to work, I just mention it in case someone wonders that round((display_temperature_value - 5000) / 100, 1) gives values with greater precision than 0.5 which is different from the app (not that I think that is a problem).

Specifically I get values 24.2 and 24.8 as well as 24.5, 24, 25 due to the rounding being different I guess that is why https://github.com/deiger/AirCon/pull/224 used something like this round((display_temperature_value - 5000) / 50)/2 which seemed weird to me initially.

Anyway, this is great, hope to see it soon in the next release :P Thank you very much @bigmoby for your work!

bigmoby commented 3 weeks ago

@babist1st please try this https://github.com/bigmoby/fglair_for_homeassistant/releases/tag/v0.3.20