Add quirks v2 siren entity based on SwitchMetadata#667
Draft
TheJulianJES wants to merge 7 commits intozigpy:devfrom
Draft
Add quirks v2 siren entity based on SwitchMetadata#667TheJulianJES wants to merge 7 commits intozigpy:devfrom
SwitchMetadata#667TheJulianJES wants to merge 7 commits intozigpy:devfrom
Conversation
Co-authored-by: puddly <32534428+puddly@users.noreply.github.com>
Contributor
|
Maybe we add another method to the builder to make it clearer we are making a siren ex: QuirkBuilder(zigpy_dev.manufacturer, zigpy_dev.model)
.switch(
general.Basic.AttributeDefs.power_source.name,
general.Basic.cluster_id,
on_value=1,
off_value=0,
entity_platform=EntityPlatform.SIREN,
translation_key="siren",
fallback_name="Siren",
)
.add_to_registry()
)makes sense to us but maybe will confuse potential contributors. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DRAFT. TODO: Requires zigpy change adding
SIREN = "siren"toEntityPlatform.Based on:
Proposed change
This allows quirks v2 entities to provide
entity_platform=EntityPlatform.SIRENfor.switch()entities to create a siren entity on the HA side, instead of a switch entity.Additional information
A lot of the logic and tests are copied from the switch entity, but there's no nice way around that. A downside of using
SwitchMetadatais that we also support the "inverter attribute" logic which is not really necessary in all cases.. I thought of just ignoring that for the siren platform, but it's kept in here for now.The logic is more similar to
ConfigurableAttributeSwitchand its tests then.It's a bit weird doing
.switchto create a siren entity, but it's very similar to what we do with.enumto crate an enum sensor entity when providing a differententity_platform(andentity_typedue to HA restrictions).