chore: release v0.20.8
This commit is contained in:
@@ -33,6 +33,7 @@ type Status struct {
|
||||
State string `json:"state,omitempty"` // IDLE / TRANSMIT_A …
|
||||
FanMode string `json:"fan_mode,omitempty"` // STANDARD / CONTEST / BROADCAST
|
||||
Temperature float64 `json:"temperature"`
|
||||
Operate bool `json:"operate"` // OPERATE vs STANDBY (optimistic until the amp reports it)
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
@@ -119,8 +120,15 @@ func (c *Client) SetOperate(on bool) error {
|
||||
if on {
|
||||
v = "1"
|
||||
}
|
||||
_, err := c.command("operate=" + v)
|
||||
return err
|
||||
if _, err := c.command("operate=" + v); err != nil {
|
||||
return err
|
||||
}
|
||||
// Optimistic: the status poll's "operate" field (when the firmware reports
|
||||
// one) confirms or corrects this.
|
||||
c.statusMu.Lock()
|
||||
c.status.Operate = on
|
||||
c.statusMu.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) pollLoop() {
|
||||
@@ -223,6 +231,8 @@ func (c *Client) parse(resp string) {
|
||||
switch kv[0] {
|
||||
case "state":
|
||||
c.status.State = kv[1]
|
||||
case "operate":
|
||||
c.status.Operate = kv[1] == "1"
|
||||
case "fanmode":
|
||||
dev := strings.ToUpper(kv[1])
|
||||
// Honour a recent optimistic change until the amp confirms it.
|
||||
|
||||
Reference in New Issue
Block a user