Binding Radio Thermostat?

I don’t want to turn this into a java hand-holding thread, but I’m more of a UNIX guy and less of a developer. I did the git clone and then the mvn command but got an error:

Once I have my environment set up I can test my CT80 with the latest code.

http://pastebin.com/aJtx75ps

Not a problem. That’s a pretty cryptic Java error, so I don’t blame you. It’s pretty much just saying it couldn’t load a class. The root of the problem is “Unsupported major.minor version 51.0”. 51.0 means a class is compiled with Java 7 and you’re using an earlier JDK. If you have JDK 8 or JDK 7 installed, it’s likely that mvn is using another installation. “mvn -version” will tell you which local java installation it’s picking up. Fix that, and you should be able to compile.

You’re right; it does look like a different object. As I said, I haven’t had anything to test against yet :slight_smile:

And you’re also right about the t_humidity value. I guess I got caught up with following your convention and didn’t think to check against the spec.

As for dehumidifier and ext_dehumidifier, my plan was to add those (in addition to uma and pma) once I had an API to push up against.

Regarding the sub-objects, I’m not completely clear, based on the doc, how they look when returned from the API. I assume they are a json object? E.g. the following for /tstat/save_energy:

{ mode: 1, type:2, Delta: 2.5 }

Is this roughly what you see?

Again, if you don’t have time, it’s not a big deal. I will be able to test all of this Monday or Tuesday.

Yes, it’s JSON. I’m going to spend some time today blindly implementing the entire spec (there’s some cool stuff in there!). I’ll post a complete “*.items” list after I push. I’ll test what I can on my hardware, and I’ll need your help to test the CT80. I’ll also need some help making some top-notch sitemaps for the various models.

We’ll also need some help testing the CT50 at that point… cough @RHINESEL

-E

Ready… it’ll help to have a .jar for me. I’m taking my first steps with OH and really not ready to start building stuff from source.

Updated the binding. It is now very “dumb” and will do exactly what the configuration tells it to do. Note that the item configurations have changed!

You can download the new SNAPSHOT build here:
ejthill.github.io/org.openhab.binding.radiothermostat-1.9.0-20160910-SNAPSHOT.jar

Here’s a list of all the items from the API documentation:
Note that HVAC settings are different for CT30/50 vs CT80!
*Also note to NOT include the # comments from your .items file

