Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot rename device in HA #74

Closed
parautenbach opened this issue Jan 16, 2024 · 11 comments · Fixed by #76
Closed

Cannot rename device in HA #74

parautenbach opened this issue Jan 16, 2024 · 11 comments · Fixed by #76
Assignees
Labels
bug Something isn't working

Comments

@parautenbach
Copy link

parautenbach commented Jan 16, 2024

Adding my new aircon (a 9000 BTU Midea Xtreme Inverter) through this integration works just fine. The msmart tool also reports it as supported.

The problem is that when I rename the device (and choose the option for HA to also rename all associated entities with it), I end up with a broken integration: Only the climate entity gets renamed and some entities become unavailable.

Screenshot 2024-01-16 at 17 08 21 Screenshot 2024-01-16 at 17 08 35
$ msmart-ng discover
INFO:msmart.cli:Discovering all devices on local network.
INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com (China: False).
INFO:msmart.lan:Creating new connection to 192.168.0.xxx:6444.
INFO:msmart.lan:Authenticating with 192.168.0.xxx:6444.
INFO:msmart.lan:Authenticating with 192.168.0.xxx:6444.
INFO:msmart.lan:Authentication successful. Expiration: 2024-01-17T03:05:04, Local key: redacted
INFO:msmart.cli:Found 1 devices.
INFO:msmart.cli:Found device:
{'ip': '192.168.0.xxx', 'port': 6444, 'id': redacted, 'online': True, 'supported': True, 'type': <DeviceType.AIR_CONDITIONER: 172>, 'name': 'net_ac_0638', 'sn': 'redacted', 'key': 'redacted', 'token': 'redacted'}

Relevant piece of the HA log:

Jan 16 16:58:36 homeassistant hass[383372]: 2024-01-16 16:58:36.291 WARNING (MainThread) [msmart.device.AC.command] Unknown capability. ID: 0x  40, Size: 1.
Jan 16 16:58:36 homeassistant hass[383372]: 2024-01-16 16:58:36.426 WARNING (MainThread) [msmart.device.AC.command] Unsupported capability. ID: 0x0009, Size: 1.
Jan 16 16:58:36 homeassistant hass[383372]: 2024-01-16 16:58:36.426 WARNING (MainThread) [msmart.device.AC.command] Unsupported capability. ID: 0x000A, Size: 1.
@mill1000
Copy link
Owner

mill1000 commented Jan 16, 2024

Hey there. I'll look into this, perhaps its related to the following changes from the HA side:

Jan 16 16:58:36 homeassistant hass[383372]: 2024-01-16 16:58:36.291 WARNING (MainThread) [msmart.device.AC.command] Unknown capability. ID: 0x  40, Size: 1.
Jan 16 16:58:36 homeassistant hass[383372]: 2024-01-16 16:58:36.426 WARNING (MainThread) [msmart.device.AC.command] Unsupported capability. ID: 0x0009, Size: 1.
Jan 16 16:58:36 homeassistant hass[383372]: 2024-01-16 16:58:36.426 WARNING (MainThread) [msmart.device.AC.command] Unsupported capability. ID: 0x000A, Size: 1.

These are harmless. The last 2 will be resolved in the next msmart-ng release, and are related to #69

@mill1000 mill1000 self-assigned this Jan 16, 2024
@mill1000 mill1000 added the bug Something isn't working label Jan 16, 2024
@parautenbach
Copy link
Author

Thanks a mil for the quick reply.

I was wondering whether it could be related to those changes, but I thought it's so long ago that there might've been more issues raised if that was the case. Maybe I'm the only one renaming things. :-)

What would be the workaround for now? Don't use the device renaming feature, or if I do, select the option to say "don't rename entities" and then rename entities individually?

I thought the log messages were maybe related, as they got emitted at the same time, but good to know it's harmless.

@mill1000
Copy link
Owner

Thanks a mil for the quick reply.

I was wondering whether it could be related to those changes, but I thought it's so long ago that there might've been more issues raised if that was the case. Maybe I'm the only one renaming things. :-)

There's plenty of cruft from older versions of HA still in this codebase.

What would be the workaround for now? Don't use the device renaming feature, or if I do, select the option to say "don't rename entities" and then rename entities individually?

No idea! Might be worth a shot. I'd remove and re-add the device to the integration first to hopefully start on a clean slate.

@mill1000
Copy link
Owner

Just created a PR with a potential fix: #76

Would you be able to test? My unit is offline for the season so I can't be of much help.

@parautenbach
Copy link
Author

Sure! I'll try my best to do it tomorrow.

@parautenbach
Copy link
Author

@mill1000 I got around to test it.

The good news is that after renaming the device all entities are still available.

The bad news is that only the climate entity got renamed (I picked the option to rename all entities).

@mill1000
Copy link
Owner

Hm..just did a test myself.

The first attempt was odd. Some of the entities had IDs like sensor.none_indoor_temperature. I removed and re-configured the device and the IDs came back as expected. I was able to successfully rename this device and it's entities.

Did you remove and re-configure your device after updating to the branch?

@parautenbach
Copy link
Author

Did you remove and re-configure your device after updating to the branch?

A kind of third option: I had a second climate entity that I had added (but no renaming, so it was as added) before manually updating the code.

I repeated your steps now and I can confirm it renamed all the entities correctly. Awesome!

@parautenbach
Copy link
Author

Sorry, should probably keep this open until merged/released. :-)

@mill1000
Copy link
Owner

Cool. I'll get this merged and released soon. I just want to perform some tests so I understand how a user updating to this change is impacted.

@parautenbach
Copy link
Author

Thanks a mil. I'm happy to do more testing too, if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants