Conversation
Add MQTT publishing so Scrutiny drives auto-appear as Home Assistant devices with sensors for temperature, health status, power-on hours, power cycle count, and a problem binary sensor. Disabled by default; enable via web.mqtt.enabled config or SCRUTINY_WEB_MQTT_ENABLED env var.
13 tasks
- Handle unchecked error returns on publish calls (errcheck) - Pass heavy structs by pointer instead of value (gocritic/hugeParam) - Reorder StatePayload fields for optimal alignment (govet/fieldalignment) - Use index-based range loop to avoid 384-byte copies (gocritic/rangeValCopy)
- Pass device by pointer in publishStateSync (gocritic/hugeParam) - Reorder StatePayload fields for optimal alignment (govet/fieldalignment)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LoadInitialData(mirrors existing Prometheus metrics pattern)web.mqtt.enabled: trueorSCRUTINY_WEB_MQTT_ENABLED=trueFiles Created
webapp/backend/pkg/mqtt/client.gowebapp/backend/pkg/mqtt/discovery.gowebapp/backend/pkg/mqtt/publisher.gowebapp/backend/pkg/mqtt/discovery_test.gowebapp/backend/pkg/mqtt/publisher_test.gowebapp/backend/pkg/web/middleware/mqtt.gowebapp/backend/pkg/web/handler/mqtt_helpers.goFiles Modified
go.modpaho.mqtt.golang v1.5.0dependencywebapp/backend/pkg/config/config.goweb.mqtt.*config defaultswebapp/backend/pkg/web/server.gowebapp/backend/pkg/web/handler/upload_device_metrics.gowebapp/backend/pkg/web/handler/register_devices.gowebapp/backend/pkg/web/handler/delete_device.gowebapp/backend/pkg/web/handler/archive_device.gowebapp/backend/pkg/web/handler/unarchive_device.goexample.scrutiny.yamlConfiguration
Linked Issues
Closes #278
Test plan
scrutinyandcollector-metricsbinaries build cleanlygo vetclean (no new warnings)