Skip to content

Export the sdm.devices.traits.ThermostatMode field in the metrics#6

Open
cure wants to merge 1 commit intoklyubin:mainfrom
cure:main
Open

Export the sdm.devices.traits.ThermostatMode field in the metrics#6
cure wants to merge 1 commit intoklyubin:mainfrom
cure:main

Conversation

@cure
Copy link

@cure cure commented Jan 1, 2024

The mode is exported as set of four gauges (nest_mode_heat, nest_mode_cool, nest_mode_heatcool, nest_mode_off). Add tests for the new exported gauges.

set of four gauges (nest_mode_heat, nest_mode_cool, nest_mode_heatcool,
nest_mode_off). Add tests for the new exported gauges.
@klyubin
Copy link
Owner

klyubin commented Apr 14, 2024

I'm terribly sorry, I somehow missed this PR back in Jan when you opened it. I'll review it right now!

Copy link
Owner

@klyubin klyubin left a comment

Choose a reason for hiding this comment

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

Looks good (same as it did on the grdl repo). Please fix the broken tests -- I left the comments on the PR to indicate what and where.

You can test by running go test ./... at the root of the repo.

It's a shame that for security reasons the Build & Test PR action doesn't add on PRs opened from another repo. It could've made easier to spot the issues.

assert.Contains(t, w.Body.String(), `nest_ambient_temperature_celsius{id="enterprises/PROJECT_ID/devices/DEVICE_ID",label="Custom Name",room="Living Room"} 20.23999`)
assert.Contains(t, w.Body.String(), `nest_humidity_percent{id="enterprises/PROJECT_ID/devices/DEVICE_ID",label="Custom Name",room="Living Room"} 57`)
assert.Contains(t, w.Body.String(), `nest_heating{id="enterprises/PROJECT_ID/devices/DEVICE_ID",label="Custom Name",room="Living Room"} 0`)
assert.Contains(t, w.Body.String(), `nest_mode_heat{id="enterprises/PROJECT_ID/devices/DEVICE_ID",label="Custom-Name",room="Living Room"} 1`)
Copy link
Owner

Choose a reason for hiding this comment

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

Please change the label to "Custom Name" to unbreak tests. Labels are now without the hyphen by default -- see #4. The same comment applies to the next three lines as well.

HeatSetpointTemp: float64(19.17838),
Humidity: float64(57),
Status: "OFF",
Mode: "HEAT",
Copy link
Owner

Choose a reason for hiding this comment

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

Please change to "HEATCOOL" to unbreak this test. "HEATCOOL" is what's in the mock Nest thermostat under test here:

"mode": "HEATCOOL",

@klyubin
Copy link
Owner

klyubin commented Apr 14, 2024

I found out why I didn't get notified about this PR earlier -- notifications for this forked repo were off by default. I think I fixed this now.

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.

2 participants