home-assistant / home-assistant/android

Create strongly typed enity class for well known entity

Open
#5,340 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
3.9k
Forks
1.1k
Avg merge
1d 12h
Merged PRs (30d)
81

Description

With the migration to Koltinx serialization we've lost the generic type on the Entity class. It was most of the time used with `Any` and was loosing the interest of having a generic. The only case where it was used properly was for `ZoneAttributes`.

We should aim to do this more to enforce some proper checks on the types on well known types. It is important that we keep a certain flexibility still because we don't know all the Entity that exist in the ecosystem of Home Assistant.

Tips: We could do something like in `SocketResponse` with a sealed class and a default serializer to get all the values if we are not able to detect the type of the Entity properly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.