In this PR support for light entities are introduced. Light entities support toggling the light on/off, setting the brightness, setting the color and turning on effects.
This new entity is somewhat more complex than previous entities as it requires more data to be passed in the state payload.
Previously entities did not support setting the schema of the state payload, as states consisted of either "ON"/"OFF". However, lights require passing json formatted data in the state payload. One downside of introducing this is that the "schema" keyword is reserved by the pydantic basemodel. This has been solved by introducing an alias for said keyword. I don't really like this approach but it is probably the easiest way to fix this without tearing up the model hierarchy.
Tests have also been added for the light entity.
README has been updated with a usage example for the new entity.
License Acceptance
[x] This repository is Apache version 2.0 licensed and by making this PR, I am contributing my changes to the repository under the terms of the Apache 2 license.
Type of changes
[ ] Add/update a helper script
[ ] Add/update link to an external resource like a blog post or video
[x] Any scripts added use #!/usr/bin/env interpreter instead of potentially platform-specific direct paths (#!/bin/sh is an allowed exception)
[x] Scripts added/updated in this PR are all marked executable.
[x] Scripts added/updated in this PR do not have a language file extension unless they are meant to be sourced and not run standalone. No one should have to know if a script was written in bash, python, ruby or whatever. Not including file extensions makes it easier to rewrite the script in another language later without having to change every reference to the previous version.
[x] I have confirmed that any links added or updated in my PR are valid.
This change introduces support for light entities
Description
In this PR support for light entities are introduced. Light entities support toggling the light on/off, setting the brightness, setting the color and turning on effects. This new entity is somewhat more complex than previous entities as it requires more data to be passed in the state payload. Previously entities did not support setting the schema of the state payload, as states consisted of either "ON"/"OFF". However, lights require passing json formatted data in the state payload. One downside of introducing this is that the "schema" keyword is reserved by the pydantic basemodel. This has been solved by introducing an alias for said keyword. I don't really like this approach but it is probably the easiest way to fix this without tearing up the model hierarchy.
Tests have also been added for the light entity.
README has been updated with a usage example for the new entity.
License Acceptance
Type of changes
Checklist
#!/usr/bin/env interpreter
instead of potentially platform-specific direct paths (#!/bin/sh
is an allowed exception)