func AtSunrise(offset time.Duration, weekdays ...time.Weekday) <-chan time.Time
AtSunrise returns a channel, which waits until sunrise + offset and then returns the current time. If weekdays are specified the channel returns the time only on those weekdays. If no weekdays are specified, the channel returns time everyday.
The time when sunrise happens is calculated based on the location (latitude, longitude) specified in the settings. The default location of Linz (Austria) is used, if no location is specified.
▹ Example
func AtSunset(offset time.Duration, weekdays ...time.Weekday) <-chan time.Time
AtSunset returns a channel, which waits until sunset + offset and then returns the current time. If weekdays are specified the channel returns the time only on those weekdays. If no weekdays are specified, the channel returns time everyday.
The time when sunrise happens is calculated based on the location (latitude, longitude) specified in the settings. The default location of Linz (Austria) is used, if no location is specified.
▹ Example
func AtTime(hour, minute, second int, weekdays ...time.Weekday) <-chan time.Time
AtTime returns a channel, which waits until a specific time of day and then returns the current time. If weekdays are specified the channel returns the time only on those weekdays. If no weekdays are specified, the channel returns time everyday.
▹ Example
func DPT1(v bool) dpt.Value
DPT1 returns the boolean reprentation of v.
func DPT13(v int32) dpt.Value
DPT13 returns the 32-bit integer representation of v.
func DPT14(v float32) dpt.Value
DPT14 returns the 32-bit float representation of v.
func DPT14056(v float32) dpt.Value
DPT14056 returns the power representation of v in Watt.
func DPT5001(v float32) dpt.Value
DPT5001 returns the scaling representation of v from 0 to 100% with a resolution of 0.4%.
func DPT5003(v float32) dpt.Value
DPT5003 returns the angle representation of v from 0 to 360° with a resolution of 1.4%.
func DPT5004(v int) dpt.Value
DPT5003 returns the percentage representation of v from 0 to 100% with a resolution of 1%.
func DPT5010(v int) dpt.Value
DPT5010 returns the integer representation of v from 0 to 255 with a resolution of 1.
func DPT7001(v int) dpt.Value
DPT7001 returns the integer representation of v from 0 to 65,535 pulses with a resolution of 1 pulse.
func DPT7012(v int) dpt.Value
DPT7012 returns the integer representation of v from 0 to 65,535 mA with a resolution of 1 mA.
func DPT7013(v int) dpt.Value
DPT7013 returns the integer representation of v from 0 to 65,535 lux with a resolution of 1 lux.
func DPT9001(v float32) dpt.Value
DPT9001 returns the temperature representation of v from -273°C to 670,760°C with a resolution of 0.01°C.
func DPT9004(v float32) dpt.Value
DPT9004 returns the lux representation of v from 0 to 670,760 Lux with a resolution of 0.01 Lux.
func DPT9005(v float32) dpt.Value
DPT9005 returns the wind speed representation of v from 0 to 670,760 m/s with a resolution of 0.01 m/s.
func DPT9007(v float32) dpt.Value
DPT9007 returns the humidity representation of v from 0 to 670,760% with a resolution of 0.01%.
func DPT9008(v float32) dpt.Value
DPT9008 returns the air quality representation of v from 0 to 670,760 ppm with a resolution of 0.01 ppm.
func DPT9021(v float32) dpt.Value
DPT9021 returns the current representation of v from -670,760 to 670,760 mA with a resolution of 0.01 mA.
func GroupRead(addr string) (buf []byte, err error)
GroupRead reads the bytes from group address addr and returns the byte and an error, if any.
▹ Example
func GroupReadBool(addr string) (b bool, err error)
GroupReadBool reads the bytes from group address addr and returns the boolean value and an error, if any.
func GroupReadNotify(addr string) <-chan interface{}
GroupReadNotify returns a channel which provides an opaque value as a results of a group read telegram sent to addr.
func GroupResponse(v interface{}, addr ...string) (err error)
GroupResponse responds with value v to group addresses addrs and returns an error, if any. A group address response telegram should be sent as a responds to a group read telegram.
Note that GroupResponse is defined as a variadic function and can write v to one or more group addresses at a time. https://gobyexample.com/variadic-functions
▹ Example
func GroupWrite(v interface{}, addrs ...string) (err error)
GroupWrite writes value v to group addresses addrs and returns an error, if any. Note that GroupWrite is defined as a variadic function and can write v to one or more group addresses at a time. https://gobyexample.com/variadic-functions
▹ Example
func GroupWriteBoolNotify(addr string) <-chan bool
GroupWriteBoolNotify returns a channel which provides boolean values from a group write telegram sent to addr.
▹ Example
func GroupWriteNotify(addr string) <-chan []byte
GroupWriteNotify returns a channel which provides bytes from a group write telegram sent to addr.
▹ Example
func GroupWriteTelegramNotify(patterns ...string) <-chan Telegram
GroupWriteTelegramNotify returns a channel which provides group write telegrams sent to matching group addresses.
A pattern can be a specific group address (ex. "0/1/1") or a range of group addresses ("0/1/1-100").
Note that GroupWriteTelegramNotify is defined as a variadic function and takes one or more group address patterns. https://gobyexample.com/variadic-functions
If no pattern is specified, all group write telegrams are received.
▹ Example (1)
▹ Example (2)
▹ Example (3)
func ParseBool(buf []byte) bool
ParseBool returns the boolean value of the bytes in buf.
▹ Example
func ParseDPT1(buf []byte) bool
ParseDPT1 returns the boolean value of the bytes in buf.
func ParseDPT13(buf []byte) int32
ParseDPT13 returns the itneger value of the bytes in buf.
▹ Example
func ParseDPT14(buf []byte) float32
ParseDPT14 returns the float value of the bytes in buf.
▹ Example
func ParseDPT14056(buf []byte) float32
ParseDPT14056 returns the float value of the bytes in buf. The datapoint type 14.056 represents power values in Watt.
▹ Example
func ParseDPT5001(buf []byte) float32
ParseDPT5001 returns the float value of the bytes in buf. The datapoint type 5.001 represents scaling values from 0 to 100% with a resolution of 0.4%.
▹ Example
func ParseDPT5003(buf []byte) float32
ParseDPT5003 returns the float value of the bytes in buf. The datapoint type 5.003 represents angles from 0 to 360° with a resolution of 1.4°.
▹ Example
func ParseDPT5004(buf []byte) int
ParseDPT5004 returns the integer value of the bytes in buf. The datapoint type 5.004 represents percentages from 0 to 100% with a resolution of 1%.
▹ Example
func ParseDPT5010(buf []byte) int
ParseDPT5010 returns the integer value of the bytes in buf. The datapoint type 5.010 represents integer values from 0 to 255 with a resolution of 1.
▹ Example
func ParseDPT7001(buf []byte) int
ParseDPT7001 returns the integer value of the bytes in buf. The datapoint type 7.001 represents integer values from 0 to 65,535 pulses with a resolution of 1 mA.
func ParseDPT7012(buf []byte) int
ParseDPT7012 returns the integer value of the bytes in buf. The datapoint type 7.012 represents integer values from 0 to 65,535 mA with a resolution of 1 mA.
func ParseDPT7013(buf []byte) int
ParseDPT7013 returns the integer value of the bytes in buf. The datapoint type 7.013 represents integer values from 0 to 65,535 lux with a resolution of 1 lux.
▹ Example
func ParseDPT9001(buf []byte) float32
ParseDPT9001 returns the float value of the bytes in buf. The datapoint type 9.001 represents temperature values from -273°C to 670,760°C with a resolution of 0.01°C.
func ParseDPT9004(buf []byte) float32
ParseDPT9004 returns the float value of the bytes in buf. The datapoint type 9.004 represents lux values from 0 to 670,760 Lux with a resolution of 0.01 Lux.
func ParseDPT9005(buf []byte) float32
ParseDPT9005 returns the float value of the bytes in buf. The datapoint type 9.005 represents wind speed values from 0 to 670,760 m/s with a resolution of 0.01 m/s.
func ParseDPT9007(buf []byte) float32
ParseDPT9007 returns the float value of the bytes in buf. The datapoint type 9.007 represents humidity values from 0 to 670,760% with a resolution of 0.01%.
func ParseDPT9008(buf []byte) float32
ParseDPT9008 returns the float value of the bytes in buf. The datapoint type 9.008 represents air quality values from 0 to 670,760 ppm with a resolution of 0.01 ppm.
func ParseDPT9021(buf []byte) float32
ParseDPT9021 returns the float value of the bytes in buf. The datapoint type 9.021 represents current values from -670,760 to 670,760 mA with a resolution of 0.01 mA.
func ParseString(buf []byte) string
ParseString returns the string of the bytes in buf.
▹ Example
func Send(notification *Notification, deviceNames ...string) error
Send sends a notification to registered devices. If device names are specified, the notification is only sent to devices, which contain any specified term in their names. Sending a notification requires an internet connection.
func SendNotification(title string, message string, deviceNames ...string) error
SendNotification sends a notification to registered devices. If device names are specified, the notification is only sent to devices, which contain any specified term in their names. Sending a notification requires an internet connection.
▹ Example
DailyWeather represents the daily weather.
type DailyWeather struct { // Date is the day of the weather information. Date time.Time // Temp is the temperature information for a day. Temp DailyWeatherTemp // Pressure is the atmospheric in Hectopascal (hPa). Pressure int // Humidity is the humidity in %. Humidity int // Clouds is the cloudiness in %. Clouds int // WindSpeed is the wind speed in meter per second. WindSpeed float64 // WindGust ist the wind gust in meter per second; added in 2.6.0 WindGust float64 // WindDegree is the wind direction in degrees. WindDegree int // Rain is the rain volume for a day in mm or l/m². // This property is nil, if rain information is not available. Rain *RainVolume // Snow is the snow volume for a day in mm or l/m².. // This property is nil, if snow information is not available. Snow *SnowVolume }
func GetDailyWeather() ([]*DailyWeather, error)
GetDailyWeather returns the daily weather forcast and an error, if any. The weather is downloaded based on the location (latitude, longitude) specified in the settings.
func (w DailyWeather) RainVolume() float64
RainVolume returns the rain volume in mm (l/m²) – or 0, if no rain information is available.
func (w DailyWeather) SnowVolume() float64
SnowVolume returns the rain volume in mm (l/m²) – or 0, if no snow information is available.
DailyWeatherTemp represents the temperature information for a day.
type DailyWeatherTemp struct { // Day is the average temperature. Day float64 // Min is the minimum temperature. Min float64 // Min is the maximum temperature. Max float64 // Night is the night temperature. Night float64 // Night is the evening temperature. Evening float64 // Night is the morning temperature. Morning float64 }
Notification represents a push notification.
type Notification struct { // Title of the notification Title string // Message of the notification Message string // Image of the notification Image []byte }
type RainVolume struct { Volume float64 }
func (v RainVolume) String() string
type SnowVolume struct { Volume float64 }
func (v SnowVolume) String() string
Telegram represents a knx telegram.
type Telegram struct { // Addr is the telegram address. Addr knx.Addr // Bytes is the telegram payload. Bytes []byte }
Weather represents the weather.
type Weather struct { // Date is the date and time of the weather information. Date time.Time // Temp is the temperature in Celsius degree. Temp float64 // Pressure is the atmospheric in Hectopascal (hPa). Pressure int // Humidity is the humidity in %. Humidity int // Clouds is the cloudiness in %. Clouds int // WindSpeed is the wind speed in meter per second. WindSpeed float64 // WindGust ist the wind gust in meter per second; added in 2.6.0 WindGust float64 // WindDegree is the wind direction in degrees. WindDegree int // Rain is the rain volume for an hour in mm (l/m²). // This property is nil, if rain information is not available. Rain *RainVolume // Snow is the snow volume for an hour in mm (l/m²). // This property is nil, if snow information is not available. Snow *SnowVolume }
func GetCurrentWeather() (*Weather, error)
GetCurrentWeather returns the current weather and an error, if any. The weather is downloaded based on the location (latitude, longitude) specified in the settings.
▹ Example
func GetHourlyWeather() ([]*Weather, error)
GetHourlyWeather returns the hourly weather forcast and an error, if any. The weather is downloaded based on the location (latitude, longitude) specified in the settings.
func (w Weather) RainVolume() float64
RainVolume returns the rain volume in mm (l/m²) – or 0, if no rain information is available.
func (w Weather) SnowVolume() float64
SnowVolume returns the rain volume in mm (l/m²) – or 0, if no snow information is available.
WeekdayTime represents time on a weekday like 8:15 AM on Monday.
type WeekdayTime struct { Weekday time.Weekday Hour int Minute int Second int }
func ParseDPT10001(buf []byte) WeekdayTime
ParseDPT10001 returns the weekday time of the bytes in buf.