Add support for Shelly enum virtual component (#121997)

* Support enum virtual component

* Add tests

* Cleaning

* Improve test for select

* Use values

* Update tests

* Use the option title for sensor

---------

Co-authored-by: Maciej Bieniek <478555+bieniu@users.noreply.github.com>
This commit is contained in:
Maciej Bieniek 2024-07-18 16:55:14 +02:00 committed by GitHub
parent f479b64ff9
commit bf0e5baa76
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 421 additions and 4 deletions

View file

@ -323,7 +323,7 @@ def get_rpc_channel_name(device: RpcDevice, key: str) -> str:
return f"{device_name} {key.replace(':', '_')}"
if key.startswith("em1"):
return f"{device_name} EM{key.split(':')[-1]}"
if key.startswith(("boolean:", "number:", "text:")):
if key.startswith(("boolean:", "enum:", "number:", "text:")):
return key.replace(":", " ").title()
return device_name