mjg59 / python-broadlink

Python module for controlling Broadlink RM2/3 (Pro) remote controls, A1 sensor platforms and SP2/3 smartplugs
MIT License
1.35k stars 477 forks source link

SCB1E energy monitor doesn't work #755

Closed vrm42 closed 2 months ago

vrm42 commented 1 year ago

Hello, I've got an SCB1E device and I can turn it on/off with cli but can't read energy consumption.

AttributeError: 'sp4' object has no attribute 'get_energy'

In switch.py there is no 'get_energy' defined for SP4 devices. In init.py SCB1E is listed in SP4 category. I tried to copy the 'get_energy' parts from other devices to the sp4 section but it didn't work.

Please help. Thanks, vrm

felipediel commented 2 months ago

You should use the sp4b class and the get_state() function.