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

Readings for switch SCB1E not divided by 1000 #736

Open Gongui opened 1 year ago

Gongui commented 1 year ago

Hi!

I just installed a SCB1E to power and monitor a small AC unit with HomeAssistant, after powering on (the SCB1E ) i found that the values returned are incorrect (not divided by 1000).

Wrote a simple script to test the switch directly with python-broadlink and the error is also present:

import broadlink

switch = broadlink.switch.sp4(('...', 80), mac=b'...', devtype=42347, timeout=10, name='SCB1E', model='SCB1E', manufacturer='Broadlink', is_locked=False) switch.auth() print(switch.get_state())

For example the reading when the AC unit is off is:

{'pwr': 1, 'indicator': 0, 'maxworktime': 0, 'current': 35, 'volt': 223900, 'power': 750, 'totalconsum': 0, 'overload': 0, 'childlock': 0}

and when it is on:

{'pwr': 1, 'indicator': 0, 'maxworktime': 0, 'current': 3879, 'volt': 218600, 'power': 833360, 'totalconsum': 30, 'overload': 0, 'childlock': 0}

The device is being identified as a SP4 by the discover method:

broadlink.switch.sp4(('...', 80), mac=b'...', devtype=42347, timeout=10, name='SCB1E', model='SCB1E', manufacturer='Broadlink', is_locked=False)

Trying to use the SP4B class returns the following exception:

broadlink.exceptions.StorageError: [Errno -5] The device storage is full