home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.61k stars 30.37k forks source link

Eve Energy (Matter Beta Firmware) stops working #89086

Closed clickme83 closed 1 year ago

clickme83 commented 1 year ago

The problem

After Adding Eve Energy via iOS Companion App to HA, the Device is controllable for about 5 Minutes. After that Time the Device remains unavailable.

I have added the Device to HomeKit and it still works. Screenshot 2023-03-03 at 09 52 18

What version of Home Assistant Core has the issue?

core-2023.3.0

What was the last working version of Home Assistant Core?

-

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Matter

Link to integration documentation on our website

https://www.home-assistant.io/integrations/matter/

Diagnostics information

config_entry-matter-da9f43167040f75b6cdceed4c22f5a25.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.matter
Source: components/matter/__init__.py:127 
Integration: Matter (BETA) (documentation, issues) 
First occurred: 2 March 2023 at 12:55:11 (3 occurrences) 
Last logged: 2 March 2023 at 12:55:21

Unexpected exception: Incorrect padding
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/matter/__init__.py", line 127, in _client_listen
    await matter_client.start_listening(init_ready)
  File "/usr/local/lib/python3.10/site-packages/matter_server/client/client.py", line 289, in start_listening
    self._handle_incoming_message(msg)
  File "/usr/local/lib/python3.10/site-packages/matter_server/client/client.py", line 328, in _handle_incoming_message
    self._handle_event_message(msg)
  File "/usr/local/lib/python3.10/site-packages/matter_server/client/client.py", line 361, in _handle_event_message
    self._nodes[node_id].update_attribute(attribute_path, new_value)
  File "/usr/local/lib/python3.10/site-packages/matter_server/client/models/node.py", line 324, in update_attribute
    self.endpoints[endpoint_id].set_attribute_value(attribute_path, new_value)
  File "/usr/local/lib/python3.10/site-packages/matter_server/client/models/node.py", line 177, in set_attribute_value
    attribute_value = parse_value(
  File "/usr/local/lib/python3.10/site-packages/matter_server/common/helpers/util.py", line 116, in parse_value
    return [
  File "/usr/local/lib/python3.10/site-packages/matter_server/common/helpers/util.py", line 117, in <listcomp>
    parse_value(name, subvalue, get_args(value_type)[0])
  File "/usr/local/lib/python3.10/site-packages/matter_server/common/helpers/util.py", line 113, in parse_value
    return dataclass_from_dict(value_type, value)
  File "/usr/local/lib/python3.10/site-packages/matter_server/common/helpers/util.py", line 214, in dataclass_from_dict
    **{
  File "/usr/local/lib/python3.10/site-packages/matter_server/common/helpers/util.py", line 215, in <dictcomp>
    field.name: parse_value(
  File "/usr/local/lib/python3.10/site-packages/matter_server/common/helpers/util.py", line 177, in parse_value
    return b64decode(value.encode())
  File "/usr/local/lib/python3.10/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @home-assistant/matter, mind taking a look at this issue as it has been labeled with an integration (matter) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `matter` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign matter` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


matter documentation matter source (message by IssueLinks)

trrevvorr commented 1 year ago

I'm seeing the same error for the Eve Door & Window sensor. I've added this sensor via thread (using Sky Connect). The sensor functions normally in HomeKit but does not function in Home Assistant (never registers as closed, alternates between open and unavailable).

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/matter/__init__.py", line 127, in _client_listen
    await matter_client.start_listening(init_ready)
  File "/usr/local/lib/python3.10/site-packages/matter_server/client/client.py", line 289, in start_listening
    self._handle_incoming_message(msg)
  File "/usr/local/lib/python3.10/site-packages/matter_server/client/client.py", line 328, in _handle_incoming_message
    self._handle_event_message(msg)
  File "/usr/local/lib/python3.10/site-packages/matter_server/client/client.py", line 361, in _handle_event_message
    self._nodes[node_id].update_attribute(attribute_path, new_value)
  File "/usr/local/lib/python3.10/site-packages/matter_server/client/models/node.py", line 324, in update_attribute
    self.endpoints[endpoint_id].set_attribute_value(attribute_path, new_value)
  File "/usr/local/lib/python3.10/site-packages/matter_server/client/models/node.py", line 177, in set_attribute_value
    attribute_value = parse_value(
  File "/usr/local/lib/python3.10/site-packages/matter_server/common/helpers/util.py", line 116, in parse_value
    return [
  File "/usr/local/lib/python3.10/site-packages/matter_server/common/helpers/util.py", line 117, in <listcomp>
    parse_value(name, subvalue, get_args(value_type)[0])
  File "/usr/local/lib/python3.10/site-packages/matter_server/common/helpers/util.py", line 177, in parse_value
    return b64decode(value.encode())
  File "/usr/local/lib/python3.10/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding
marcelveldt commented 1 year ago

There is a known issue with the Linux Network Manager and thread, causing the devices to become unavailable. A fix will be published soon for HAOS.

I will also have a look at that parse issue (which should be unrelated but we need to fix)

wastez commented 1 year ago

There is a known issue with the Linux Network Manager and thread, causing the devices to become unavailable. A fix will be published soon for HAOS.

I will also have a look at that parse issue (which should be unrelated but we need to fix)

Would be really great if this issue would be fixed soon because i have the problem with all thread things which i tried.

Can you tell us when this fix will be released?

Thank you.

marcelveldt commented 1 year ago

@wastez this fix will be available in HAOS version 10 which will be available shortly, if you want to test it now, you will have to switch to the dev channel on your HAOS machine.

wastez commented 1 year ago

@marcelveldt Yes would be great, so dev channel is already HAOS V10?

marcelveldt commented 1 year ago

Correct, if you switch to devchannel on HAOS you get the new HAOS 10 with the network manager patch. If you're willing to test it, please let us know your findings, thanks!

wastez commented 1 year ago

Correct, if you switch to devchannel on HAOS you get the new HAOS 10 with the network manager patch. If you're willing to test it, please let us know your findings, thanks!

Ok will test it. Is there a way to just switch haos to dev channel? Just found to put the hole ha to dev channel.

marcelveldt commented 1 year ago

No that is not possible, it's all or nothing I'm afraid.

wastez commented 1 year ago

No that is not possible, it's all or nothing I'm afraid.

Ok. Just on question left. Will the addons work in Beta too, or could there be problems? I think they should work but maybe so much in the Code has changed.

wastez commented 1 year ago

So now i upgraded to the new Version. Now my mqtt broker isn't starting anymore and the exact same problem which is reported above is still happening.

So now i try to revert my system.

clickme83 commented 1 year ago

I joined the beta channel, but no updates were available. I'll wait for 2023.04

Edit: dev, not beta. The update is installing

wastez commented 1 year ago

@clickme83 You have to choose the dev channel, you have to do this as follow: ha supervisor options --channel dev ha supervisor reload ha os update

ok, sorry, saw too late you already got it. Tell me if this changed something for you, my matter device still had the same problem. So i reverted back to my old system.

clickme83 commented 1 year ago

First of all, after the update all ip configuration was gone. Second, nothing has changed with my matter device. I removed the Matter add-on, reset the device and tried it again but now the device is not connecting to ha.

So I reverted the snapshot of my ha-vm back to 9.5

wastez commented 1 year ago

Same here, was waste of time. The network manager doesn't seem to be the problem here. The thing is i found it already strange because it happens much to fast. On my system it takes no 10 minutes until this happens and none auf my external tbr have changed in the meanwhile (no reboot or something like that)

It could be that it will have an effect on pure thread communication. (Because there it takes longer until it fails)

clickme83 commented 1 year ago

Until I tried the version 10, i saw a UDP Error in the Logs. That's why I gave the new Patch a try.

For now, I cannot reproduce the Error

wastez commented 1 year ago

@clickme83 So it doensn't get unavailable anymore?

clickme83 commented 1 year ago

No, because I can't add the device anymore... Very frustrating

wastez commented 1 year ago

looooool, ok...... thats a fix too....... I doens't repair it but the network manager bug shouldn't make a difference if it get repaired because the problem are dead routes.

wastez commented 1 year ago

Anything new here because of the "Unexpected exception: Incorrect padding" error?

As I already said, this error seem not have something to do with the ghost route issue of nm.

marcelveldt commented 1 year ago

ah yes, this is reproduced now (finally) and I'll create a patch tomorrow

wastez commented 1 year ago

Ok that would be really great. Tell me if you need someone to test.

Thx for you work.

clickme83 commented 1 year ago

Lol. Since I reverted my System and remove the Device I wasn't able to add it back.

Updated all my iDevices to 16.4 and was able to add the Outlet to Home and HA. Most of the time since I added it, the device is reachable! Every hour its unreachable for a few seconds Screenshot 2023-03-28 at 08 25 32

clickme83 commented 1 year ago

And we're back in business: Screenshot 2023-03-29 at 09 07 13

The device works properly in HomeKit.

wastez commented 1 year ago

Ok, now it doesn't become unavailable. (but cant say it for sure, too short is the time i use it in the new version)

Now it is working after a restart but then the following happens every time the motion detector sends informations:

2023-03-31 10:47:07 core-matter-server chip.DMG[128] INFO Refresh LivenessCheckTime for 121500 milliseconds with SubscriptionId = 0xa6f417b3 Peer = 01:0000000000000001
2023-03-31 10:47:07 core-matter-server chip.EM[128] INFO <<< [E:16416r M:157483658 (Ack:159322076)] (S) Msg TX to 1:0000000000000001 [8504] --- Type 0001:01 (IM:StatusResponse)
2023-03-31 10:47:07 core-matter-server chip.IN[128] INFO (S) Sending msg 157483658 on secure session with LSID: 37151
2023-03-31 10:47:07 core-matter-server chip.EM[128] INFO >>> [E:16416r M:159322077 (Ack:157483658)] (S) Msg RX from 1:0000000000000001 [8504] --- Type 0000:10 (SecureChannel:StandaloneAck)
2023-03-31 10:47:18 core-matter-server chip.EM[128] INFO >>> [E:16419r M:159322078] (S) Msg RX from 1:0000000000000001 [8504] --- Type 0001:05 (IM:ReportData)
Exception ignored on calling ctypes callback function: 
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/chip/clusters/Attribute.py", line 882, in _OnReportEndCallback
    closure.handleReportEnd()
  File "/usr/local/lib/python3.10/site-packages/chip/clusters/Attribute.py", line 787, in handleReportEnd
    self._handleReportEnd()
  File "/usr/local/lib/python3.10/site-packages/chip/clusters/Attribute.py", line 750, in _handleReportEnd
    TypedAttributePath(Path=change), self._subscription_handler)
  File "/usr/local/lib/python3.10/site-packages/chip/clusters/Attribute.py", line 150, in __init__
    raise Exception("Schema not found")
Exception: Schema not found
2023-03-31 10:47:19 core-matter-server chip.DMG[128] INFO Refresh LivenessCheckTime for 121500 milliseconds with SubscriptionId = 0xa6f417b3 Peer = 01:0000000000000001
2023-03-31 10:47:19 core-matter-server chip.EM[128] INFO <<< [E:16419r M:157483659 (Ack:159322078)] (S) Msg TX to 1:0000000000000001 [8504] --- Type 0001:01 (IM:StatusResponse)
2023-03-31 10:47:19 core-matter-server chip.IN[128] INFO (S) Sending msg 157483659 on secure session with LSID: 37151
2023-03-31 10:47:19 core-matter-server chip.EM[128] INFO >>> [E:16419r M:159322079 (Ack:157483659)] (S) Msg RX from 1:0000000000000001 [8504] --- Type 0000:10 (SecureChannel:StandaloneAck)
clickme83 commented 1 year ago

After Power Outage the Outlet is unavailable again:

2023-04-11 08:31:56 core-matter-server chip.SC[126] INFO Initiating session on local FabricIndex 1 from 0x000000000001B669 -> 0x0000000000000001 2023-04-11 08:31:56 core-matter-server chip.EM[126] INFO <<< [E:61617i M:57810606] (U) Msg TX to 0:0000000000000000 [0000] --- Type 0000:30 (SecureChannel:CASE_Sigma1) 2023-04-11 08:31:56 core-matter-server chip.IN[126] INFO (U) Sending msg 57810606 to IP address 'UDP:[fd0d:b14:587b:0:cc44:8fcf:6e2:33a2]:5540' 2023-04-11 08:31:56 core-matter-server chip.SC[126] INFO Sent Sigma1 msg 2023-04-11 08:31:57 core-matter-server chip.IN[126] INFO (U) Sending msg 57810606 to IP address 'UDP:[fd0d:b14:587b:0:cc44:8fcf:6e2:33a2]:5540' 2023-04-11 08:31:58 core-matter-server chip.IN[126] INFO (U) Sending msg 57810606 to IP address 'UDP:[fd0d:b14:587b:0:cc44:8fcf:6e2:33a2]:5540' 2023-04-11 08:32:00 core-matter-server chip.IN[126] INFO (U) Sending msg 57810606 to IP address 'UDP:[fd0d:b14:587b:0:cc44:8fcf:6e2:33a2]:5540' 2023-04-11 08:32:03 core-matter-server chip.IN[126] INFO (U) Sending msg 57810606 to IP address 'UDP:[fd0d:b14:587b:0:cc44:8fcf:6e2:33a2]:5540' 2023-04-11 08:32:07 core-matter-server chip.EM[126] ERROR Failed to Send CHIP MessageCounter:57810606 on exchange 61617i sendCount: 4 max retries: 4 2023-04-11 08:32:10 core-matter-server chip.SC[126] ERROR CASESession timed out while waiting for a response from the peer. Current state was 1 2023-04-11 08:32:10 core-matter-server matter_server.server.device_controller[126] WARNING Unable to contact Node 1, we will retry later in the background. Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/matter_server/server/device_controller.py", line 409, in subscribe_node await self._call_sdk(self.chip_controller.ResolveNode, nodeid=node_id) File "/usr/local/lib/python3.10/site-packages/matter_server/server/device_controller.py", line 522, in _call_sdk await self.server.loop.run_in_executor( File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.10/site-packages/chip/ChipDeviceCtrl.py", line 588, in ResolveNode self.GetConnectedDeviceSync(nodeid, allowPASE=False) File "/usr/local/lib/python3.10/site-packages/chip/ChipDeviceCtrl.py", line 827, in GetConnectedDeviceSync returnErr.raise_on_error() File "/usr/local/lib/python3.10/site-packages/chip/native/__init__.py", line 66, in raise_on_error raise self.to_exception() chip.exceptions.ChipStackError: ../src/protocols/secure_channel/CASESession.cpp:295: CHIP Error 0x00000032: Timeout The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/matter_server/server/device_controller.py", line 551, in _check_subscriptions_and_interviews await self.subscribe_node(node_id) File "/usr/local/lib/python3.10/site-packages/matter_server/server/device_controller.py", line 412, in subscribe_node raise NodeNotResolving(f"Failed to resolve node {node_id}") from err matter_server.common.errors.NodeNotResolving: Failed to resolve node 1

marcelveldt commented 1 year ago

@clickme83 try not to reply on already closed issues with a different issue. Create a new issue for a new issue. After power outage the subscription is lost to the device and that will be auto recovered within 2 minutes. If it does not auto recover, try to restart the Matter server. If that brings the device back alive, create a new issue report because that would be a bug. If the device stays unavailable, its a device specific issue.