jsonapi

package
v1.4.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2018 License: MIT Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	ID           string        `json:"id,omitempty"`           // A unique ID like AIN, MAC address, etc.
	InternalID   string        `json:"internalId,omitempty"`   // Internal device ID of the FRITZ!Box.
	Name         string        `json:"name,omitempty"`         // The name of the device. Can be assigned in the web gui of the FRITZ!Box.
	Properties   *Properties   `json:"properties,omitempty"`   // Static or pseudo-static properties.
	Measurements *Measurements `json:"measurements,omitempty"` // Sensor data.
	State        *State        `json:"state,omitempty"`        // State of the home.
}

Device can represent any AHA managed hardware.

type DeviceList

type DeviceList struct {
	NumberOfItems int      `json:"numberOfItems"` // Number of items.
	Devices       []Device `json:"devices"`       // The temperature to switch to. Same unit convention as in Thermostat.Measured.
}

DeviceList wraps a collection of devices.

type Lock

type Lock struct {
	HwLock string `json:"hwLock,omitempty"` // Lock set directly on the device.
	SwLock string `json:"swLock,omitempty"` // Device locked by FRITZ!Box.
}

Lock contains the lock information of a device. A "lock" prevents manual changes to the device.

type Mapper

type Mapper interface {
	Convert([]fritz.Device) DeviceList
}

Mapper maps the XML to JSON model.

func NewMapper

func NewMapper() Mapper

NewMapper instantiates a Mapper.

type Measurements

type Measurements struct {
	Temperature       string `json:"temperature,omitempty"`       // Temperature measured in °C.
	PowerConsumption  string `json:"powerConsumption,omitempty"`  // Current power in W.
	EnergyConsumption string `json:"energyConsumption,omitempty"` // Absolute energy consumption in Wh since the device started operating.
}

Measurements indicate runtime data obtained by device senors.

type NextChange

type NextChange struct {
	At   string `json:"at"`   // Timestamp  when the next temperature switch is scheduled. Formatted as RFC3339.
	Goal string `json:"goal"` // The temperature to switch to.
}

NextChange indicates the upcoming scheduled temperature change.

type Properties

type Properties struct {
	Vendor   *Vendor  `json:"vendor,omitempty"`   // Vendor data.
	Lock     *Lock    `json:"lock,omitempty"`     // Lock state.
	Warnings []string `json:"warnings,omitempty"` // Error messages, warnings etc.
}

Properties refers to static or rarely changing information on the device.

type State

type State struct {
	Connected          bool                `json:"connected"`                    // Device connected?
	Switch             string              `json:"switch,omitempty"`             // "ON" or "OFF" or "" (if it does not apply).
	TemperatureControl *TemperatureControl `json:"temperatureControl,omitempty"` // Applies to thermostats.
}

State contains the core domain of the device, e.g. "is the switch on?", "what is the room temperature supposed to be?".

type TemperatureControl

type TemperatureControl struct {
	Goal       string      `json:"goal,omitempty"`       // Desired temperature, user controlled.
	Saving     string      `json:"saving,omitempty"`     // Energy saving temperature.
	Comfort    string      `json:"comfort,omitempty"`    // Comfortable temperature.
	NextChange *NextChange `json:"nextChange,omitempty"` // Comfortable temperature.
}

TemperatureControl applies to AHA devices capable of adjusting room temperature.

type Vendor

type Vendor struct {
	Manufacturer    string `json:"manufacturer"`    // Manufacturer of the device.
	ProductName     string `json:"productName"`     // Name of the product, empty for unknown or undefined devices.
	FirmwareVersion string `json:"firmwareVersion"` // Firmware version of the device.
}

Vendor contains device metadata, see embedded fields.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL