Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Thermostat control in new PH version Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
kemporama
Senior Member
Senior Member


Joined: November 21 2008
Online Status: Offline
Posts: 102
Posted: March 06 2011 at 22:47 | IP Logged Quote kemporama

I had originally posted this in the long thread talking about the new version of PH just released, but I think this would be more appropriate to have it's own thread over here.

Would someone be able to give me some quick guidance on how to get Insteon thermostats to work with the new version of PH? I have the devices set up under the new thermostats section, and PH is going out and poling them and pulling back the temps and set points. So that piece looks ok.

I'm trying to get to the point where I can send macros to the thermostats or do something when it reaches a certain temperature. It does not appear that the ph_setstat and ph_getstat functions are known by PH, they do not show up as an option in the script editor, and when I type them manually and try to run them I get errors.

Am I going down the wrong path to get control of the devices?

Thanks!
Back to Top View kemporama's Profile Search for other posts by kemporama
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 11 2011 at 15:31 | IP Logged Quote dhoward

Kemporama,

You're definitely doing it the proper way. Updating the list of valid functions in PowerHome is something I forgot to do in this beta release so its normal for PowerHome to appear like they are invalid. They will work properly if they entered correctly. The main thing to keep in mind is that the ID field is the ID you assigned the thermostat in the new thermostat table and not the ID of the Insteon definition for the thermostat adapter (unless you assigned them the same ).

You won't be able to send macros to the tstats or get the tstats themselves to fire triggers but if PowerHome is running continously, you can create PowerHome triggers in response to Tstat changes or PowerHome macros integrating the ph_getstat and ph_setstat functions. The new trigger type is "Thermostat" and you'll select the newly defined tstat ID. You can then select the specific tstat value you would like to trigger off of when that value changes.

Let me know the specific errors you get (and the actual commands you're trying to send) when you manually use the ph_setstat and ph_getstat functions and we'll get you going.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
kemporama
Senior Member
Senior Member


Joined: November 21 2008
Online Status: Offline
Posts: 102
Posted: March 11 2011 at 20:26 | IP Logged Quote kemporama

Dave,
Thanks for the guidance. I was able to get a little bit farther now. I've got my trigger set up correctly it looks like. So basically (please correct me if I'm wrong) how it works is the trigger will only get activated if there is a change in temp or mode from the previous polling time to the next. Then once it's activated I can tell it what to do just like any other trigger.

Now it's time for the part I always have the most trouble with, writing the formulas. I'm trying to just do something simple to start, like activate a heat setpoint of 75 degrees. The formula I'm trying is:

ph_setstat ("TSTAT_LIVING_RM", heatsp, 75)

When I run it I get a syntax error. The Device ID is correct, the names in both the new thermostat table and in Insteon explorer are the same. I've tried adding and removing the quotes from the different values but no luck. I'm sure I'm missing something obvious.

Thanks.
Back to Top View kemporama's Profile Search for other posts by kemporama
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 16 2011 at 14:21 | IP Logged Quote dhoward

Kemporama,

You are correct in how the trigger works. It will only fire on a change since the last poll. However, it will also fire if you manually request a value (or change it) using ph_getstat or ph_setstat and the new value is different from the current value.

The proper format for your ph_setstat formula (change the heat setpoint of Tstat ID TSTAT_LIVING_RM to 75) would be:

ph_setstat("TSTAT_LIVING_RM","heatsp",75)

Give that a try and see if it works for you.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
kemporama
Senior Member
Senior Member


Joined: November 21 2008
Online Status: Offline
Posts: 102
Posted: March 16 2011 at 18:05 | IP Logged Quote kemporama

Dave-
I just tried the formula you gave me. I still don't seem to have any luck. I've pasted a picture of the log here after I try the formula 2 different ways.



The 17:49:58 entry is when I copy and paste the formula you wrote into the formula field at the top left of PH. It appears to run ok but nothing happens... the display on the thermostat doesn't update and the heat setpoint field under thermostats in PH explorer doesn't update either. I have it temporairly set to poll every minute to see if that would kick it off but no luck.

The 17:50:16 syntax error entry is when I try to run a macro with that formula as the only command in it.

Do the thermostats need to be linked a special way to the controller on the links tab in Insteon explorer? On each thermostat I have the conroller listed in the controllers in group 1, and I've tried using both button 1 and 2 but neither seem to work. I'm not able to drag the controller into the responders section, it doesn't let me.

Just for the record I'm running PH version 2.1.4 and DB version 2.1.2. Is there maybe a database update that I missed in the new version thread?

Thanks.
Back to Top View kemporama's Profile Search for other posts by kemporama
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 17 2011 at 00:06 | IP Logged Quote dhoward

Kemporama,

The 17:49:58 entry has serious problem. Not sure what formula you ran (or where), but the entry says that "Macro" with an ID of the formula I gave you was run. It would normally be impossible to create a macro with that formula as an ID. If I had to guess, I would say that you copy/pasted the formula into the "Macro / Formula" field right beneath the toolbar of the main PowerHome window. This field is primarily for executing a macro (by dropping down the list of macro ID's or typing it manually) but as the caption implies, you can use it to evaluate a simple formula. However, in order for the data to be evaluated as a formula rather than submitted to the execution queue as a macro ID, you must prefix the formula with either a single quote or a double quote.

A single quote will take the following formula and submit it to the execution queue with no feedback. Prefixing the formula with a double quote, will execute the formula immediately (bypassing the queue) and popup a results window.

The preferred method for testing formulas however is to open the PowerHome Multi-Editor and pressing Shift-F6 for (PH Formula) mode. Within this window, you don't prefix the formulas and they can be executed in their raw format (prefixing will result in a syntax error).

Your 17:50:16 entry shows that you executed a macro with an ID of TEST123. Im not sure what the actual contents of this macro are but it would appear that there is a problem .... wait..hold the presses...I found the problem and its my fault (at least with your macro...your first issue still stands). I mistyped the function names in the Beta thread. The proper function names are:

ph_gettstat
ph_gettstat_s
ph_settstat

There are 2 "T's"...not 1. Really sorry for this mistake. Ive looked this over and over and didnt catch it until I actually tried copy/pasting the actual stuff I typed.

Let me know how this works for you.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
kemporama
Senior Member
Senior Member


Joined: November 21 2008
Online Status: Offline
Posts: 102
Posted: March 17 2011 at 16:23 | IP Logged Quote kemporama

Thanks, the extra T fixed the problems. I'm able to get the PH_settstat command to run successfully now. Haven't tried to tackle gettstat yet, I'll save that for another day.

Good info about the formula/macro field too, will be very helpful going forward.

If you're able to edit the old posts in the beta thread with the corrected spelling it might head off some questions when the next novice programmer like me comes along and can't figure it out. :)

Back to Top View kemporama's Profile Search for other posts by kemporama
 
kemporama
Senior Member
Senior Member


Joined: November 21 2008
Online Status: Offline
Posts: 102
Posted: April 04 2011 at 01:04 | IP Logged Quote kemporama

I've gotten back to playing with my thermostats and the ph_gettstat command. I've made a test macro with the below formula in it:

if (ph_gettstat ("TSTAT_LIVING_RM", "temp", 1) >70, 1, 3)

What I was hoping would happen was that when the formula is executed if it was true it would go down 1 to the next line and run a command and then end macro, but if it was false it would go down 3 lines for a separate command and end.

When I run the macro it always results to the first or "true" option and goes to the next line. I run the formula thru multi-edit and when it evaluates it it comes back with a result of "1" or "3" depending on which way I flip the > and > signs. I can never get it to jump down 3 lines.

I've have several formulas working like that already elsewhere, and I assumed the same format would work in this case, but it doesn't appear to be.

I can't figure out what I am missing.

Thanks!
Back to Top View kemporama's Profile Search for other posts by kemporama
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: April 04 2011 at 03:25 | IP Logged Quote grif091

What is returned when only the ph_gettstat(....) function is executed?

I hate to ask but Jump is being used rather than Formula.

__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
kemporama
Senior Member
Senior Member


Joined: November 21 2008
Online Status: Offline
Posts: 102
Posted: April 04 2011 at 09:44 | IP Logged Quote kemporama

Lee-
I'm glad you did ask if I was using Jump because that was the problem, I was using Forumla instead. Aggghhh!

My novice programming skills are showing.

Thank you, as always!
Back to Top View kemporama's Profile Search for other posts by kemporama
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: April 04 2011 at 12:24 | IP Logged Quote grif091

Don't worry about it.   I have been writing programs in one language or another for 30 years and make the Formula versus GoTo mistake at least once when coding a Macro of any size. You will develop a list of gotchas over time.

If you have not tried GoTo and Label rather than Jump it is something to look into. Dave has often recommended the use of GoTo rather than Jump and I have found that a good suggestion.

Jump is very number of lines dependent making it harder to insert new code later on. Using GoTo and Label takes an extra line in the beginning to define the Label but it eliminates all the issues of having to adjust Jump numbers when lines are added or deleted.

The only gotcha is that Label defines the name of the label, coded WITHOUT quotes. The If statement uses quotes around the true/false results strings.

GoTo   If x < y, "Next", "Somewhere"
xxxxx
yyyyy
yyyyy
xxxxx
xxxxx
Label   Somewhere

In the above example Next is not defined so the GoTo just falls through to the next sequential statement. Next could be defined as a Label in the Macro. By using GoTo additional statements (yyyyy) can be added between the GoTo and the Label Somewhere without concern for the affect on the overall flow.

Jump is fine for simple Macros. GoTo/Label works better particularly for Macros that will be evolving over time.   Also the Label itself can serve to document what the code does that follows.

Label ScanParms
Label Calculate
Label DisplayError

Hope you find Powerhome2 as fun to use as I do.


Edited by grif091 - April 04 2011 at 12:26


__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: April 04 2011 at 16:56 | IP Logged Quote smarty



__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
kemporama
Senior Member
Senior Member


Joined: November 21 2008
Online Status: Offline
Posts: 102
Posted: April 04 2011 at 19:23 | IP Logged Quote kemporama

Thanks, Lee.
I 've tested using labels once in the past and had some odd things happen when I was, so I kind of bailed on them at that time, but I will try my tstat macro again using labels.

I do have fun figuring out the different capabilities of PH. My smarthome network is an going project as I add devices, so I'm slowly expanding on the standard timed macros and stuff. I just ordered a couple of EZFlora devices to use after my new lawn irrigation system is installed, so that will be the next big thing I tackle. I found a good thread about using those, so I hopefully will be good with getting that all working. Will find out later this week!
Back to Top View kemporama's Profile Search for other posts by kemporama
 
DeanC
Groupie
Groupie
Avatar

Joined: August 18 2010
Location: United States
Online Status: Offline
Posts: 41
Posted: March 06 2013 at 00:17 | IP Logged Quote DeanC

Help! I'm having problems controlling a 2441TH from PH. I have no trouble retrieving data from the thermostat but nothing I try will control the 'stat. I've tried Sloop's macros and Dave's suggestion above. HouseLinc controls the thermostat fine, so I know it's not a hardware problem, compatibility issue, etc. Here's the relevant lines from the activity log when I try executing "ph_settstat("THERMOSTAT","heatsp",75)" (without the outer quotes):

Incoming Insteon received on INSTEON PLM controller INSTEON. From Address:[20.47.80] To Address:[18.B9.DF] Flags:[161] Cmd1:[109] Cmd2:[253]. Decode: NAK of Direct. From: THERMOSTAT To: COMPUTER_INTERFACE, TStat Heat SP

INSTEON PLM Controller INSTEON transmission of Address:[20.47.80] Flags:[5] Cmd1:[109] Cmd2:[150]. Decode: Direct. ID: THERMOSTAT, TStat Heat SP

I find it interesting that the number 75, the desired new setpoint, doesn't seem to appear in either message. I've been trying to get this to work for several weeks now and am becoming frustrated to the point of considering finding another software package for my automation needs. I love the versatility of PH, but nothing seems to be easy or straightforward about it. BTW I'm running version 2.1.4 and my PLM is a 2414U.

