Skip to content

Shelly RPC endpoint change #276

@Sleinous

Description

@Sleinous

Hello there,

Currently getting the following error in loop :

May 18 21:59:56 ubuntu1 python3[7005]: 2026-05-18 19:59:56 ERROR Exception at GetPowermeterWatts
May 18 21:59:56 ubuntu1 python3[7005]: 2026-05-18 19:59:56 ERROR 'total_act_power'

This is because the endpoint is no longer /EM.GetStatus?id=0 but rather /rpc/EM.GetStatus?id=0

Could we get a codefix to update this breaking change from Shelly ?

I'm not an expert but the problem seems to be here :

class Shelly3EMPro(Shelly):
    def GetPowermeterWatts(self):
        return CastToInt(self.GetRpcJson('/EM.GetStatus?id=0')['total_act_power'])

UPDATE

AI helped me make a very quick and dirty fix for the coming days :

Updated Shelly3EMPro compatibility for newer Shelly Pro 3EM firmware.

Changes:

  • Replaced deprecated /EM.GetStatus?id=0 RPC endpoint with /Shelly.GetStatus

  • Added support for new em1:x component naming used by newer firmware

  • Fixed EMETER_INDEX handling so single-phase setups correctly read act_power from the selected channel

  • Added backward compatibility fallbacks for older JSON layouts (em:0, total_act_power, phase summing)

This fixes errors on Shelly Pro 3EM fw 2.0.0 like:
Exception at GetPowermeterWatts
'total_act_power'

Tested with Shelly Pro 3EM firmware 2.0.0.

class Shelly3EMPro(Shelly):
    def GetPowermeterWatts(self):
        data = self.GetRpcJson('/Shelly.GetStatus')

        if self.emeterindex != '':
            key = 'em1:' + str(self.emeterindex)
            return CastToInt(data[key]['act_power'])

        em = data.get('em:0', data.get('em1:0'))

        return CastToInt(
            em.get('total_act_power',
            em.get('act_power',
            em.get('a_act_power', 0)
          + em.get('b_act_power', 0)
          + em.get('c_act_power', 0)))
        )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions