]> git.giacomolli.uk - onehouse/blob - protocol/value_payload.go
Poll and command shared Alamo thermostats
[onehouse] / protocol / value_payload.go
1 package protocol
2
3 import "encoding/json"
4
5 // ValuePayload holds a complete value for reports, telemetry, or commands.
6 // Value is required. JSON null is a present value. Capability-specific value
7 // validation belongs to the driver or entity, not to the wire layer.
8 type ValuePayload struct {
9 Value json.RawMessage `json:"value"`
10 }
11
12 // AvailabilityPayload holds reachability. Status is online or offline.
13 type AvailabilityPayload struct {
14 Status string `json:"status"`
15 }
16
17 // EventPayload is an application-defined occurrence object. Every key is event
18 // data, not an optional wire field. Empty objects are valid. Button and camera
19 // actions can use action and occurred_at without a closed field list.
20 type EventPayload map[string]json.RawMessage
21
22 // ResultPayload holds accepted, completed, rejected, or failed. Only rejected
23 // and failed require a nonempty Reason. Other statuses must omit Reason.
24 type ResultPayload struct {
25 Status string `json:"status"`
26 Reason string `json:"reason,omitempty"`
27 }