-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add interface methods to Device and MobileDevice object
- Loading branch information
Showing
4 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package gotado | ||
|
||
import "context" | ||
|
||
// GetTemperatureOffset returns the temperature offsets of the device | ||
func (d *Device) GetTemperatureOffset(ctx context.Context) (*TemperatureOffset, error) { | ||
temperatureOffset := &TemperatureOffset{} | ||
if err := d.client.get(ctx, apiURL("devices/%s/temperatureOffset", d.SerialNo), &temperatureOffset); err != nil { | ||
return nil, err | ||
} | ||
return temperatureOffset, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package gotado | ||
|
||
import "context" | ||
|
||
// SetMobileDeviceSettings updates the mobile device with the given settings | ||
func (md *MobileDevice) SetSettings(ctx context.Context, settings MobileDeviceSettings) error { | ||
return md.client.put(ctx, apiURL("homes/%d/mobileDevices/%d/settings", md.home.ID, md.ID), settings) | ||
} | ||
|
||
// DeleteMobileDevice deletes the mobile device | ||
func (md *MobileDevice) Delete(ctx context.Context) error { | ||
return md.client.delete(ctx, apiURL("homes/%d/mobileDevices/%d", md.home.ID, md.ID)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters