Skip to content

Commit d15dc7e

Browse files
committed
SP3S device support
1 parent 80a962d commit d15dc7e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mqtt.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def on_message(client, device, msg):
108108

109109
# SP1/2 / MP1/ BG1 power control
110110
if command == 'power':
111-
if device.type == 'SP1' or device.type == 'SP2':
111+
if device.type == 'SP1' or device.type == 'SP2' or device.type == 'SP3S':
112112
state = action == 'on' or action == '1'
113113
logging.debug("Setting power state to {0}".format(state))
114114
device.set_power(1 if state else 0)
@@ -384,6 +384,8 @@ def get_device(cf):
384384
device = broadlink.sp1(host=host, mac=mac, devtype=0)
385385
elif device_type == 'sp2':
386386
device = broadlink.sp2(host=host, mac=mac, devtype=0x2711)
387+
elif device_type == 'sp3s':
388+
device = broadlink.sp3s(host=host, mac=mac, devtype=0x947a)
387389
elif device_type == 'a1':
388390
device = broadlink.a1(host=host, mac=mac, devtype=0x2714)
389391
elif device_type == 'mp1':
@@ -414,7 +416,7 @@ def configure_device(device, mqtt_prefix):
414416
tt.start()
415417

416418
broadlink_sp_energy_interval = cf.get('broadlink_sp_energy_interval', 0)
417-
if device.type == 'SP2' and broadlink_sp_energy_interval > 0:
419+
if (device.type == 'SP2' or device.type == 'SP3S') and broadlink_sp_energy_interval > 0:
418420
scheduler = sched.scheduler(time.time, time.sleep)
419421
scheduler.enter(broadlink_sp_energy_interval, 1, broadlink_sp_energy_timer,
420422
[scheduler, broadlink_sp_energy_interval, device, mqtt_prefix])

0 commit comments

Comments
 (0)