Skip to content

Implement ASCOM Alpaca ObservingConditions support#42

Merged
DeanJ87 merged 3 commits into
mainfrom
feat/observingconditions-api
May 3, 2026
Merged

Implement ASCOM Alpaca ObservingConditions support#42
DeanJ87 merged 3 commits into
mainfrom
feat/observingconditions-api

Conversation

@DeanJ87

@DeanJ87 DeanJ87 commented May 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds ObservingConditions as a second ASCOM Alpaca device on the existing port and polling loop — no duplicate SQMeter polling, no second service
  • Exposes 8 real sensor properties (temperature, humidity, dewpoint, pressure, skyquality, skybrightness, skytemperature, cloudcover) from the BME280, TSL2591, and MLX90614 sensors already polled for SafetyMonitor
  • Returns ErrNotImplemented for the 5 unsupported properties (rainrate, starfwhm, wind*) so clients know not to retry
  • sensordescription and timesincemeasurement are fully implemented; averageperiod returns 0 (no averaging)
  • PUT /api/v1/observingconditions/0/refresh triggers the shared poll immediately
  • /management/v1/configureddevices now lists both SafetyMonitor and ObservingConditions
  • A separate UUID file (device-oc-uuid.txt) persists the OC device UUID independently

Files changed

File Change
internal/alpaca/observingconditions.go New OCHandler with all OC endpoints
internal/alpaca/observingconditions_test.go 40+ tests covering happy paths, sensor errors, unsupported properties, bad paths
internal/alpaca/handlers.go AddConfiguredDevice + updated GetConfiguredDevices
internal/config/paths.go DefaultOCUUIDPath helper
cmd/sqmeter-alpaca-safetymonitor/main.go Load OC UUID, create and register OCHandler
README.md ObservingConditions properties table, N.I.N.A. setup, curl examples

Test plan

  • go test ./... — all packages pass
  • go vet ./... — clean
  • gofmt — no formatting changes
  • ConformU / N.I.N.A. manual validation — not run; the device follows the same Alpaca envelope pattern as the existing SafetyMonitor which has been ConformU-tested

Adds ObservingConditions as a second Alpaca device served from the same
port and polling loop as the existing SafetyMonitor.

Supported properties from the SQMeter ESP32:
- temperature, humidity, dewpoint, pressure (BME280)
- skyquality, skybrightness (TSL2591)
- skytemperature, cloudcover (MLX90614 / IR delta)
- averageperiod (always 0; averaging not supported)

Unsupported properties (rainrate, starfwhm, wind*) return
ErrNotImplemented so clients know not to retry.

sensordescription and timesincemeasurement are fully implemented.
refresh triggers the shared poller.

/management/v1/configureddevices now lists both devices. A second UUID
file (device-oc-uuid.txt) persists the ObservingConditions device UUID
independently of the SafetyMonitor.
@codecov-commenter

codecov-commenter commented May 3, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 98.72340% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/config/paths.go 40.00% 2 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

DeanJ87 and others added 2 commits May 4, 2026 00:28
- GetDriverInfo, GetDriverVersion, PutConnected true/false branches
- sensorErrMsg status 1, 3, and default (unknown) cases via sensor
  error tests for CloudCover, DewPoint, Humidity, Pressure,
  SkyBrightness, and SkyTemperature
- DefaultOCUUIDPath non-Windows path test (mirrors existing UUID/config
  path tests; Windows branch remains skip-guarded)
@DeanJ87
DeanJ87 merged commit 2a7108c into main May 3, 2026
8 checks passed
@DeanJ87
DeanJ87 deleted the feat/observingconditions-api branch May 3, 2026 23:33
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