Skip to content
Snippets Groups Projects
Commit 73b7aed5 authored by KERDREUX Jerome's avatar KERDREUX Jerome
Browse files

Lamp Dimmer

parent c4a46e69
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,11 @@ type Lamp struct {
Z2MDevice Z2MDevice
}
type LampDimmer struct {
XAALDevice
Z2MDevice Z2MDevice
}
type ButtonRemote struct {
XAALDevice
Z2MDevice Z2MDevice
......@@ -265,6 +270,22 @@ func (dev *Lamp) Toggle(xaal.MessageBody) *xaal.MessageBody {
return nil
}
// =============================================================================
// Lamp Dimmer
// =============================================================================
func NewLampDimmer(addr uuid.UUID, zDev *Z2MDevice) XAALDeviceInterface {
dev := &LampDimmer{XAALDevice{schemas.NewLampDimmer(addr)}, *zDev}
dev.setup(zDev)
return dev
}
func (dev *LampDimmer) update(payload map[string]interface{}) {
value, exists := payload["brightness"].(float64)
if exists {
dev.GetAttribute("brightness").SetValue(value)
}
}
// =============================================================================
// NetButtonRemote
// =============================================================================
......
......@@ -133,7 +133,10 @@ func (zDev *Z2MDevice) setupXAALDevices(gw *Gateway) {
}
dev = NewPowerRelay(addr, zDev, property)
} else if expose.Type == "light" {
dev = NewLamp(addr, zDev)
// type := NewLamp
// for _, exp := range expose.Features {
// }
dev = NewLampDimmer(addr, zDev)
}
if dev != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment