Documentation ¶
Index ¶
- Constants
- Variables
- func BoolAttrAsJSON(sensorname string, sensortype string, name string, value bool) (string, error)
- func CryptKey() []byte
- func Decrypt(cryptoText string) (string, error)
- func Encrypt(text string) (string, error)
- func FloatAttrAsJSON(sensorname string, sensortype string, name string, value float64) (string, error)
- func IntAttrAsJSON(sensorname string, sensortype string, name string, value int64) (string, error)
- func LoadFile(path string, v interface{}) error
- func SetCryptKey(secretKey []byte) error
- func StringAttrAsJSON(sensorname string, sensortype string, name string, value string) (string, error)
- func TimeWndAttrAsJSON(sensorname string, sensortype string, name string, begin time.Time, ...) (string, error)
- type AddSuncalcMoment
- type AhkConfig
- type AhkDevice
- type AhkRegister
- type AqiConfig
- type AqiLevel
- type AutomationConfig
- type BoolAttr
- type BraviaTV
- type BraviaTVConfig
- type CAngles
- type CMoment
- type CalendarConfig
- type Ccal
- type ConbeeContact
- type ConbeeDevice
- type ConbeeLightGroup
- type ConbeeLightsConfig
- type ConbeeMotion
- type ConbeeSensorsConfig
- type ConbeeSwitch
- type Config
- type Crule
- type CryptString
- type Csensor
- type Darkorlight
- type DeviceControl
- type FloatAttr
- type FluxConfig
- type Forecast
- type FromTo
- type Geo
- type HueBridgeConfig
- type HueBridgeEmulatedDevice
- type IfThen
- type IntAttr
- type Lighttime
- type Lighttype
- type MinMax
- type Notify
- type PresenceConfig
- type SamsungTV
- type SamsungTVConfig
- type Season
- type SensorState
- func (s *SensorState) AddBoolAttr(name string, value bool)
- func (s *SensorState) AddFloatAttr(name string, value float64)
- func (s SensorState) AddIntAttr(name string, value int64)
- func (s *SensorState) AddStringAttr(name string, value string)
- func (s *SensorState) AddTimeWndAttr(name string, begin time.Time, end time.Time)
- func (s *SensorState) ExecFloatAttr(name string, action func(float64)) bool
- func (s *SensorState) ExecValueAttr(name string, action func(string)) bool
- func (s *SensorState) FromJSON(data []byte) error
- func (s *SensorState) GetBoolAttr(name string, defaultvalue bool) bool
- func (s *SensorState) GetFloatAttr(name string, defaultvalue float64) float64
- func (s *SensorState) GetIntAttr(name string, defaultvalue int64) int64
- func (s *SensorState) GetValueAttr(name string, defaultvalue string) string
- func (s *SensorState) ToJSON() ([]byte, error)
- type ShoutConfig
- type ShoutMsg
- type StringAttr
- type SuncalcConfig
- type TaggedTimeSlot
- type TimeWndAttr
- type Unit
- type WItem
- type Weather
- type WeatherConfig
- type WemoConfig
- type XiaomiConfig
- type YeeConfig
Constants ¶
const ( BedroomLightStand = "Bedroom Light Stand" BedroomLightMain = "Bedroom Light Main" LivingroomLightStand = "Living Room Stand" LivingroomLightMain = "Living Room Main" LivingroomLightChandelier = "Living Room Chandelier" KitchenLights = "Kitchen" SophiaRoomLightStand = "Sophia Stand" SophiaRoomLightMain = "Sophia Main" JenniferRoomLightMain = "Jennifer" )
const ( KitchenMotionSensor = "Kitchen Motion" LivingroomMotionSensor = "Livingroom Motion" BedroomMotionSensor = "Bedroom Motion" BedroomPowerPlug = "Bedroom Plug" BedroomCeilingLightSwitch = "Bedroom Ceiling Light-Switch" BedroomChandelierLightSwitch = "Bedroom Chandelier Light-Switch" BedroomSwitch = "Bedroom Switch" SophiaRoomSwitch = "Sophia Switch" FrontdoorMagnetSensor = "Front Door Magnet" )
const ( SwitchSingleClick = "single click" SwitchDoubleClick = "double click" SwitchTrippleClick = "tripple click" SwitchLongPress = "long press" SwitchLongRelease = "long release" )
const (
BedroomSamsungTV = "Bedroom Samsung-TV"
)
const (
FrontdoorHallLight = "Frontdoor hall light"
)
const (
LivingroomBraviaTV = "Livingroom Sony Bravia-TV"
)
Variables ¶
var InfluxSecrets = InfluxSecretsWork
var InfluxSecretsHome = map[string]string{
"host": "http://10.0.0.22:8086",
"username": "influxdb",
"password": "password",
"database": "gohome",
}
var InfluxSecretsWork = map[string]string{
"host": "http://localhost:8086",
"username": "influxdb",
"password": "password",
"database": "gohome",
}
var PubSubCfg = PubSubHome
var PubSubCfg = PubSubWork
var PubSubHome = map[string]string{
"host": "tcp://10.0.0.22:8080",
"license": "c1aVVz_sTmIi_FTcugWsjzTsQ4kJrslAAAAAAAAAAAI",
"secret": "1ZPCl42pPIyq6ZsZbaV4OUexWw97cZvf",
}
var PubSubWork = map[string]string{
"host": "tcp://127.0.0.1:8080",
"license": "6YUwQVizikSOTIMfKtAvrcW5hwFBLFL2AAAAAAAAAAI",
"secret": "BQQ1M7WIVGhWzjEilfV5ENHwYekj3T2z",
}
Functions ¶
func BoolAttrAsJSON ¶
BoolAttrAsJSON can be called as BoolAttrAsJSON("state.sensor.motion", "motion", "motion_98AE7", true) and you will receive the JSON string or an error.
func FloatAttrAsJSON ¶
func FloatAttrAsJSON(sensorname string, sensortype string, name string, value float64) (string, error)
FloatAttrAsJSON can be called as FloatAttrAsJSON("state.sensor.clouds", "cloudcover", "clouds", 0.2) and you will receive the JSON string or an error.
func IntAttrAsJSON ¶
IntAttrAsJSON can be called as IntAttrAsJSON("state.sensor.aqi", "airquality", "aqi", 120) and you will receive the JSON string or an error.
func StringAttrAsJSON ¶
func StringAttrAsJSON(sensorname string, sensortype string, name string, value string) (string, error)
StringAttrAsJSON can be called as StringAttrAsJSON("state.sensor.motion", "motion", "motion_ba9825ae", "on") and you will receive the JSON string or an error.
func TimeWndAttrAsJSON ¶
func TimeWndAttrAsJSON(sensorname string, sensortype string, name string, begin time.Time, end time.Time) (string, error)
TimeWndAttrAsJSON can be called as TimeWndAttrAsJSON("state.sensor.sun", "sun", "sun.rise", sunrise_begin, sunrise_end) and you will receive the JSON string or an error.
Types ¶
type AddSuncalcMoment ¶
type AhkConfig ¶
type AhkConfig struct { Pin string `json:"pin"` Subscribe []string `json:"subscribe"` Register []AhkRegister `json:"register"` Lights []AhkDevice `json:"lights"` Switches []AhkDevice `json:"switches"` Sensors []AhkDevice `json:"sensors"` Televisions []AhkDevice `json:"televisions"` }
AhkConfig contains information for the Apple Homekit service
func AhkConfigFromJSON ¶
AhkConfigFromJSON parser the incoming JSON string and returns an Config instance for Ahk
type AhkDevice ¶
type AhkDevice struct { Name string `json:"name"` Type string `json:"type,omitempty"` Channel *AhkRegister `json:"channel,omitempty"` ID uint64 `json:"id"` Manufacturer string `json:"manufacturer"` }
type AhkRegister ¶
type AhkRegister string
const ( StateLightAhk AhkRegister = "state/light/ahk/" StateSwitchAhk AhkRegister = "state/switch/ahk/" )
type AqiConfig ¶
type AqiConfig struct { Token CryptString `json:"token"` City string `json:"city"` URL string `json:"url"` Interval int `json:"interval"` Levels []AqiLevel `json:"levels"` }
func AqiConfigFromJSON ¶
AqiConfigFromJSON parser the incoming JSON string and returns an Config instance for Aqi
type AutomationConfig ¶
type AutomationConfig struct { Subscribe []string `json:"subscribe"` Register []string `json:"register"` DeviceCache map[string]DeviceControl `json:"devices"` }
AutomationConfig holds the configuration for automation
func AutomationConfigFromJSON ¶
func AutomationConfigFromJSON(data []byte) (*AutomationConfig, error)
AutomationConfigFromJSON parser the incoming JSON string and returns an Config instance for Aqi
func (*AutomationConfig) FromJSON ¶
func (r *AutomationConfig) FromJSON(data []byte) error
FromJSON converts a json string to a AutomationConfig instance
func (*AutomationConfig) ToJSON ¶
func (r *AutomationConfig) ToJSON() ([]byte, error)
ToJSON converts a AutomationConfig to a JSON string
type BraviaTVConfig ¶
type BraviaTVConfig struct {
Devices []BraviaTV `json:"devices"`
}
func BraviaTVConfigFromJSON ¶
func BraviaTVConfigFromJSON(data []byte) (*BraviaTVConfig, error)
BraviaTVConfigFromJSON parser the incoming JSON string and returns an Config instance for Bravia.TV
func (*BraviaTVConfig) FromJSON ¶
func (r *BraviaTVConfig) FromJSON(data []byte) error
FromJSON converts a json string to a BraviaTVConfig instance
func (*BraviaTVConfig) ToJSON ¶
func (r *BraviaTVConfig) ToJSON() ([]byte, error)
ToJSON converts a AqiConfig to a JSON string
type CalendarConfig ¶
type CalendarConfig struct { Calendars []Ccal `json:"calendars"` Sensors []Csensor `json:"sensors"` Rules []Crule `json:"rules"` }
func CalendarConfigFromJSON ¶
func CalendarConfigFromJSON(data []byte) (*CalendarConfig, error)
func (*CalendarConfig) FromJSON ¶
func (r *CalendarConfig) FromJSON(data []byte) error
FromJSON converts a json string to a CalendarConfig instance
func (*CalendarConfig) Print ¶
func (c *CalendarConfig) Print()
func (*CalendarConfig) ToJSON ¶
func (r *CalendarConfig) ToJSON() ([]byte, error)
ToJSON converts a CalendarConfig to a JSON string
type Ccal ¶
type Ccal struct { Name string `json:"name"` URL CryptString `json:"url"` }
type ConbeeContact ¶
type ConbeeContact struct { ConbeeDevice Open string `json:"open"` Close string `json:"close"` }
ConbeeContact is a structure that references a magnet sensor device at Conbee
type ConbeeDevice ¶
type ConbeeDevice struct { ID string `json:"id"` Name string `json:"name"` BatteryType string `json:"battery_type"` }
ConbeeDevice is a structure that references a general device at Conbee
type ConbeeLightGroup ¶
type ConbeeLightGroup struct { Name string `json:"name"` Group int `json:"group"` On string `json:"on"` Off string `json:"off"` CT string `json:"ct"` Alert string `json:"alert"` IDS []string `json:"ids"` }
ConbeeLight is a structure that references a light object at Conbee
type ConbeeLightsConfig ¶
type ConbeeLightsConfig struct { Host string `json:"Host"` Port int `json:"Port"` APIKey string `json:"APIKey"` LightsIn []string `json:"lights.in"` Lights []ConbeeLightGroup `json:"lights"` }
ConbeeLightsConfig contains information to connect to a Conbee-II device
func ConbeeLightsConfigFromJSON ¶
func ConbeeLightsConfigFromJSON(data []byte) (*ConbeeLightsConfig, error)
ConbeeLightsConfigFromJSON parser the incoming JSON string and returns an Config instance for Aqi
func LoadConfig ¶
func LoadConfig(filename string) (*ConbeeLightsConfig, error)
LoadConfig loads a ConbeeLightsConfig from a file
func (*ConbeeLightsConfig) FromJSON ¶
func (r *ConbeeLightsConfig) FromJSON(data []byte) error
FromJSON converts a json string to a ConbeeLightsConfig instance
func (*ConbeeLightsConfig) ToJSON ¶
func (r *ConbeeLightsConfig) ToJSON() ([]byte, error)
ToJSON converts a ConbeeLightsConfig to a JSON string
type ConbeeMotion ¶
type ConbeeMotion struct { ConbeeDevice On string `json:"on"` Off string `json:"off"` }
ConbeeMotion is a structure that references a motion sensor device at Conbee
type ConbeeSensorsConfig ¶
type ConbeeSensorsConfig struct { Host string `json:"Host"` Port int `json:"Port"` APIKey string `json:"APIKey"` SwitchesOut string `json:"switches.out"` SensorsOut string `json:"sensors.out"` Switches []ConbeeSwitch `json:"switch"` Motion []ConbeeMotion `json:"motion"` Contact []ConbeeContact `json:"contact"` }
ConbeeSensorsConfig contains information to connect to a Conbee-II device
func ConbeeSensorsConfigFromJSON ¶
func ConbeeSensorsConfigFromJSON(data []byte) (*ConbeeSensorsConfig, error)
ConbeeConfigFromJSON parser the incoming JSON string and returns an Config instance for Aqi
func LoadConbeeSensorsConfig ¶
func LoadConbeeSensorsConfig(filename string) (*ConbeeSensorsConfig, error)
LoadConbeeSensorsConfig loads a ConbeeSensorsConfig from a file
func (*ConbeeSensorsConfig) FromJSON ¶
func (r *ConbeeSensorsConfig) FromJSON(data []byte) error
FromJSON converts a json string to a ConbeeSensorsConfig instance
func (*ConbeeSensorsConfig) ToJSON ¶
func (r *ConbeeSensorsConfig) ToJSON() ([]byte, error)
ToJSON converts a ConbeeSensorsConfig to a JSON string
type ConbeeSwitch ¶
type ConbeeSwitch struct { ConbeeDevice SingleClick string `json:"single_click"` DoubleClick string `json:"double_click"` TrippleClick string `json:"tripple_click"` }
ConbeeContact is a structure that references a switch/button device at Conbee
type CryptString ¶
type CryptString struct {
String string
}
func (*CryptString) MarshalJSON ¶
func (cs *CryptString) MarshalJSON() ([]byte, error)
MarshalJSON encrypts and marshals nested String
func (*CryptString) Scan ¶
func (cs *CryptString) Scan(value interface{}) error
Scan implements sql.Scanner and decryptes incoming sql column data
func (*CryptString) UnmarshalJSON ¶
func (cs *CryptString) UnmarshalJSON(b []byte) error
UnmarshalJSON encrypts and marshals nested String
type Darkorlight ¶
type Darkorlight string
const ( Dark Darkorlight = "dark" Light Darkorlight = "light" Twilight Darkorlight = "twilight" )
type DeviceControl ¶
type DeviceControl struct { Channel string `json:"channel"` On string `json:"on"` Off string `json:"off"` Toggle string `json:"toggle"` }
DeviceControl holds the configuration to control a device
type FluxConfig ¶
type FluxConfig struct { Seasons []Season `json:"seasons"` Weather []Weather `json:"weather"` SuncalcMoments []AddSuncalcMoment `json:"suncalc_moments"` Lighttype []Lighttype `json:"lighttype"` Lighttime []Lighttime `json:"lighttime"` }
func FluxConfigFromJSON ¶
func FluxConfigFromJSON(data []byte) (*FluxConfig, error)
FluxConfigFromJSON converts a json string to a FluxConfig instance
func (*FluxConfig) FromJSON ¶
func (r *FluxConfig) FromJSON(data []byte) error
FromJSON converts a json string to a FluxConfig instance
func (*FluxConfig) ToJSON ¶
func (r *FluxConfig) ToJSON() ([]byte, error)
ToJSON converts a FluxConfig to a JSON string
type Forecast ¶
type Forecast struct { From time.Time `json:"from"` Until time.Time `json:"until"` Rain float64 `json:"rain"` RainDescr string `json:"rainDescr"` Wind float64 `json:"wind"` WindDescr string `json:"windDescr"` Clouds float64 `json:"clouds"` CloudDescr string `json:"cloudsDescr"` Temperature float64 `json:"temperature"` TempDescr string `json:"temperatureDescr"` }
func WeatherForecastFromJSON ¶
type FromTo ¶
func (FromTo) LinearInterpolated ¶
LinearInterpolated returns interpolated value between From-To
type HueBridgeConfig ¶
type HueBridgeConfig struct { IPPort string `json:"ip_port"` RegisterChannels []string `json:"register_channels"` SubscribeChannels []string `json:"subscribe_channels"` EmulatedDevices []HueBridgeEmulatedDevice `json:"emulated-devices"` }
HueBridgeConfig is a struct that holds information for our emulated Hue Bridge
func HueBridgeConfigFromJSON ¶
func HueBridgeConfigFromJSON(data []byte) (*HueBridgeConfig, error)
HueBridgeConfigFromJSON will decode a JSON string to a HueBridgeConfig struct
func (*HueBridgeConfig) FromJSON ¶
func (r *HueBridgeConfig) FromJSON(data []byte) error
FromJSON converts a json string to a HueBridgeConfig instance
func (*HueBridgeConfig) ToJSON ¶
func (r *HueBridgeConfig) ToJSON() (data []byte, err error)
ToJSON will encode a HueBridgeConfig struct to a JSON string
type HueBridgeEmulatedDevice ¶
type HueBridgeEmulatedDevice struct { Name string `json:"name"` Channel string `json:"channel"` On string `json:"on"` Off string `json:"off"` }
HueBridgeEmulatedDevice is a device emulated on the Hue Bridge
type Lighttime ¶
type Lighttime struct { CT FromTo `json:"ct"` Bri FromTo `json:"bri"` Darkorlight Darkorlight `json:"darkorlight"` TimeSlot TaggedTimeSlot `json:"timeslot"` }
type MinMax ¶
func (MinMax) LinearInterpolated ¶
LinearInterpolated returns interpolated value between Min-Max
type PresenceConfig ¶
type PresenceConfig struct { Name string `json:"name"` Host string `json:"host"` Port int `json:"port"` User CryptString `json:"user"` Password CryptString `json:"password"` UpdateHistory int `json:"update_history"` UpdateIntervalSec int `json:"update_interval_sec"` Devices []struct { Name string `json:"name"` Mac []CryptString `json:"macs"` } `json:"devices"` }
func PresenceConfigFromJSON ¶
func PresenceConfigFromJSON(data []byte) (*PresenceConfig, error)
func (*PresenceConfig) FromJSON ¶
func (r *PresenceConfig) FromJSON(data []byte) error
func (*PresenceConfig) ToJSON ¶
func (r *PresenceConfig) ToJSON() ([]byte, error)
type SamsungTVConfig ¶
type SamsungTVConfig struct {
Devices []SamsungTV `json:"devices"`
}
func SamsungTVConfigFromJSON ¶
func SamsungTVConfigFromJSON(data []byte) (*SamsungTVConfig, error)
SamsungTVConfigFromJSON parser the incoming JSON string and returns an Config instance for Samsung.TV
func (*SamsungTVConfig) FromJSON ¶
func (r *SamsungTVConfig) FromJSON(data []byte) error
FromJSON converts a json string to a SamsungTVConfig instance
func (*SamsungTVConfig) ToJSON ¶
func (r *SamsungTVConfig) ToJSON() ([]byte, error)
ToJSON converts a AqiConfig to a JSON string
type SensorState ¶
type SensorState struct { Name string `json:"name"` Type string `json:"type"` Time time.Time `json:"time"` BoolAttrs []BoolAttr `json:"boolattrs,omitempty"` IntAttrs []IntAttr `json:"intattrs,omitempty"` FloatAttrs []FloatAttr `json:"floatattrs,omitempty"` StringAttrs []StringAttr `json:"stringattrs,omitempty"` TimeWndAttrs []TimeWndAttr `json:"timeslotattrs,omitempty"` }
SensorState holds all information of a sensor e.g. { "Name": "aqi", "Type": "AirQuality", "IntAttr": { "Name": "PM2.5", "Value": 54 } }
func NewSensorState ¶
func NewSensorState(sensorName string, sensorType string) *SensorState
NewSensorState returns a SensorState object initialized with 'name', 'type' and 'time.Now()'
func SensorStateFromJSON ¶
func SensorStateFromJSON(data []byte) (*SensorState, error)
SensorStateFromJSON deserializes a JSON string and returns a SensorState object
func (*SensorState) AddBoolAttr ¶
func (s *SensorState) AddBoolAttr(name string, value bool)
AddBoolAttr adds an BoolAttr to SensorState
func (*SensorState) AddFloatAttr ¶
func (s *SensorState) AddFloatAttr(name string, value float64)
AddFloatAttr adds a TimeWndAttr to SensorState
func (SensorState) AddIntAttr ¶
func (s SensorState) AddIntAttr(name string, value int64)
AddIntAttr adds an IntAttr to SensorState
func (*SensorState) AddStringAttr ¶
func (s *SensorState) AddStringAttr(name string, value string)
AddStringAttr adds a TimeWndAttr to SensorState
func (*SensorState) AddTimeWndAttr ¶
AddTimeWndAttr adds a TimeWndAttr to SensorState
func (*SensorState) ExecFloatAttr ¶
func (s *SensorState) ExecFloatAttr(name string, action func(float64)) bool
ExecFloatAttr will execute 'action' when an attribute with name 'name' is found
func (*SensorState) ExecValueAttr ¶
func (s *SensorState) ExecValueAttr(name string, action func(string)) bool
ExecValueAttr will execute 'action' when an attribute with name 'name' is found
func (*SensorState) FromJSON ¶
func (s *SensorState) FromJSON(data []byte) error
FromJSON converts a json string to a SensorState instance
func (*SensorState) GetBoolAttr ¶
func (s *SensorState) GetBoolAttr(name string, defaultvalue bool) bool
GetBoolAttr returns the value of a FloatAttr with name 'name'
func (*SensorState) GetFloatAttr ¶
func (s *SensorState) GetFloatAttr(name string, defaultvalue float64) float64
GetFloatAttr returns the value of a FloatAttr with name 'name'
func (*SensorState) GetIntAttr ¶
func (s *SensorState) GetIntAttr(name string, defaultvalue int64) int64
GetIntAttr returns the value of a FloatAttr with name 'name'
func (*SensorState) GetValueAttr ¶
func (s *SensorState) GetValueAttr(name string, defaultvalue string) string
GetValueAttr returns the value of a FloatAttr with name 'name'
func (*SensorState) ToJSON ¶
func (s *SensorState) ToJSON() ([]byte, error)
ToJSON serializes a SensorState object into a JSON string
type ShoutConfig ¶
type ShoutConfig struct { UserToken CryptString `json:"usertoken"` AppToken CryptString `json:"apptoken"` Channel string `json:"channel"` }
func ShoutConfigFromJSON ¶
func ShoutConfigFromJSON(data []byte) (*ShoutConfig, error)
ShoutConfigFromJSON converts a json string to a ShoutConfig instance
func (*ShoutConfig) FromJSON ¶
func (m *ShoutConfig) FromJSON(data []byte) error
FromJSON converts a json string to a ShoutConfig instance
func (*ShoutConfig) ToJSON ¶
func (m *ShoutConfig) ToJSON() (data []byte, err error)
ToJSON converts a ShoutConfig to a JSON string
type ShoutMsg ¶
type ShoutMsg struct { Channel string `json:"channel"` Username string `json:"username"` Message string `json:"message"` Pretext string `json:"pretext"` Prebody string `json:"prebody"` }
func ShoutMsgFromJSON ¶
type StringAttr ¶
StringAttr is a sensor holding a string as value
type SuncalcConfig ¶
type SuncalcConfig struct { Geo Geo `json:"config"` Anglecfg []CAngles `json:"anglecfg"` Moments []CMoment `json:"moments"` }
func SuncalcConfigFromJSON ¶
func SuncalcConfigFromJSON(data []byte) (*SuncalcConfig, error)
func (*SuncalcConfig) FromJSON ¶
func (r *SuncalcConfig) FromJSON(data []byte) error
FromJSON converts a json string to a SuncalcConfig instance
func (*SuncalcConfig) ToJSON ¶
func (r *SuncalcConfig) ToJSON() ([]byte, error)
type TaggedTimeSlot ¶
type TimeWndAttr ¶
type TimeWndAttr struct { Name string `json:"name"` Begin time.Time `json:"begin"` End time.Time `json:"end"` }
TimeWndAttr is a sensor holding a TimeWnd as value e.g. TimeWndAttrAsJSON("sun.rise", sunrise_begin, sunrise_end) or adding multiple sensors:
sensor := NewSensorState("suncalc") sensor.AddTimeWndAttr("night.dawn", nightdawn, nightdawn_end) sensor.AddTimeWndAttr("astronomical.dawn", astronomicaldawn, astronomicaldawn_end) ... jsonstr, err := sensor.ToJSON() ...
type WeatherConfig ¶
type WeatherConfig struct { Location Geo `json:"location"` Key CryptString `json:"key"` Notify []Notify `json:"notify"` Clouds []WItem `json:"clouds"` Rain []WItem `json:"rain"` Wind []WItem `json:"wind"` Temperature []WItem `json:"temperature"` }
func WeatherConfigFromJSON ¶
func WeatherConfigFromJSON(data []byte) (*WeatherConfig, error)
func (*WeatherConfig) FromJSON ¶
func (r *WeatherConfig) FromJSON(data []byte) error
FromJSON converts a json string to a WeatherConfig instance
func (*WeatherConfig) ToJSON ¶
func (r *WeatherConfig) ToJSON() (data []byte, err error)
type WemoConfig ¶
type WemoConfig struct { Name string `json:"name"` Devices []struct { Name string `json:"name"` IP string `json:"ip"` Port string `json:"port"` } `json:"devices"` }
func WemoConfigFromJSON ¶
func WemoConfigFromJSON(data []byte) (*WemoConfig, error)
func (*WemoConfig) FromJSON ¶
func (r *WemoConfig) FromJSON(data []byte) error
FromJSON converts a json string to a WemoConfig instance
func (*WemoConfig) ToJSON ¶
func (m *WemoConfig) ToJSON() (data []byte, err error)
type XiaomiConfig ¶
type XiaomiConfig struct { Name string `json:"name"` IP string `json:"ip"` MAC string `json:"mac"` Key CryptString `json:"key"` Motion []struct { Name string `json:"name"` ID string `json:"id"` BType string `json:"battery_type"` } `json:"motion"` Plug []struct { Name string `json:"name"` ID string `json:"id"` } `json:"plug"` Switch []struct { Name string `json:"name"` ID string `json:"id"` BType string `json:"battery_type"` } `json:"switch"` Magnet []struct { Name string `json:"name"` ID string `json:"id"` BType string `json:"battery_type"` } `json:"magnet"` }
func XiaomiConfigFromJSON ¶
func XiaomiConfigFromJSON(data []byte) (*XiaomiConfig, error)
func (*XiaomiConfig) FromJSON ¶
func (r *XiaomiConfig) FromJSON(data []byte) error
FromJSON converts a json string to a XiaomiConfig instance
func (*XiaomiConfig) ToJSON ¶
func (m *XiaomiConfig) ToJSON() (data []byte, err error)
Source Files ¶
- ahk.config.go
- aqi.config.go
- automation.config.go
- bravia.tv.config.go
- calendar.config.go
- conbee.lights.config.go
- conbee.sensors.config.go
- cryptString.go
- flux.config.go
- huebridge.config.go
- interface.config.go
- presence.config.go
- samsung.tv.config.go
- secret.key.go
- sensor.state.go
- shout.config.go
- suncalc.config.go
- weather.config.go
- wemo.config.go
- xiaomi.config.go
- yee.config.go