We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
Can you import this changes to support sp3s plug?
--- old/mqtt.py 2021-05-10 18:01:40.735388521 +0100 +++ mqtt.py 2021-05-10 17:36:28.787577208 +0100 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import paho.mqtt.client as paho # pip install paho-mqtt import broadlink # pip install broadlink @@ -108,7 +108,7 @@ # SP1/2 / MP1/ BG1 power control if command == 'power': - if device.type == 'SP1' or device.type == 'SP2': + if device.type == 'SP1' or device.type == 'SP2' or device.type == 'SP3S': state = action == 'on' or action == '1' logging.debug("Setting power state to {0}".format(state)) device.set_power(1 if state else 0) @@ -384,6 +384,8 @@ device = broadlink.sp1(host=host, mac=mac, devtype=0) elif device_type == 'sp2': device = broadlink.sp2(host=host, mac=mac, devtype=0x2711) + elif device_type == 'sp3s': + device = broadlink.sp3s(host=host, mac=mac, devtype=0x947a) elif device_type == 'a1': device = broadlink.a1(host=host, mac=mac, devtype=0x2714) elif device_type == 'mp1': @@ -414,7 +416,17 @@ tt.start() broadlink_sp_energy_interval = cf.get('broadlink_sp_energy_interval', 0) - if device.type == 'SP2' and broadlink_sp_energy_interval > 0: + broadlink_sp2_energy = cf.get('broadlink_sp2_energy', False) + if device.type == 'SP2' and broadlink_sp_energy_interval > 0 and broadlink_sp2_energy == True: + scheduler = sched.scheduler(time.time, time.sleep) + scheduler.enter(broadlink_sp_energy_interval, 1, broadlink_sp_energy_timer, + [scheduler, broadlink_sp_energy_interval, device, mqtt_prefix]) + # scheduler.run() + tt = SchedulerThread(scheduler) + tt.daemon = True + tt.start() + + if device.type == 'SP3S' and broadlink_sp_energy_interval > 0: scheduler = sched.scheduler(time.time, time.sleep) scheduler.enter(broadlink_sp_energy_interval, 1, broadlink_sp_energy_timer, [scheduler, broadlink_sp_energy_interval, device, mqtt_prefix])
Best Regards, Fernando Gomes
The text was updated successfully, but these errors were encountered:
Thanks for this patch! Committed it but w/o part related to broadlink_sp2_energy parameter Why would you need it?
Sorry, something went wrong.
Because I've one SP2 socket, that doesn't support energy monitoring, and give error without this code.
Do you use 'multiple_lookup'?
Yes.
No branches or pull requests
Hi,
Can you import this changes to support sp3s plug?
Best Regards,
Fernando Gomes
The text was updated successfully, but these errors were encountered: