jheling / freeathome

Free@Home component for Home Assistant
112 stars 41 forks source link

Free@Home System Access Point Firmware Update 3.3.1 not supported #190

Closed oliverlinsenmaier closed 1 month ago

oliverlinsenmaier commented 3 months ago

Hi all,

Can somebody confirm that 3.3.1 is not working with Home Assistant and this component? Is there a possibility to downgrade the system access point?

eyk107 commented 3 months ago

I can't confirm at the moment but will wait with the update. Thank you for the hint. Firmwaredowngrade doesn't seem to be possible: https://community.busch-jaeger.de/frage-ansehen/is-there-any-way-to-downgrade-sysap-firmware-version

kap46248 commented 2 months ago

I have the same problem. I didn't even notice the SysAp update. First everything worked great but after a HA restart I was not able to connect to f@h. I even removed the integration entity and tried to configure F@H again but it doesn't work.

Qualm8429 commented 2 months ago

Unfortunately, I am also affected by this problem.

kingsleyadam commented 2 months ago

Are there any errors/exceptions in the logs? Posting as much info as you have is the best way to get support.

oliverlinsenmaier commented 2 months ago
2024-07-08 08:02:57.425 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 192.168.178.165 for freeathome
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 504, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/__init__.py", line 84, in async_setup_entry
    await sysap.find_devices()
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 954, in find_devices
    await self.xmpp.find_devices(self._use_room_names, self._switch_as_x)
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 661, in find_devices
    root = ET.fromstring(config_without_names)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/xml/etree/ElementTree.py", line 1330, in XML
    parser.feed(text)
xml.etree.ElementTree.ParseError: duplicate attribute: line 1, column 8914039
2024-07-08 08:03:16.026 ERROR (Recorder) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 2263, in async_call
    raise ServiceNotFound(domain, service) from None
homeassistant.exceptions.ServiceNotFound: Service cover.set_cover_position not found.
2024-07-08 08:03:54.605 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 2263, in async_call
    raise ServiceNotFound(domain, service) from None
homeassistant.exceptions.ServiceNotFound: Service cover.set_cover_position not found.
2024-07-08 09:20:27.077 ERROR (SyncWorker_14) [homeassistant] Error doing job: Task was destroyed but it is pending!
2024-07-09 09:15:41.882 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 192.168.178.165 for freeathome
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 504, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/__init__.py", line 84, in async_setup_entry
    await sysap.find_devices()
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 954, in find_devices
    await self.xmpp.find_devices(self._use_room_names, self._switch_as_x)
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 661, in find_devices
    root = ET.fromstring(config_without_names)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/xml/etree/ElementTree.py", line 1330, in XML
    parser.feed(text)
xml.etree.ElementTree.ParseError: duplicate attribute: line 1, column 8918724
2024-07-09 09:16:21.428 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 192.168.178.165 for freeathome
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 504, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/__init__.py", line 84, in async_setup_entry
    await sysap.find_devices()
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 954, in find_devices
    await self.xmpp.find_devices(self._use_room_names, self._switch_as_x)
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 661, in find_devices
    root = ET.fromstring(config_without_names)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/xml/etree/ElementTree.py", line 1330, in XML
    parser.feed(text)
xml.etree.ElementTree.ParseError: duplicate attribute: line 1, column 8918724
kingsleyadam commented 2 months ago

@oliverlinsenmaier , looks like the SysAP is changing the format of the XML document being fetched by this integration.

Looks like @jheling already attempted to clean-up the XML in previous versions. Here's the offending code.

https://github.com/jheling/freeathome/blob/master/custom_components/freeathome/fah/pfreeathome.py#L657-L661

# Ugly hack: Some SysAPs seem to return invalid XML, i.e. duplicate name attributes
# Strip them altogether.
config_without_names = self.clean_xml(config)

root = ET.fromstring(config_without_names)

I'm not sure if it's possible, but if someone would provide me with the XML coming from the SysAP I could attempt a fix. I don't want to upgrade my system if it's going to break it. :)

kingsleyadam commented 2 months ago

Side note and completely unrelated. Xml is a pain to work with in Python (and maybe other languages too). It would be great if this integration could move to the local api which uses a JSON response and would have to adhere to JSON standards. And it's much easier and native to work with in Python (and it's local).

I realize that's not an easy task. Looks like this has been in discussions for quite some time. https://github.com/jheling/freeathome/issues/80

oliverlinsenmaier commented 2 months ago

@kingsleyadam: How do I get the XML? Can I provide it to you via PM or something? I'm not sure if I want to share that with everybody...

And I would love to change this integration to the local API, since from other services I know that this brought great speed improvements. I don't think this is really required here, since speed isn't an issue, but if it would make the integration more stable, this would really be great as well... Unfortunately, I'm not of great help in coding...

kingsleyadam commented 2 months ago

@oliverlinsenmaier , you should be able to follow the instructions under debugging in the README.

Looks like others have shared it via their own GitHub repo, or via issues like this, but I agree, not sure I'd want to share that whole file publicly.

kingsleyadam commented 2 months ago

@oliverlinsenmaier, you can find me on Discord with the same name if you want to send it that way. Then I can try to reproduce it locally.

ikorb commented 2 months ago

When I change the "2" parameter in the getAll call in pfreeathome.py to "1" it seems to work again.

kap46248 commented 2 months ago

When I change the "2" parameter in the getAll call in pfreeathome.py to "1" it seems to work again.

Thank you very much. :)

oliverlinsenmaier commented 2 months ago

@ikorb / @kap46248 Can you provide the whole line? My changes didn't help at all... @kingsleyadam I wasn't able to get the XML, sorry. Either the instructions are outdated or I'm lost in translation...

kingsleyadam commented 2 months ago

@ikorb / @kap46248 Can you provide the whole line? My changes didn't help at all... @kingsleyadam I wasn't able to get the XML, sorry. Either the instructions are outdated or I'm lost in translation...

I assume they're talking about this line: https://github.com/jheling/freeathome/blob/master/custom_components/freeathome/fah/pfreeathome.py#L628

Try to update it to look like:

my_iq = await self.send_rpc_iq('RemoteInterface.getAll', 'de', 1, pretty_value, 0)

I've been doing some digging around to try and figure out what exactly that argument is, but with no luck. I assume it's somewhere in the ABB documentation which I can't find much of for this interface.

ikorb commented 2 months ago

I'm not sure what the difference between the two is, but with 1 the tag has a type attribute of "getAll" while 2 has a type of "debug". My guess is that type 2 is not used by the original software but only by the developers when something goes wrong, so they don't notice immediately when something is wrong with it. Type 2 seems to be a lot more verbose, so it's probably optimized for human-readability.

oliverlinsenmaier commented 2 months ago

I can't use the component since the a new authorization doesn't work for me.

kingsleyadam commented 2 months ago

I'm not sure what the difference between the two is, but with 1 the tag has a type attribute of "getAll" while 2 has a type of "debug". My guess is that type 2 is not used by the original software but only by the developers when something goes wrong, so they don't notice immediately when something is wrong with it. Type 2 seems to be a lot more verbose, so it's probably optimized for human-readability.

Interesting, I tested both and 2 is definitely much more verbose. For my config 1 produces 19551 lines, and 2 produces 37350 lines. Nearly doubling the size.

If it's true that 2 is for debug/verbose output then it should definitely be changed to 1. I obviously can't test all scenarios but against my setup everything is still functional with the change.

I can't use the component since the a new authorization doesn't work for me.

@oliverlinsenmaier , can you give more information? Maybe some logs or screenshots? It's hard to help triage issues with no info to go on.

derjoerg commented 2 months ago

Hi everybody,

can someone confirm, that the updated parameter fixes the issue and the component is running with firmware 3.3.1?

derjoerg commented 2 months ago

When I do the parameter change - running with firmware 3.2.4 - I get the following error in the logs

Logger: homeassistant.config_entries
Quelle: config_entries.py:586
Erstmals aufgetreten: 09:50:34 (1 Vorkommnisse)
Zuletzt protokolliert: 09:50:34

Error setting up entry free@home for freeathome
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 586, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/__init__.py", line 84, in async_setup_entry
    await sysap.find_devices()
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 954, in find_devices
    await self.xmpp.find_devices(self._use_room_names, self._switch_as_x)
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 815, in find_devices
    parameters = get_parameters_by_parameter_ids(channel,parameter_ids)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 182, in get_parameters_by_parameter_ids
    param = get_parameter_by_parameter_id(xmlnode, type, parameter_id)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 159, in get_parameter_by_parameter_id
    if int(parameter.get('parameterId'), 16) == parameter_id:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: int() can't convert non-string with explicit base
kingsleyadam commented 2 months ago

parameters

@derjoerg , this seems to be unrelated to the above. Once of the devices has a parameter value that's not an integer. Or at least it's a value that can't be converted to an int.

Here's an example of some device parameters for one of my devices.

<parameters>
    <parameter i="pm0000" optional="false">
        <value>1</value>
    </parameter>
    <parameter i="pm0001" optional="false">
        <value>100</value>
    </parameter>
    <parameter i="pm0002" optional="false">
        <value>100</value>
    </parameter>
    <parameter i="pm0003" optional="false">
        <value>60</value>
    </parameter>
</parameters>

We'd need to know which parameter value that's causing the conversion issues on your system to figure out what's going on. You can do a configuration dump using the instructions in the README.md (note this should be done in Home Assistant, not the SysAP): https://github.com/jheling/freeathome/?tab=readme-ov-file#1-dumping-freehome-configuration

Then you can sift through the devices and check for any parameters within a device that do not have an integer/number value.

derjoerg commented 2 months ago

OK, I will dig through my config and reply back, but ... this only happens if I change the parameter from 2 to 1.

derjoerg commented 2 months ago

So, digging through the code I didn't found any non-integer/number values in a parameter-value, but I recognized the following: The majority of the parameter-values are defined as "valueEnum", "valueFloat", "valueUnsigned" and "valueSigned". But I also have some parameters, which are defined as "valueString" (without a value set) and they all below to my "SmartTouch 10" device.

Nevertheless, I also understand that I don't find a non-integer/number value as the problem only comes up, when I change the parameter to 1 (but then I can't do a dump anymore).

kingsleyadam commented 2 months ago

@derjoerg, Looks like I was pointing you to the wrong value, the conversion is taking place on the parameterId property of the parameter.

Here's what one of mine looks like.

<parameter i="pm0000" optional="false" dpt="14C8" nameId="003B" matchCode="FFFFFFFF" parameterId="00ED" accessLevel="Enduser" visible="true" writable="true" channelSelector="true" deviceChannelSelector="false" wizardOnly="false">

To test the values you can do a simple check in a Python console window if you have Python installed.

Bring up Python console

python3

Run the following Python code

parameter_id="00ED"
print(int(parameter_id, 16))

Output

❯ python3
Python 3.12.4 (main, Jun  6 2024, 18:26:44) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> parameter_id="00ED"
>>> print(int(parameter_id, 16))
237

Or use an online interpreter like: https://www.online-python.com/

image

That'll help nail down which device and parameter id that's giving problems.

derjoerg commented 2 months ago

So, searching for parameterId in the dump I got 2517 hits. Then searching for the regex 'parameterId="[A-Fa-f0-9]{4}"' I also got the same count, which means that all 2517 parameterIds have a correct hex-value.

kingsleyadam commented 2 months ago

So, searching for parameterId in the dump I got 2517 hits. Then searching for the regex 'parameterId="[A-Fa-f0-9]{4}"' I also got the same count, which means that all 2517 parameterIds have a correct hex-value.

Without having the config and being able to run it through the code it's hard to tell.

But this code is only being used for Thermostats, so if you don't have thermostats you could remove the FahThermostat class from the array here.

https://github.com/jheling/freeathome/blob/master/custom_components/freeathome/fah/pfreeathome.py#L792

kingsleyadam commented 2 months ago

2024-07-09 09:15:41.882 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 192.168.178.165 for freeathome Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 504, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/freeathome/init.py", line 84, in async_setup_entry await sysap.find_devices() File "/config/custom_components/freeathome/fah/pfreeathome.py", line 954, in find_devices await self.xmpp.find_devices(self._use_room_names, self._switch_as_x) File "/config/custom_components/freeathome/fah/pfreeathome.py", line 661, in find_devices root = ET.fromstring(config_without_names) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/xml/etree/ElementTree.py", line 1330, in XML parser.feed(text) xml.etree.ElementTree.ParseError: duplicate attribute: line 1, column 8918724

My only other guess is that when the Python code is running parameter.get('parameterId') the parameterId is being read in as a non-string value, probably an int. Only strings can be converted to int with explicit base. So we could also ensure the value is a string by updating the problematic line to:

if int(str(parameter.get('parameterId')), 16) == parameter_id:
derjoerg commented 2 months ago

Without having the config and being able to run it through the code it's hard to tell.

freeathome_dump.zip

But this code is only being used for Thermostats, so if you don't have thermostats you could remove the FahThermostat class from the array here.

This is not an option :)

derjoerg commented 2 months ago
if int(str(parameter.get('parameterId')), 16) == parameter_id:

Now I get the following error:

Logger: homeassistant.config_entries
Quelle: config_entries.py:586
Erstmals aufgetreten: 13:56:33 (1 Vorkommnisse)
Zuletzt protokolliert: 13:56:33

Error setting up entry free@home for freeathome
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 586, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/__init__.py", line 84, in async_setup_entry
    await sysap.find_devices()
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 954, in find_devices
    await self.xmpp.find_devices(self._use_room_names, self._switch_as_x)
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 815, in find_devices
    parameters = get_parameters_by_parameter_ids(channel,parameter_ids)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 182, in get_parameters_by_parameter_ids
    param = get_parameter_by_parameter_id(xmlnode, type, parameter_id)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 159, in get_parameter_by_parameter_id
    if int(str(parameter.get('parameterId')), 16) == parameter_id:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 16: 'None'
derjoerg commented 2 months ago

I solved it in a bit ugly way, only fighting the symptoms and not the root-cause:

def get_parameter_by_parameter_id(xmlnode, type, parameter_id):
    """Returns output parameter by parameter id."""
    for parameter in xmlnode.find(type).findall('parameter'):
        try:
            if int(parameter.get('parameterId'), 16) == parameter_id:
                return parameter.get('i')
        except TypeError:
            continue

    return None
kingsleyadam commented 2 months ago

I solved it in a bit ugly way, only fighting the symptoms and not the root-cause:

That works. I did run your config through the code and I wasn't able to replicate it locally. The only time this condition was true was for parameterID="001B" which is Temperature correction

The only other time this code was hit was for 0019 which is Eco temperature reduction. So hopefully neither one of those are critical for you, if not then you can live with the code change you have above.

You can add more logging to your code to know exactly what the value is that's failing. You'll have to update the entire function because they used a protected keyword type.

def get_parameter_by_parameter_id(xmlnode, parameter_type, parameter_id):
    """Returns output parameter by parameter id."""
    for parameter in xmlnode.find(parameter_type).findall('parameter'):
        LOG.info(f"channelId: {xmlnode.get('channelId')}; parameterId: {parameter.get('parameterId')}; type: {type(parameter.get('parameterId'))}")
        if int(parameter.get('parameterId'), 16) == parameter_id:
            return parameter.get('i')

    return None
kingsleyadam commented 2 months ago

Now I get the following error:

Logger: homeassistant.config_entries
Quelle: config_entries.py:586
Erstmals aufgetreten: 13:56:33 (1 Vorkommnisse)
Zuletzt protokolliert: 13:56:33

Error setting up entry free@home for freeathome
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 586, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/__init__.py", line 84, in async_setup_entry
    await sysap.find_devices()
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 954, in find_devices
    await self.xmpp.find_devices(self._use_room_names, self._switch_as_x)
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 815, in find_devices
    parameters = get_parameters_by_parameter_ids(channel,parameter_ids)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 182, in get_parameters_by_parameter_ids
    param = get_parameter_by_parameter_id(xmlnode, type, parameter_id)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/fah/pfreeathome.py", line 159, in get_parameter_by_parameter_id
    if int(str(parameter.get('parameterId')), 16) == parameter_id:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 16: 'None'

This makes sense, there's a parameter somewhere in your config file that doesn't have the parameterId attribute which then returns a None type object. I can reproduce this scenario by changing the code to use a attribute that doesn't exist. e.g. if int(parameter.get('attribute1'), 16) == parameter_id:

TypeError: int() can't convert non-string with explicit base

I don't see that in the config file you attached though, which is odd.

So the fix as I see it, if the parameter doesn't have a parameterId then it should be ignored.

if parameter.get('parameterId') is not None and int(parameter.get('parameterId'), 16) == parameter_id:
derjoerg commented 2 months ago

I just encountered, that I uploaded the dump with the parameter in getAll set to 2, here is the updated dump with the parameter set to 1.

freeathome_dump_small.zip

I implemented your above suggested line and I "only" have now a problem with one temperature controller (out of 10 I have) [ABB700DB2FFB].

Logger: homeassistant.components.climate
Quelle: helpers/entity_platform.py:598
Integration: Klima (Dokumentation, Probleme)
Erstmals aufgetreten: 15:28:49 (1 Vorkommnisse)
Zuletzt protokolliert: 15:28:49

Error adding entity climate.raumtemperaturregler_kuche for domain climate with platform freeathome
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 598, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 912, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1362, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1007, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1133, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1072, in __async_calculate_state
    if extra_state_attributes := self.extra_state_attributes:
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 318, in __getattribute__
    return super().__getattribute__(__name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/climate.py", line 81, in extra_state_attributes
    attr = {"valve":self.current_actuator,"temperature_correction":self.temperature_correction}
                    ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 318, in __getattribute__
    return super().__getattribute__(__name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/climate.py", line 119, in current_actuator
    return float(self.thermostat_device.current_actuator)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: float() argument must be a string or a real number, not 'NoneType'
kingsleyadam commented 2 months ago

I just encountered, that I uploaded the dump with the parameter in getAll set to 2, here is the updated dump with the parameter set to 1.

freeathome_dump_small.zip

I implemented your above suggested line and I "only" have now a problem with one temperature controller (out of 10 I have) [ABB700DB2FFB].

Logger: homeassistant.components.climate
Quelle: helpers/entity_platform.py:598
Integration: Klima (Dokumentation, Probleme)
Erstmals aufgetreten: 15:28:49 (1 Vorkommnisse)
Zuletzt protokolliert: 15:28:49

Error adding entity climate.raumtemperaturregler_kuche for domain climate with platform freeathome
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 598, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 912, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1362, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1007, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1133, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1072, in __async_calculate_state
    if extra_state_attributes := self.extra_state_attributes:
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 318, in __getattribute__
    return super().__getattribute__(__name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/climate.py", line 81, in extra_state_attributes
    attr = {"valve":self.current_actuator,"temperature_correction":self.temperature_correction}
                    ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 318, in __getattribute__
    return super().__getattribute__(__name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/freeathome/climate.py", line 119, in current_actuator
    return float(self.thermostat_device.current_actuator)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: float() argument must be a string or a real number, not 'NoneType'

So it seems setting the "debug" value to 1 removes some other bit of information. This has been quite the slog to triage between the code and the XML file formats.

You may have to setting the debug value back to 2 and figure out what XML issues there are.

derjoerg commented 2 months ago

Ok,

so at the moment I will stay with 2 and will not update the firmware to 3.3.1.

I don't understand why only one of my roomtemperaturecontrollers have such a problem and all the others are good. I don't see much difference comparing the xml of similar devices.

steffenaxer commented 2 months ago

@derjoerg May I ask if some of them have a temperature correction and some do not have any correction? It might be that the behaviour has changed and if no correction is present the controller return none value instead of 0?

derjoerg commented 2 months ago

@steffenaxer I also thought about that and went in the Web-GUI of the SysAp and for each controller I changed the "temperature correction" to 0.5 saved it and returned to 0.0 and saved it. No change in behaviour

steffenaxer commented 2 months ago

Without having the config and being able to run it through the code it's hard to tell.

freeathome_dump.zip

But this code is only being used for Thermostats, so if you don't have thermostats you could remove the FahThermostat class from the array here.

This is not an option :)

Is this a current freeathome dump with the new firmware? @derjoerg

derjoerg commented 2 months ago

Is this a current freeathome dump with the new firmware? @derjoerg

No! I'm still on 3.2.4. So freeathome_dump.zip is with the getAll-parameter 2 and freeathome_dump_small.zip is with the getAll-parameter 1

I heavily rely on my freeathome integration in HA so for now I don't do the update

steffenaxer commented 2 months ago

Could anyone who has 3.3.1 installed upload his backup from the freeathome backup service?

image

The content that is received from within HA and which is generated by freeathome sysAp WebApp is to my knowledge very similar. I will than try to read in the backup (which is inside also an xml). Maybe we see than more hints. @kingsleyadam @oliverlinsenmaier

kingsleyadam commented 2 months ago

I've closed my PR for now as it doesn't seem to be a valid solution.

derjoerg commented 2 months ago

Hi,

I just had a conversation with someone in the Busch-Jäger community and this guy upgraded to 3.3.1 and everything is still working https://community.busch-jaeger.de/howto-ansehen/beta-version-f-r-das-busch-free-home-matter-addon-verf-gbar#@66979aba58715c26231fa179

Sorry it is in german

steffenaxer commented 2 months ago

I updated now also to firmware 3.3.1. HA runs fine for me, even after a restart of the HA core.

oliverlinsenmaier commented 2 months ago

Thanks to @steffenaxer for the support enabling a custom debugging on my side and fixing the issue with the XML available. This is really awesome - Thank you!

derjoerg commented 2 months ago

Thanks to @steffenaxer for the support enabling a custom debugging on my side and fixing the issue with the XML available. This is really awesome - Thank you!

What was the problem and the resolution?

steffenaxer commented 2 months ago

I will provide a PR within next minutes. The problem are again duplicated attributes delivered in the xml.

iBlueDragon commented 2 months ago

Thanks to @steffenaxer ! Had the described issue after the update and the fix worked for me.

Triple5soul89ny commented 2 months ago

Sorry, but where do I have to place the code?

iBlueDragon commented 2 months ago

@Triple5soul89ny : See here https://github.com/jheling/freeathome/pull/192/files It tells you which file and what to change. The changes can be made with a simple editor.

Alox-K commented 2 months ago

Thank you very much @steffenaxer for this bugfix. I just deleted the old code and added the new lines within homeassistant, using the file editor and it worked pretty well! Thank you for support.

frontside76 commented 2 months ago

Have updated SysAP to 3.3.2 and updated free@home Integration in HACS to the new Version 1364e7e.

Everthing works for me.