aravndal / tplinkplug Goto Github PK
View Code? Open in Web Editor NEWSupport for TP-Link Smart Plug in CraftbeerPi 3
Support for TP-Link Smart Plug in CraftbeerPi 3
This plug-in didn't generate a token. Any ideas?
Snapshots for TPLinkPlug
Hi
First I would like to thank you very much for this plugin! I really like the option to have wireless control
over my fermentation and mashing setups.
I had a failure recently with my fermentation.
It seems that CBPI sent an off command to TP-Link socket. But for some reason it didnt reach the plug, so the refrigerator kept cooling.
See image.
I'm wondering if its possible to build in a failsafe, or maybe its already done? I'm looking at the code and it doesn't seem to be so.
There seems to not be any check if the relay state actually changed after sending a command.
def send(command, plug="", ip=""):
if ip == "":
log("Send Cloud TP Link %s" % command)
plug = plug-1
url = TPplugs[plug]["appServerUrl"]
url = url +"?token=%s" % tplink_token
device = TPplugs[plug]["deviceId"]
data_input = '{"method":"passthrough", "params": {"deviceId": "%s", "requestData": "{\"system\":{\"set_relay_state\":{\"state\":%s}}}" }}'
data_input = data_input % (device, command)
resp = httpTPlink(url, data_input)
else:
log("Send Local TP Link %s" % command)
data_input = '{"system":{"set_relay_state":{"state":%s}}}' % command
resp = getjson(ip, data_input)
def on(self, power=100):
try:
send(command = self.d_on, plug = int(self.plug_name), ip = self.plug_ip)
It would be nice to get the relay state from the tplink plug after sending off or on command and if it didnt change according the command, try to send it again a few times.
Thank you in advance!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.