-
-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix multiple parameters for hass Discovery #36
Conversation
4baf5ef
to
4bb2601
Compare
Co-authored-by: AlCalzone <[email protected]>
Ok I guess @robertsLando has to chime in here. I don't know the specifics how things are handled on this side. |
lib/ZwaveClient.js
Outdated
@@ -650,7 +650,7 @@ function updateValueMetadata (zwaveNode, zwaveValue, zwaveValueMeta) { | |||
readable: zwaveValueMeta.readable, | |||
writeable: zwaveValueMeta.writeable, | |||
description: zwaveValueMeta.description, | |||
label: zwaveValueMeta.label, | |||
label: zwaveValueMeta.label || zwaveValue.propertyName, // when label is missing, re use propertyName. Usefull for webinterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlCalzone could the label be undefined or is this caused by an error on zwavejs? If it's the second case I would remove this so we can detect undefined labels and fix them on zwavejs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Label can be undefined if we don't set it in zwave-js. Your code should be prepared for that possibility.
But as I wrote in slack, we should find those locations and eliminate them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so in poor words should I keep this change or remove this so we can detect undefined labels?
I think it's a good fix but we would never see the undefined labels if I keep this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could have a suffix/prefix Property and help us still know what is, but not let it undifined
something like
label: zwaveValueMeta.label || ("%s - property", zwaveValue.propertyName),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be another valid solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think more beautifull would be:
label: zwaveValueMeta.label || ("%s (property)", zwaveValue.propertyName),
pushing this as change. If you prefer different approach. please comment here
@billiaz There are some lint issues |
my mac has some issues with lint-fix/linting this issue can probably be solved
by making it:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@billiaz Seems thre are still some lint issues?
|
* feat: bind target values to current * feat(wip): hass discovery * fix: better discovery support * fix: hass socket apis * fix: alarmType and meterType mapping * fix: use commandClasses instead of hardCoded numbers * refactor: better docs on methods * fix: converted some values in hass devices.js * fix: converted some more values in devices.js * feat: skip discovety flag * fix: lint issues * fix: ignore discovery * fix: converted some more valueIds of devices.json * fix: lint issues * fix: push target value in values * fix: mode_map and fan _mode_map * fix: allow empty json device * fix: added ccSpecific to value meta * fix: setpoints valueIds * fix: commandclasses import * fix: set defaiult endpoint to 0 * feat: added ccSpecific * fix: undefined in num2hex * fix: use 5.4.1-alpha.0 * fix: probably fix to map template bug * fix: mode_map template creation * fix: added brackets to keys * fix: added comments * fix: getMappedValuesTemplate check type of value * fix: lint errors * docs: fixed hass docs * docs: migration and why zwavejs * docs: bitmask and color values * fix: lint issues * docs: fix for review * fix: typo * fix: lint on readme * docs: fix * docs: added some points to why zwavejs section * fix: payload parse of modes when discovery is enabled * fix: missing ccSpecific values (#35) * fix: binary sensors, units and undefined labels (#36) * fix: lint issues Co-authored-by: V Aretakis <[email protected]>
This pull request applies two changes:
** Binary Sensor discovery**
discovery was not working, as the sensorTypeName was a number and not the name of sensor
changed the value used for this from Translated to just valueId.property
Missing Label
There are cases where the Label is missing from a Property. We can use the PropertyName in that cases.
I have create a small change in code to make this happen. Because my code was based on hassDiscovery branch, I am also making a pull request with that branch as target.
I have tested a container and I do see only Undefined labels changing to Property Name.
Any property having labels is not impacted.
Batery Level
Battery level unit was not discovered. Added a percentage under the payload of this parameter
valueId.unit
valueId.units is non existing, fixing the typo with valueId.unit