StyraHem / ShellyForHASS

Shelly smart home platform for Home Assistant
MIT License
619 stars 111 forks source link

Fix #659: Invalid entity ID since Home Assistant 2022.03.0 #660

Closed JurajNyiri closed 2 years ago

JurajNyiri commented 2 years ago

Home Assistant 2022.03.0 introduced following breaking change for this repo;

Helper: split_entity_id() split_entity_id will now raise a ValueError if the passed value does not follow the basic entity ID format (.).

Previously it could return a list with a single item.

(@balloob - https://github.com/home-assistant/core/pull/66835)

This change results in a bug where many entities are not loaded because of invalid format returned from ShellyDevice.init function. As per the new Home Assistant version, entity_id always needs to include platform.

This was already done properly in some places, like for example ShellyVersion sensor, where platform is added. However, this does not happen in all the places, which this PR now fixes.

This PR adds platform to every entity_id similarly to how it was done in ShellyVersion class.

Warning: I use only binary_sensor, switch and sensor entities from Shelly. I could not test light and cover platforms.

Padm59 commented 2 years ago

This has to be implemented fast pls