www.homeseer.com    
 

Go Back   HomeSeer Message Board > Security Systems Plug-ins > Security System Discussion > HAI/OMNI Panel for HS3 Plug-in (rmasonjr)

HAI/OMNI Panel for HS3 Plug-in (rmasonjr) Discussion about Rob Mason's HAI/OMNI Panel Plug-in

Reply
 
Thread Tools Display Modes
  #1  
Old March 10th, 2017, 06:11 PM
ChrisCoble ChrisCoble is offline
Seer
 
Join Date: Mar 2017
Location: Ladera Ranch, CA
Posts: 13
Post How To: "Alexa, turn the upstairs heat on"

Hello All, wanted to capture a How To based on an exercise I did recently as a new user to HS and the great HAI plugin. Maybe this will help other new users in the future.

I'm using an OmniPro IIe with 2 OmniStat 2 thermostat's, the HomeSeer Zee 2, and a few Amazon Tap devices for Alexa.

What I was trying to accomplish was asking Alexa one of the following things using the "Simple" Alexa API:
  1. "Alexa, Turn on the downstairs heat"
    Would modify the current Heat Setpoint to 1 degree higher than the current temp, turning the heat on.
  2. "Alexa, Turn off the downstairs heat"
    Would modify the current Heat Setpoint to 1 degree lower than the current temp, turning the heat off.
  3. "Alexa, Turn on the downstairs air conditioning"
    Would modify the current Cooling Setpoint to 1 degree lower than the current temp, turning the AC On.
  4. "Alexa, Turn off the downstairs air conditioning"
    Would modify the current Cooling Setpoint to 1 degree above than the current temp, turning the AC off.

I also have an upstairs thermostat where I wanted the same behaviors expect with saying "upstairs" instead of "downstairs".

Assuming you have two thermostat's one named "Upstairs Thermostat" and "Downstairs Thermostat", I first created four virtual devices called "Downstairs Heat", "Downstairs Air Conditioning", and the other two for upstairs. Used the default on/off states.



I then created an event group in HS called "Downstairs Temperature" and created 4 events:



Each if the 4 events were configured roughly the same:

Code:
IF Downstairs (Heat|Air Conditioning) had its value set to (On|Off)
THEN "Run a Script or Script Command".


To avoid duplicating the script with subtle changes in all 4 events, I wrote a single C# script and specified parameters. First I'll post the script in C#.

Code:
public Object Main(Object[] parameters) 
{
   // Split the parameters
   string strParameters = parameters[0] as string;
   string[] tokens = strParameters.Split('|');

   // Put the parameters into individual variables
   bool increaseTemp = Convert.ToBoolean(tokens[0]);
   string currentTemp = tokens[1];
   string setpoint = tokens[2];

   // Get the current temperature
   var dv = hs.DeviceValueByName(currentTemp);

   // Increase or decrease the temperature per the parameter
   if (increaseTemp)
   {
      dv++;
   }
   else
   {
      dv--;
   }

   // Retrieve the device reference by name
   var targetDevice = hs.GetDeviceRefByName(setpoint);

   // Retrieve the control from the device reference
   var control = hs.CAPIGetSingleControl(targetDevice,false,"0",false,true);

   // Set the new target temperature
   control.ControlValue = dv;

   // Push the value to the physical thermostat
   hs.CAPIControlHandler(control);

   return null;
}
Note the use of the CAPI API's. This is the only way to inject the heat or cool setpoint back to the physical thermostat device.

Then for each event calling the above script I specified the script parameters as the following:


  • Turn Off Downstairs Air Conditioning:
    True|Downstairs Temperature|Downstairs Cooling Setpoint
  • Turn Off Downstairs Heat:
    False|Downstairs Temperature|Downstairs Heating Setpoint
  • Turn On Downstairs Air Conditioning:
    False|Downstairs Temperature|Downstairs Cooling Setpoint
  • Turn On Downstairs Heat:
    True|Downstairs Temperature|Downstairs Heating Setpoint

I repeated this same thing for the upstairs events.

The commands perform as expected and even the first day of having them working I used it several times in response to one of the kids saying they were hot. Hopefully this helps someone else!

Thank you to rmasonjr and sparkman for helping me out getting to this solution.
Attached Images
    
Reply With Quote
  #2  
Old March 10th, 2017, 06:38 PM
rmasonjr's Avatar
rmasonjr rmasonjr is online now
OverSeer
 
Join Date: May 2001
Location: Brookhaven, MS USA
Posts: 6,456
Oh wow - thanks for this writeup! Great information!
__________________

HS3Pro Running on a Raspberry Pi2 (Raspbian)
64 Z-Wave Nodes, 162 Events, 293 Devices
UPB modules via OMNI plugin/panel
Plugins: Z-Wave, BLRF, OMNI, HSTouch, weatherXML, EasyTrigger
HSTouch Clients: 3 Android, 1 Joggler
Reply With Quote
Reply

Bookmarks

Tags
alexa, capi, omnipro, thermostat

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Echo/Alexa API "On" versus "On Last Level" wcross HomeSeer Amazon Echo Connected Home API 3 September 8th, 2017 11:45 PM
Alexa confused whether HS skill enabled so can't "Alexa, tell homeseer to..." lowenna HomeSeer Amazon Echo Skill 6 February 3rd, 2017 09:07 AM
Have Alexa turn "on" to Last Level wcross HomeSeer Amazon Echo Connected Home API 3 January 7th, 2017 04:24 PM
Z-Wave Leviton switches turn "off" but not "on" bradhs HomeSeer Z-Wave Plug-in 5 May 27th, 2016 11:55 AM
Need some ideas to "alert" when dog goes upstairs Malarcy HomeSeer General Discussion Area 9 January 9th, 2006 05:05 PM


All times are GMT -4. The time now is 02:00 PM.


Copyright HomeSeer Technologies, LLC