diff --git a/pkg/devices/energy_monitoring.go b/pkg/devices/energy_monitoring.go index b44357b..7672a2b 100644 --- a/pkg/devices/energy_monitoring.go +++ b/pkg/devices/energy_monitoring.go @@ -49,7 +49,7 @@ func (t *TapoEnergyMonitoringPlug) GetDeviceInfo() (response.DeviceInfoPlug, err if err != nil { return response.DeviceInfoPlug{}, err } - return data.Result, nil + return data.Result, data.GetError() } // On turns the device on. @@ -97,7 +97,7 @@ func (t *TapoEnergyMonitoringPlug) GetDeviceUsage() (response.DeviceUsageEnergyM if err != nil { return response.DeviceUsageEnergyMonitor{}, err } - return data.Result, nil + return data.Result, data.GetError() } // GetEnergyUsage returns the energy usage of the device. @@ -111,7 +111,7 @@ func (t *TapoEnergyMonitoringPlug) GetEnergyUsage(params request.GetEnergyDataPa if err != nil { return response.EnergyUsage{}, err } - return data.Result, nil + return data.Result, data.GetError() } // GetCurrentPower returns the current power usage of the device. @@ -125,5 +125,5 @@ func (t *TapoEnergyMonitoringPlug) GetCurrentPower() (response.CurrentPower, err if err != nil { return response.CurrentPower{}, err } - return data.Result, nil + return data.Result, data.GetError() } diff --git a/pkg/devices/hub.go b/pkg/devices/hub.go index ed6bea6..af78c8c 100644 --- a/pkg/devices/hub.go +++ b/pkg/devices/hub.go @@ -52,7 +52,7 @@ func (t *TapoHub) GetDeviceInfo() (response.DeviceInfoHub, error) { if err != nil { return response.DeviceInfoHub{}, err } - return data.Result, nil + return data.Result, data.GetError() } func (t *TapoHub) GetChildDeviceList() (ChildDeviceList, error) { @@ -89,7 +89,7 @@ func (t *TapoHub) GetChildDeviceComponentList() (response.ChildDeviceComponentLi if err != nil { return response.ChildDeviceComponentList{}, err } - return data.Result, nil + return data.Result, data.GetError() } func getChild(by func(ChildDeviceWrapper) (bool, error), devices []ChildDeviceWrapper) (bool, ChildDeviceWrapper, error) { @@ -194,7 +194,7 @@ func (t *TapoHub) GetSupportedAlarms() (response.AlarmsList, error) { if err != nil { return response.AlarmsList{}, err } - return data.Result, nil + return data.Result, data.GetError() } func (t *TapoHub) PlayAlarm(alarmType string, volume request.AlarmVolume, duration int) error {