mhrivnak / radiotherm Goto Github PK
View Code? Open in Web Editor NEWpython client library for Radio Thermostat wifi-enabled home thermostats
License: BSD 3-Clause "New" or "Revised" License
python client library for Radio Thermostat wifi-enabled home thermostats
License: BSD 3-Clause "New" or "Revised" License
Radio Thermostat CT80 Rev B2 V1.09
> python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import radiotherm
>>> tstat = radiotherm.get_thermostat()
>>> tstat.temp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'temp'
>>> tstat = radiotherm.get_thermostat('192.168.10.129')
>>> tstat.temp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'temp'
>>> str(tstat)
'None'
>>>^D
>curl http://192.168.10.129/tstat
{"temp":70.50,"tmode":3,"fmode":2,"override":0,"hold":1,"t_heat":72.00,"t_cool":77.00,"ttarget":1,"program_mode":1,"tstate":1,"fstate":1,"time":{"day":2,"hour":20,"minute":19},"t_type_post":0}
>~/radiotherm-master# ./run-tests.sh
...............................
----------------------------------------------------------------------
Ran 31 tests in 0.028s
OK
>pip search radiotherm
radiotherm - client library for wifi thermostats sold by
radiothermostat.com
INSTALLED: 1.2 (latest)
There are now about 3 PRs related to updating some Radio Thermostat hardware revisions. These are impacting other projects, such as Home Assistant, and seem to be fairly trivial patches. Since one patch dates back to January, I wanted to see what the update process timeline is so I know when to expect to see some of these hit mainline?
Anyone up for giving this a shot? Personally I'm not very familiar with python/IFTTT but this seems like this should be pretty straight forward for someone who knows what they are doing
https://medium.com/mai-piu-senza/connect-a-python-script-to-ifttt-8ee0240bb3aa
Was wondering if there was something blocking support for these models? They seem pretty nice due to them supporting Alexa and z-wave
Just curious, because some projects (like home-assistant) use this project to add support for radiotherm devices, and if this project is no longer being maintained then we should fork this and maintain it so that support for newer devices can be added and issues resolved.
I've given up on these devices, they're just too unreliable to use for home automation for me (no fault of this project), but as a consequence I no longer have a way to test merge requests, etc. Thank you for letting me carry the torch for a while. Hopefully someone else (with trusted contributions here already?) is able to step up.
(I believe this is not exactly the same as #26 -- although the result is similar -- since the error message isn't quite the same.
Apologies if it's a dup.)
When I add the radio thermostat component to my home assistant configuration, HA tries to add my device but fails and puts this error in the log:
2018-04-21 10:41:14 ERROR (MainThread) [homeassistant.components.climate] radiotherm: Error on device update! Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 188, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 327, in async_device_update yield from self.hass.async_add_job(self.update) File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3.6/site-packages/homeassistant/components/climate/radiotherm.py", line 237, in update self._name = self.device.name['raw'] AttributeError: 'NoneType' object has no attribute 'name' 2018-04-21 10:41:44 WARNING (SyncWorker_2) [netdisco.ssdp] Error fetching description at http://[fe80::d4e2:6588:1d90:ba8a]:6544/getDeviceDesc
Like in #26, I believe this may be related to the Rev no. of the device.
I have a feeling I'm doing something wrong, but when I tried to follow the README to instantiate a Radio Thermostat device, it silently failed. Instead, what I had to do was this:
ct80 = radiotherm.thermostat.CT80(ip)
temp = ct80.temp['raw']
humidity = ct80.humidity['raw']
This was on Python 2.7.6. Notice I specified the CT80 directly but my guess is that's not what I should be doing. Doing it this way does work (I mostly wanted to grab the temp and humidity for logging periodically).
As an aside, I'm having nearly the exact same problem in Home Assistant and it seems to try to use the radiotherm library like the README as well (and seems to be failing).
Hi there,
Thanks for this nice library. It might be good to mention in the readme that the whole CT family is insecure, so that people don't develop incorrect expectations (your library is great, so I expect few people will read the manual, and fewer still realize that the device is insecure).
There are currently two CVEs (https://www.cvedetails.com/cve/CVE-2013-4860/ and https://www.cvedetails.com/cve/CVE-2018-11315/) against the CT line, and apparently the manufacturer hasn't fixed or responded to either. The first one allows any website you visit while connected to the Wifi to turn the heating or AC on or off, or change the target temperature; the second one additionally allows websites that you visit to exfiltrate data (the first one is a cross-site scripting vulnerability; the second one is a DNS rebinding issue).
Of course, none of these issues come from your neat library; but it's still things that users may want to know about.
Hi,
Was wondering in discovery why you check for the case where you get > 1 thermostats but only return the first? Why not just return the thermostats as a list?
if len(thermostats) > 1:
raise IOError("Found %d thermostats and I don't know which to pick." % len(thermostats))
return thermostats[0]
Thanks for the library.
Todd
Some sort of caching of the HTTP request data would significantly improve performance.
Each variable evaluation triggers a new HTTP request in radiotherm. Each request takes 5 to 20 seconds on my thermostat. A cache of GET requests would provide much better performance.
Thanks for developing this wonderful package. It is exactly what I have been looking to use on my RPi2 x-mas gift. I have two CT50 V1.92 themostats in the house and I have installed radiotherm v1.2 on my Rpi2. Do you have any suggestions of what I'm doing wrong or does the code need to be modified to support my stats?
Below is the result of my installation and 1st attempt to read temperature. Hopefully it will be useful:
pi@raspberrypi:~ $ sudo pip-3.2 install radiotherm
Downloading/unpacking radiotherm
Downloading radiotherm-1.2.tar.gz
Running setup.py (path:/tmp/pip-build-z5qyz6ne/radiotherm/setup.py) egg_info for package radiotherm
Installing collected packages: radiotherm
Running setup.py install for radiotherm
Successfully installed radiotherm
Cleaning up...
tstat = radiotherm.get_thermostat('192.168.1.4')
tstat.temp
Traceback (most recent call last):
File "<pyshell#9>", line 1, in
tstat.temp
AttributeError: 'NoneType' object has no attribute 'temp'
tstat.tmode
Traceback (most recent call last):
File "<pyshell#10>", line 1, in
tstat.tmode
AttributeError: 'NoneType' object has no attribute 'tmode'
I get the following error when trying to set up a CT80 Rev B1 V1.00 Radio Thermostat in Home Assistant:
ERROR:homeassistant.components.climate:Error while setting up platform radiotherm
Traceback (most recent call last):
File "/usr/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 164, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
File "/usr/lib64/python3.4/asyncio/tasks.py", line 393, in wait_for
return fut.result()
File "/usr/lib64/python3.4/asyncio/futures.py", line 274, in result
raise self._exception
File "/usr/lib64/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.4/site-packages/homeassistant/components/climate/radiotherm.py", line 66, in setup_platform
tstats.append(RadioThermostat(tstat, hold_temp, away_temps))
File "/usr/lib/python3.4/site-packages/homeassistant/components/climate/radiotherm.py", line 80, in init
self.set_time()
File "/usr/lib/python3.4/site-packages/homeassistant/components/climate/radiotherm.py", line 216, in set_time
'minute': now.minute
AttributeError: 'NoneType' object has no attribute 'time'
It looks like I have a different version of the CT80 that I have not seen before.
Anything you need to help assist in resolving this, please let me know.
CT80RevB2v026
from thermostat.py
class CT80RevB2v026(CT80RevB):
MODEL = 'CT80 Rev B V0.26'
from init.py
from .thermostat import (
Thermostat,
CommonThermostat,
CT30v175,
CT30v192,
CT30v194,
CT30v199,
CT50v109,
CT50v188,
CT50v192,
CT50v194,
CT80RevB1v100,
CT80RevB2v100,
CT80RevB2v103,
CT80RevB2v109,
CT80RevB2v026,
)
from . import discover
from . import fields
THERMOSTATS = (
CT30v175,
CT30v192,
CT30v194,
CT30v199,
CT50v109,
CT50v188,
CT50v192,
CT50v194,
CT80RevB1v100,
CT80RevB2v100,
CT80RevB2v103,
CT80RevB2v109,
CT80RevB2v026,
)
The API developer guide in section 2.7.3 states that tmode and/or temp could return a -1 in the case of a transient error within the thermostat. Today these values get returned as-is. We should instead handle these by raising an exception.
Currently, I have two of the radio thermostats, model CT80 B2 Rev v1.09. When working with the thermostat via the api, I noticed I could set the target temp on the thermostat if I used a only a interger for the target temp. If the temp was a floating point number (ie 72.3), the setting of the target temp would fail. In addition to this, I noticed I could set the target temp to 72.5 via the library and the thermostat would target temp would be set to 72. Is this normal behavior for the other models of the radio thermostat as well?
Some applications that use this library (e.g. Home Assistant) use pip to install radiotherm, and currently it's serving an older version (1.3): https://pypi.org/project/radiotherm/
Can you please consider adding a new co-maintainer on PyPI to make sure it's up to date with the latest releases of this library? I volunteer to do that if you don't have anyone else in mind!
I light of recent news about Microsoft acquiring Github, I propose that this project be moved to Gitlab.com. I am in the process of migrating my projects now, and it seems that since I have contributor rights here I am able to migrate this project too. @mhrivnak, thoughts?
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.