Number RT_TStat_Version                  {radiothermostat="http://192.168.0.2/tstat/Version?post=false"}
Number RT_TStat_Temp                     {radiothermostat="http://192.168.0.2/tstat/temp"}
Number RT_TStat_TMode                    {radiothermostat="http://192.168.0.2/tstat/tmode"}
Number RT_TStat_FMode                    {radiothermostat="http://192.168.0.2/tstat/fmode"}
Number RT_TStat_Override                 {radiothermostat="http://192.168.0.2/tstat/override?post=false"}
Number RT_TStat_Hold                     {radiothermostat="http://192.168.0.2/tstat/hold"}
Number RT_TStat_THeat                    {radiothermostat="http://192.168.0.2/tstat/t_heat"}
Number RT_TStat_TCool                    {radiothermostat="http://192.168.0.2/tstat/t_cool"}
Number RT_TStat_ITHeat                   {radiothermostat="http://192.168.0.2/tstat/it_heat"}
Number RT_TStat_ITCool                   {radiothermostat="http://192.168.0.2/tstat/it_cool"}
Number RT_TStat_AHeat                    {radiothermostat="http://192.168.0.2/tstat/a_heat"}
Number RT_TStat_ACool                    {radiothermostat="http://192.168.0.2/tstat/a_cool"}
Number RT_TStat_AMode                    {radiothermostat="http://192.168.0.2/tstat/a_mode?get=false"}
Number RT_TStat_TTypePost                {radiothermostat="http://192.168.0.2/tstat/t_type_post?post=false"}
Number RT_TStat_TState                   {radiothermostat="http://192.168.0.2/tstat/tstate?post=false"}
Number RT_TStat_FState                   {radiothermostat="http://192.168.0.2/tstat/fstate?post=false"}
Number RT_TStat_Time                     {radiothermostat="http://192.168.0.2/tstat/time"}
Number RT_TStat_ProgramMode              {radiothermostat="http://192.168.0.2/tstat/program_mode"}
Number RT_TStat_TTarget                  {radiothermostat="http://192.168.0.2/tstat/ttarget?post=false"}
String RT_TStat_Model                    {radiothermostat="http://192.168.0.2/tstat/model/model?post=false"}
Number RT_TStat_EneryLed                 {radiothermostat="http://192.168.0.2/tstat/led/energy_led?get=false"}
Number RT_TStat_PMA_Line                 {radiothermostat="http://192.168.0.2/tstat/pma/line?get=false"}
String RT_TStat_PMA_Message              {radiothermostat="http://192.168.0.2/tstat/pma/message?get=false"}
Number RT_TStat_PMA_Mode                 {radiothermostat="http://192.168.0.2/tstat/pma/mode?get=false"}
Number RT_TStat_UMA_Line                 {radiothermostat="http://192.168.0.2/tstat/uma/line?get=false"}
String RT_TStat_UMA_Message              {radiothermostat="http://192.168.0.2/tstat/uma/message?get=false"}
Number RT_TStat_RemoteTemp_Mode          {radiothermostat="http://192.168.0.2/tstat/remote_temp/rem_mode"}
Number RT_TStat_RemoteTemp_Temp          {radiothermostat="http://192.168.0.2/tstat/remote_temp/rem_temp?get=false"}
Number RT_TStat_Lock_Mode                {radiothermostat="http://192.168.0.2/tstat/lock/lock_mode"}
Number RT_TStat_Simple_Mode              {radiothermostat="http://192.168.0.2/tstat/simple_mode/simple_mode"}
Number RT_TStat_SaveEnergy_Mode          {radiothermostat="http://192.168.0.2/tstat/save_energy/mode"}
Number RT_TStat_SaveEnergy_Type          {radiothermostat="http://192.168.0.2/tstat/save_energy/type"}
Number RT_TStat_SaveEnergy_Delta         {radiothermostat="http://192.168.0.2/tstat/save_energy/delta"}
Number RT_TStat_TSwing                   {radiothermostat="http://192.168.0.2/tstat/tswing/tswing"}
Number RT_TStat_NightLight_Intensity     {radiothermostat="http://192.168.0.2/tstat/night_light/intensity"}
Number RT_TStat_Cool_TempDiff            {radiothermostat="http://192.168.0.2/tstat/cool/temp_diff"}
Number RT_TStat_Heat_TempDiff            {radiothermostat="http://192.168.0.2/tstat/heat/temp_diff"}
Number RT_TStat_FanCTime                 {radiothermostat="http://192.168.0.2/tstat/fan_ctime/fan_ctime"}
Number RT_TStat_Humidity                 {radiothermostat="http://192.168.0.2/tstat/humidity/humidity?post=false"}
Number RT_TStat_THumidity                {radiothermostat="http://192.168.0.2/tstat/thumidity/thumidity"}
Number RT_TStat_Humidifier_Mode          {radiothermostat="http://192.168.0.2/tstat/humidifier/humidifier_mode"}
Number RT_TStat_Dehumidifier_Mode        {radiothermostat="http://192.168.0.2/tstat/dehumidifier/mode"}
Number RT_TStat_Dehumidifier_SetPoint    {radiothermostat="http://192.168.0.2/tstat/dehumidifier/setpoint"}
Number RT_TStat_ExtDehumidifier_Mode     {radiothermostat="http://192.168.0.2/tstat/ext_dehumidifier/mode"}
Number RT_TStat_ExtDehumidifier_SetPoint {radiothermostat="http://192.168.0.2/tstat/ext_dehumidifier/setpoint"}
Number RT_TStat_Time_Format              {radiothermostat="http://192.168.0.2/tstat/time/format"}
Number RT_TStat_AirBaffle_Mode           {radiothermostat="http://192.168.0.2/tstat/air_baffle/baffle_mode"}

#HVAC for CT30/3m50
Number RT_TStat_HVAC_Pump                {radiothermostat="http://192.168.0.2/tstat/hvac_settings/pump?post=false"}
Number RT_TStat_HVAC_AuxType             {radiothermostat="http://192.168.0.2/tstat/hvac_settings/aux_type?post=false"}
Number RT_TStat_HVAC_Code                {radiothermostat="http://192.168.0.2/tstat/hvac_settings/hvac_code?post=false"}

#HVAC for CT80
Number RT_TStat_HVAC_Pump                {radiothermostat="http://192.168.0.2/tstat/hvac_settings/pump?post=false"}
Number RT_TStat_HVAC_AuxStages           {radiothermostat="http://192.168.0.2/tstat/hvac_settings/aux_stages?post=false"}
Number RT_TStat_HVAC_AuxType             {radiothermostat="http://192.168.0.2/tstat/hvac_settings/aux_type?post=false"}
Number RT_TStat_HVAC_HeatStages          {radiothermostat="http://192.168.0.2/tstat/hvac_settings/heat_stages?post=false"}
Number RT_TStat_HVAC_CoolStages          {radiothermostat="http://192.168.0.2/tstat/hvac_settings/cool_stages?post=false"}

# Special Binding Types
Switch RT_Refresh                        {radiothermostat="http://192.168.0.2/tstat/_refresh?get=false"}
String RT_LastConnTime                   {radiothermostat="http://192.168.0.2/tstat/_last_connection_time?post=false"}

# System information
String RT_Sys_UUID                       {radiothermostat="http://192.168.0.2/sys/uuid?post=false"}
Number RT_Sys_ApiVersion                 {radiothermostat="http://192.168.0.2/sys/api_version?post=false"}
String RT_Sys_FwVersion                  {radiothermostat="http://192.168.0.2/sys/fw_version?post=false"}
String RT_Sys_WlanFwVersion              {radiothermostat="http://192.168.0.2/sys/wlan_fw_version?post=false"}
String RT_Sys_Name                       {radiothermostat="http://192.168.0.2/sys/name/name"}
String RT_Sys_Command                    {radiothermostat="http://192.168.0.2/sys/command/command?get=false"}
Number RT_Sys_Mode                       {radiothermostat="http://192.168.0.2/sys/mode/mode"}
String RT_Sys_Network_SSID               {radiothermostat="http://192.168.0.2/sys/network/ssid?post=false"}
String RT_Sys_Network_BSSID              {radiothermostat="http://192.168.0.2/sys/network/bssid?post=false"}
Number RT_Sys_Network_Channel            {radiothermostat="http://192.168.0.2/sys/network/channel?post=false"}
Number RT_Sys_Network_Security           {radiothermostat="http://192.168.0.2/sys/network/security?post=false"}
Number RT_Sys_Network_IP                 {radiothermostat="http://192.168.0.2/sys/network/ip?post=false"}
String RT_Sys_Network_IPAddr             {radiothermostat="http://192.168.0.2/sys/network/ipaddr?post=false"}
String RT_Sys_Network_IPMask             {radiothermostat="http://192.168.0.2/sys/network/ipmask?post=false"}
String RT_Sys_Network_IPGW               {radiothermostat="http://192.168.0.2/sys/network/ipgw?post=false"}
String RT_Sys_Network_IPDNS1             {radiothermostat="http://192.168.0.2/sys/network/ipdns2?post=false"}
String RT_Sys_Network_IPDNS2             {radiothermostat="http://192.168.0.2/sys/network/ipdns1?post=false"}
Number RT_Sys_Network_RSSI               {radiothermostat="http://192.168.0.2/sys/network/rssi?post=false"}

If I use this entire items list, my log will tell me the resources that my CT30 does not support:

2016-09-10 14:14:29.391 [ERROR] [o.b.r.i.RadioThermostatBinding] - http://192.168.0.2/tstat/ext_dehumidifier returned error: Invalid HTTP API
2016-09-10 14:14:29.412 [ERROR] [o.b.r.i.RadioThermostatBinding] - http://192.168.0.2/tstat/save_energy returned error: Invalid HTTP API
2016-09-10 14:14:29.433 [ERROR] [o.b.r.i.RadioThermostatBinding] - http://192.168.0.2/tstat/air_baffle returned error: Invalid HTTP API
2016-09-10 14:14:29.454 [ERROR] [o.b.r.i.RadioThermostatBinding] - http://192.168.0.2/tstat/simple_mode returned error: Invalid HTTP API
2016-09-10 14:14:29.798 [ERROR] [o.b.r.i.RadioThermostatBinding] - http://192.168.0.2/tstat/cool returned error: Invalid HTTP API
2016-09-10 14:14:29.821 [ERROR] [o.b.r.i.RadioThermostatBinding] - http://192.168.0.2/tstat/lock returned error: Invalid HTTP API
2016-09-10 14:14:29.841 [ERROR] [o.b.r.i.RadioThermostatBinding] - http://192.168.0.2/tstat/tswing returned error: Invalid HTTP API
2016-09-10 14:14:30.069 [ERROR] [o.b.r.i.RadioThermostatBinding] - http://192.168.0.2/tstat/fan_ctime returned error: Invalid HTTP API
2016-09-10 14:14:30.092 [ERROR] [o.b.r.i.RadioThermostatBinding] - http://192.168.0.2/tstat/heat returned error: Invalid HTTP API
2016-09-10 14:14:30.514 [ERROR] [o.b.r.i.RadioThermostatBinding] - http://192.168.0.2/tstat/humidifier returned error: Invalid HTTP API
2016-09-10 14:14:30.538 [ERROR] [o.b.r.i.RadioThermostatBinding] - http://192.168.0.2/tstat/dehumidifier returned error: Invalid HTTP API
2016-09-10 14:14:30.563 [ERROR] [o.b.r.i.RadioThermostatBinding] - http://192.168.0.2/tstat/night_light returned error: Invalid HTTP API
2016-09-10 14:14:30.563 [ERROR] [o.b.r.i.RadioThermostatBinding] - http://192.168.0.2/tstat/hvac_settings returned error: Invalid HTTP API

