diff --git a/meter/shelly/gen2.go b/meter/shelly/gen2.go index d5e6dbde8..787b38600 100644 --- a/meter/shelly/gen2.go +++ b/meter/shelly/gen2.go @@ -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 {