Failure with Home Assistant 2023.11
Home Assistant 2023.11 started reporting attributes for lights that are off as None, instead of omitting them.
This script operated under the assumption that we could just call .get("brightness", 0)
and always get a valid value.
It needs updated to work on the latest version, and some other cleanup would be nice.