more G-Labs products

Author Topic: Generic Thermostat APP  (Read 20455 times)

November 11, 2014, 01:43:19 AM
Read 20455 times

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
This app implement a thermostat device logic.
The user can specify an arbitrary module to read the temperature from and also a module to be used to turn on/off for heating/cooling.
This is still a work in progress but it's kind of working.
It requires to update the thermostat widget files as well in the "pages/control/widgets/homegenie/generic" folder (btw these files will be pushed in the next hg update when completed).
It can also be used with Eden Board as well :)

UPDATE!!!:
Files are no more available here for download as these are updated and available with latest HomeGenie r421.
Also Eden Board documentation is now available here:
http://www.homegenie.it/docs/diy/eden.php#hg_eden_setup


g.
« Last Edit: November 14, 2014, 10:48:57 PM by Gene »

November 11, 2014, 02:15:28 PM
Reply #1

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Updated thermostat widget v1.1.

- added support for Cool set point
- completed option popup dialog for setting different values for Cool and Heat set point; when Cool set point is not supported by the thermostat the button will be disabled
- updated cool/heat/fan icons

live preview available here:

http://codepen.io/anon/pen/bNbLQj?editors=101

Cheers,
g.


« Last Edit: November 11, 2014, 02:17:04 PM by Gene »

November 12, 2014, 10:24:58 PM
Reply #2

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Update both widget (v1.2) and generic thermostat app:

widget:
- thermostat api refactoring (to match also new z-wave thermostat device handler coming with HG r419)

app:
- updated implemented api
- response time on settings change is now real time

g.

November 15, 2014, 02:48:57 PM
Reply #3

bradvoy

  • ***
  • Information
  • Full Member
  • Posts: 50
I installed 421.  I like the look of the new thermostat module and especially the ability to set both cool and heat setpoints.  But how do I change it to use Fahrenheit instead of Celsius?  When I change the heat setpoint using the module, nothing happens with my thermostat.  Maybe that's because my thermostat is expecting a Fahrenheit setting?

November 15, 2014, 03:22:24 PM
Reply #4

bradvoy

  • ***
  • Information
  • Full Member
  • Posts: 50
421 has also introduced an incompatibility with one of my programs.  It is now logging this error:

Cannot cast from source type to destination type.
  at MIG.Interfaces.HomeAutomation.ZWave+Command.op_Explicit (System.String str) [0x00000] in <filename unknown>:0
  at MIG.Interfaces.HomeAutomation.ZWave.InterfaceControl (MIG.MIGInterfaceCommand request) [0x00000] in <filename unknown>:0
  at HomeGenie.Service.HomeGenieService.InterfaceControl (MIG.MIGInterfaceCommand cmd) [0x00000] in <filename unknown>:0


I believe the error is coming from these 2 lines:

      var temperature = Modules.WithName(item).Command("Therm.Temp");
      temperature.Set(newTemp);


Has the new thermostat code with separate cool and heat setpoints changed it so there is no longer a Therm.Temp command?  What command names should I use instead?

November 15, 2014, 03:27:12 PM
Reply #5

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi bradvoy,

read here:

http://www.homegenie.it/forum/index.php?topic=244.msg2569#msg2569

click the linked ZWave.cs file to see the new api.

Cheers,
g.

November 15, 2014, 06:49:41 PM
Reply #6

mblack

  • *
  • Information
  • Newbie
  • Posts: 14
Gene, I also like the new look and feel of the thermostat widget. Thanks for the quick work. Is there any way to switch between Celsius and Fahrenheit ?

November 16, 2014, 02:25:06 AM
Reply #7

bradvoy

  • ***
  • Information
  • Full Member
  • Posts: 50
Thanks for the quick reply Gene.  Based on the code you pointed me to, I changed my program to use the command "Thermostat.SetPointSet".  I no longer get an error logged, but it's still not changing the setting on my thermostat.  And as I mentioned before, the thermostat widget is also not talking to my thermostat.  This was working prior to the installation of 421, so it's not a problem with Z-Wave pairing or anything like that.

November 16, 2014, 11:29:19 AM
Reply #8

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
This is how to use it:

Code: [Select]
var setPoint = Modules.WithName(item).Command("Thermostat.SetPointSet");
setPoint.Set("Heating/22");

you could also set Cooling:

Code: [Select]
setPoint.Set("Cooling/20");

Cheers,
g.

November 16, 2014, 03:21:41 PM
Reply #9

mblack

  • *
  • Information
  • Newbie
  • Posts: 14
Gene,
I figured out how to switch it to Fahrenheit, but 1 other thing i noticed is that the thermostat is not reporting back the current temperature to the widget, or the app isn't requesting it. Any ideas on the problem.

Thanks,
MBlack

November 16, 2014, 03:52:39 PM
Reply #10

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi mblack,

this is where I need your help since I don't have a z-wave thermostat.
I think that two things are needed:

1) improve the widget initialization code so that it will call Thermostat.ModeGet, Thermostat.SetPointGet (for both Heating and Cooling), Thermostat.FanModeGet and Thermostat.FanStateGet
2) configure the z-wave thermostat to report periodically the temperature to hg

For the first thing, I can send you an updated thermostat.json file so you can test it.
For the second you should look at your thermostat specs/docs.

The Fahrenheit/Celsius issue it will get some more elegant solution at some point:
http://www.homegenie.it/forum/index.php?topic=346.msg2595#msg2595

Cheers,
g.


November 16, 2014, 04:21:31 PM
Reply #11

bradvoy

  • ***
  • Information
  • Full Member
  • Posts: 50
Thanks Gene.  Using the "Heating/<temp>" format my automation programs are now working again.  But I'm still unable to control the thermostats with the thermostat widgets.  When I make a change there, my thermostats don't seem to get the signal.

November 16, 2014, 05:44:43 PM
Reply #12

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
bradvoy, we need someone here with a z-wave thermostat and that can debug the new code.
Can't help on this any further.

g.

November 17, 2014, 02:28:01 AM
Reply #13

mblack

  • *
  • Information
  • Newbie
  • Posts: 14
Gene, I would be glad to test for you. Please send me an updated .json file that you need tested.

Thanks,
mblack

November 17, 2014, 02:30:31 AM
Reply #14

mblack

  • *
  • Information
  • Newbie
  • Posts: 14
bradvoy,

What part of the thermostat are you not able control with the widget, temp setting or mode setting ?