Now we need to create some nice looking sitemaps with transform/*.map configurations to make sense of all of these raw values. Any takers? Let me know if you encounter any issues!

-E

3 Likes

I was able to get java updated and maven working so I did get a jar file.

However, I’m not sure that I have the latest code you did yesterday. I did a “git pull” but it says that the files are uptodate. They are dated Sept 2nd, not yesterday.

It will be good to have a complete/accurate set of lines for the items file, since what I have now is cobbled together from posts up above in this thread.

Hello,

Using your pre-built org.openhab.binding.radiothermostat-1.9.0-20160910-SNAPSHOT.jar I’m getting some really good results with my CT80:

http://pastebin.com/Ue7JkWQQ

Sorry, apparently I hadn’t pushed the latest code changes to GitHub. That is now fixed. Good to hear things seem to be working with your CT80. Looking at your log, it seems the only API not supported by your CT80 is temperature differential using /tstat/cool and /tstat/heat. That’s not supported by my CT30, either. It will be interesting to see if the CT50 supports that or if it’s just some legacy documentation.

Also, to your point about a complete/accurate set of items: I’m sure you figured this out, but you should use the items from this post, and ignore everything before it:

I can help test the transforms, though I’m concerned about having things hard-coded in there that only work for certain models.

Also, I noticed today that after it’s been running for a bit with the new jar file, I get some different errors that don’t seem to happen initially when it starts up. I’m new to decoding java error messages, but it looks like calls to the CT80 that were working, stop working.

http://pastebin.com/jsciddPY

Can you paste your complete radio thermostat items file?

Here you go:

http://pastebin.com/pVdv2VQm

Crud - my bad. I had some “extra” old config in my sitemap, not in the items directory. Cleaned out now. I think that may have fixed this issue. Will report back for sure.

All good. That’s one of the issues. The other is you have lines in the items file that start with #, which I don’t think is valid. I included those as notes to you guys, but you’ll need to remove them. Your items file is only being read up until that point probably, and openHAB isn’t spitting out any warnings.

Also, you should remove the CT30/50 HVAC-specific items.

Just to address that comment. Nothing is hardcoded. It is completely driven by configuration. The issue is that the API support varies from model to model. That means each model will need a slightly different configuration. This is addressed in the documentation as well. There are all sorts of notes like this one: “Note: Only available with CT-30”

I either had to choose to write a bunch of code to make different models transparent to the configuration (hardcode it), or simply provide all of the functionality blindly and leave it up to the configuration to determine what is supported. I chose the latter. It’s a lot less code that way. And less code usually means less bugs.

-E

I’ve installed they binding in my OH2 server but am puzzled as to how to get the binding to fetch item values… Do I need a rule? Can I add a setting to the sitemap or items file?

I haven’t tested the binding on OpenHab 2. I cannot provide any guarantees it will function appropriately outside of OH1.

Whenever you send a command to the device, it forces a full refresh of all values. Or, if you’d like, this can be used to force a refresh:

Switch RT_Refresh                        {radiothermostat="http://192.168.0.2/tstat/_refresh?get=false"}
1 Like

As a heads up to anyone in the future, I have moved this code to a separate branch in my openhab fork: https://github.com/ejthill/openhab/tree/radiothermostat