Shelly: add missing PM1 condition (#20919)
This commit is contained in:
parent
3b7680f256
commit
5eff3d995a
1 changed files with 2 additions and 6 deletions
|
|
@ -116,7 +116,7 @@ func newGen2(helper *request.Helper, uri, model string, channel int, user, passw
|
|||
|
||||
c.methods = res.Methods
|
||||
|
||||
if c.hasPM1Endpoint() {
|
||||
if c.hasMethod("PM1.GetStatus") {
|
||||
c.switchstatus = util.ResettableCached(apiCall[Gen2SwitchStatus](c, "PM1.GetStatus"), cache)
|
||||
} else {
|
||||
c.switchstatus = util.ResettableCached(apiCall[Gen2SwitchStatus](c, "Switch.GetStatus"), cache)
|
||||
|
|
@ -265,11 +265,7 @@ func (c *gen2) Powers() (float64, float64, float64, error) {
|
|||
|
||||
// Gen2+ models using Switch.GetStatus endpoint https://shelly-api-docs.shelly.cloud/gen2/ComponentsAndServices/Switch#switchgetstatus-example
|
||||
func (c *gen2) hasSwitchEndpoint() bool {
|
||||
return c.hasMethod("Switch.GetStatus")
|
||||
}
|
||||
|
||||
func (c *gen2) hasPM1Endpoint() bool {
|
||||
return c.hasMethod("PM1.GetStatus")
|
||||
return c.hasMethod("Switch.GetStatus") || c.hasMethod("PM1.GetStatus")
|
||||
}
|
||||
|
||||
func (c *gen2) hasEM1Endpoint() bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue