add percentage (DPT_Scaling) KNX sensors#8168
Conversation
1. moved basic functionality to KNXSensorBaseClass instead of KNXSensorFloatClass 2. added "if" clause in setup for a "percentage" sensor type and added KNXSensorDPTScalingClass
Updated convert method base sensor class to avoid lint warning (R201 - Method could be a function)
|
👍 |
balloob
left a comment
There was a problem hiding this comment.
Please add a PLATFORM_SCHEMA based on voluptuous that validates CONF_TYPE is one of the approved values.
Example from KNX light: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/light/knx.py#L20-L24
|
No problem. Thanks for the quick feedback. |
1. added SCHEMA extension for defined keywords 2. moved fixed data for internal settings out of sensor logic 3. moved everything into standard KNXSensor object 4. added parsing of extra config parameters in __init__
|
@balloob : that's the best I could do |
|
Thanks! |
|
@daBONDi @Julius2342 @open-homeautomation : I should have thought of asking earlier but you three seem to have made the biggest changes on the knx platform to date. I had to make a larger than expected change to this PR to add in a PLATFORM_SCHEMA so it may have side-effects on other knx sensors but don't have enough devices to test all types. Do you think you could check your devices for any issues for the lux/speed/temp sensors on the latest dev branch? |
|
Temp sensors here are working fine. I don't have any Lux/speed sensors, but I would not expect problems. |
* add percentage (DPT_Scaling) KNX sensors 1. moved basic functionality to KNXSensorBaseClass instead of KNXSensorFloatClass 2. added "if" clause in setup for a "percentage" sensor type and added KNXSensorDPTScalingClass * support-knx-percentage-sensor: lint correction Updated convert method base sensor class to avoid lint warning (R201 - Method could be a function) * added PLATFORM_SCHEMA for configuration 1. added SCHEMA extension for defined keywords 2. moved fixed data for internal settings out of sensor logic 3. moved everything into standard KNXSensor object 4. added parsing of extra config parameters in __init__ * correct lint errors on support-knx-percentage-sensor
KNXSensorFloatClass
Description:
This change is intended to provide support for additional data items on devices such as thermostats/covers that use the scaled percentage data format (1 byte). The existing sensors use the 2 byte float data format.
Related issue (if applicable): fixes #
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2876
Example entry for
configuration.yaml(if applicable):Checklist:
Note: there are no new dependencies and no new files
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
toxrun successfully. Your PR cannot be merged unless tests passREQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.