Thanks,
Dean
Back to Top View DeanC's Profile Search for other posts by DeanC
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: March 06 2013 at 06:16 | IP Logged Quote grif091

Are you using the 2414U with HouseLinc controlling the 2441TH?

The 2441TH is an I2CS device which I did not think could be handled by the old 2414 PLC.

EDIT: confirmed, the 2414 PLC does not support extended commands which means PH cannot write link records in an I2CS device as that requires extended commands. The NAK is the result of the CheckSum being invalid which only exists in an extended command.

Edited by grif091 - March 06 2013 at 11:35


__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
DeanC
Groupie
Groupie
Avatar

Joined: August 18 2010
Location: United States
Online Status: Offline
Posts: 41
Posted: March 06 2013 at 11:42 | IP Logged Quote DeanC

My mistake, it's actually a 2413U, PH reports it as being a 2414U. Could this be the problem? Maybe PH isn't sending extended commands because it thinks the controller can't handle them? I'll see if I can change the controller type. As for HouseLinc, yes I'm using the same controller, though I suspect that question isn't as important now that we know the PLM is a 2413U.

Thanks,
Dean

P.S. Dave, please don't take any offense at my earlier comment about PH! Every time I open PH I am amazed at what you've accomplished and at the power of, well, PowerHome. I'm just a bit frustrated.
Back to Top View DeanC's Profile Search for other posts by DeanC
 
DeanC
Groupie
Groupie
Avatar

Joined: August 18 2010
Location: United States
Online Status: Offline
Posts: 41
Posted: March 06 2013 at 12:13 | IP Logged Quote DeanC

Well, unfortunately there is no 2413U available in the drop down list so I set it to autodetect to see if that would help. I did notice that even though it was set to 2414U, the IENGINE was set to I2CS. Still no go for changing the setpoint, but it does look as if there may be more communication going on. In addition to the two log entries I reported before, the following now showed up:

Incoming Insteon received on INSTEON PLM controller INSTEON. From Address:[20.47.80] To Address:[18.B9.DF] Flags:[1] Cmd1:[111] Cmd2:[30]. Decode: Direct. From: THERMOSTAT To: COMPUTER_INTERFACE, Unmapped Command

INSTEON PLM Controller INSTEON transmission of Address:[20.47.80] Flags:[15] Cmd1:[107] Cmd2:[2]. Decode: Direct. ID: THERMOSTAT, TStat Control

Incoming Insteon received on INSTEON PLM controller INSTEON. From Address:[20.47.80] To Address:[18.B9.DF] Flags:[43] Cmd1:[107] Cmd2:[3]. Decode: Direct ACK. From: THERMOSTAT To: COMPUTER_INTERFACE, TStat Control

INSTEON PLM Controller INSTEON transmission of Address:[20.47.80] Flags:[15] Cmd1:[106] Cmd2:[0]. Decode: Direct. ID: THERMOSTAT, TStat Zone Info

Incoming Insteon received on INSTEON PLM controller INSTEON. From Address:[20.47.80] To Address:[18.B9.DF] Flags:[43] Cmd1:[106] Cmd2:[144]. Decode: Direct ACK. From: THERMOSTAT To: COMPUTER_INTERFACE, TStat Zone Info

NSTEON PLM Controller INSTEON transmission of Address:[20.47.80] Flags:[15] Cmd1:[106] Cmd2:[96]. Decode: Direct. ID: THERMOSTAT, TStat Zone Info

Incoming Insteon received on INSTEON PLM controller INSTEON. From Address:[20.47.80] To Address:[18.B9.DF] Flags:[43] Cmd1:[106] Cmd2:[31]. Decode: Direct ACK. From: THERMOSTAT To: COMPUTER_INTERFACE, TStat Zone Info

NSTEON PLM Controller INSTEON transmission of Address:[20.47.80] Flags:[15] Cmd1:[106] Cmd2:[32]. Decode: Direct. ID: THERMOSTAT, TStat Zone Info

Incoming Insteon received on INSTEON PLM controller INSTEON. From Address:[20.47.80] To Address:[18.B9.DF] Flags:[11] Cmd1:[106] Cmd2:[156]. Decode: Direct. From: THERMOSTAT To: COMPUTER_INTERFACE, TStat Zone Info

Thanks,
Dean
Back to Top View DeanC's Profile Search for other posts by DeanC
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: March 06 2013 at 13:15 | IP Logged Quote grif091

Need to see the Insteon Raw Log data. There is an option at the top of Insteon Explorer, Echo Raw Log to File.   Check that box and issue the command to change the set point. Uncheck the Echo Raw Log to File so file is closed. Copy and paste the raw Insteon commands. From the dates on earlier posts I suspect the tstat support is not taking into account I2CS. I2CS did not exist in April 2011.

__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
DeanC
Groupie
Groupie
Avatar

Joined: August 18 2010
Location: United States
Online Status: Offline
Posts: 41
Posted: March 06 2013 at 13:45 | IP Logged Quote DeanC

Hi Grif,

here's the requested data:

2013-03-06 12:36:58.537     TX  &nbs p;  02 62 17 0A 73 0F 19 00
2013-03-06 12:36:58.566     RX  &nbs p;  SENTINSTEON=18 B9 DF 17 0A 73 0F 19 00 06
2013-03-06 12:36:58.867     RX  &nbs p;  RECEIVEINSTEONRAW=17 0A 73 18 B9 DF 2B 00 00
2013-03-06 12:37:18.989     TX  &nbs p;  02 62 0F CD 2D 0F 19 00
2013-03-06 12:37:19.017     RX  &nbs p;  SENTINSTEON=18 B9 DF 0F CD 2D 0F 19 00 06
2013-03-06 12:37:19.318     RX  &nbs p;  RECEIVEINSTEONRAW=0F CD 2D 18 B9 DF 2B 00 00
2013-03-06 12:37:36.868     TX  &nbs p;  02 62 20 47 80 05 6D 96
2013-03-06 12:37:36.889     RX  &nbs p;  SENTINSTEON=18 B9 DF 20 47 80 05 6D 96 06
2013-03-06 12:37:37.081     RX  &nbs p;  RECEIVEINSTEONRAW=20 47 80 18 B9 DF A1 6D FD
2013-03-06 12:37:37.098     RX  &nbs p;  INSTEON NAK=20 47 80
2013-03-06 12:37:39.426     TX  &nbs p;  02 62 20 47 80 0F 19 00
2013-03-06 12:37:39.453     RX  &nbs p;  SENTINSTEON=18 B9 DF 20 47 80 0F 19 00 06
2013-03-06 12:37:39.738     RX  &nbs p;  RECEIVEINSTEONRAW=20 47 80 18 B9 DF 2B 19 00
2013-03-06 12:40:53.047     TX  &nbs p;  02 62 20 47 80 05 6D 96
2013-03-06 12:40:53.068     RX  &nbs p;  SENTINSTEON=18 B9 DF 20 47 80 05 6D 96 06
2013-03-06 12:40:53.274     RX  &nbs p;  RECEIVEINSTEONRAW=20 47 80 18 B9 DF A1 6D FD
2013-03-06 12:40:53.293     RX  &nbs p;  INSTEON NAK=20 47 80

Thanks for your help!

Dean
Back to Top View DeanC's Profile Search for other posts by DeanC
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: March 06 2013 at 14:29 | IP Logged Quote grif091

Thanks for the trace data, that confirms the problem. This is what the raw command should look like ...

02 62 1D 6C D6 1F 6D 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 77

The 02 62 is not displayed by PH

The 2441TH being an I2CS device is expecting an extended command to change the set point, not the standard command being used.   The NAK and cmd2=FD means the 2441TH did not find a valid CheckSum which only exists with an extended command.   Using the ph_settstat form will have to wait for 2.1.5 which is expected to have full I2CS support.

This could be done using ph_insteonwithretext("THERMOSTAT”, 109, xx, “”) where xx is the heat set point x 2. To set to 75 xx would be 150.


Edited by grif091 - March 06 2013 at 14:33


__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 

Page of 2 Next >>
  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum