Skip to content
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(discovery): define units for scene and configuration values #3905

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

ccutrer
Copy link
Contributor

@ccutrer ccutrer commented Sep 19, 2024

And for scene values, use the correct template because the value is a JSON object that also includes the units, but nests the actual value one level deeper.

and for scene values, use the correct template because the value is
a JSON object that also includes the units, but nests the actual
value one level deeper
@coveralls
Copy link

Pull Request Test Coverage Report for Build 10949118309

Details

  • 0 of 22 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 21.062%

Changes Missing Coverage Covered Lines Changed/Added Lines %
api/lib/Gateway.ts 0 22 0.0%
Totals Coverage Status
Change from base Build 10923067970: -0.02%
Covered Lines: 3924
Relevant Lines: 19808

💛 - Coveralls

@@ -1336,6 +1336,10 @@ export default class Gateway {
valueId.property,
valueId.propertyKey,
)
if (valueId.value?.unit) {
cfg.discovery_payload.value_template =
"{{ value_json.value.value | default('') }}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have a typo here?

Suggested change
"{{ value_json.value.value | default('') }}"
"{{ value_json.value | default('') }}"

Copy link
Contributor Author

@ccutrer ccutrer Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is intentional, and the critical part of this change. Example data from MQTT:

zwave/Garage/Loft_Stairwell_Lights/38/0/duration

{"time":1726797698474,"value":{"value":0,"unit":"seconds"}}

Notice value is nested within value.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh didn't know about that! Thanks for clarification

@robertsLando robertsLando merged commit 27c5e80 into zwave-js:master Sep 23, 2024
9 checks passed
@ccutrer ccutrer deleted the discovery-scene-units branch September 23, 2024 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants