more G-Labs products

Author Topic: CHANGE TEMPERATURE OF THERMOSTAT FROM SCHEDULER  (Read 730 times)

October 19, 2016, 10:58:43 AM
Read 730 times

perruca

  • *
  • Information
  • Newbie
  • Posts: 5
Hi!

I want to set the heating temperature of the thermostat module from scheduler, but I don`t find the right code to do that. ¿Can someone help me?

Thanks!!

Nacho.-
« Last Edit: October 19, 2016, 03:46:50 PM by perruca »

October 19, 2016, 04:54:28 PM
Reply #1

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I thought the thermostat had a built-in scheduler actually.  You should be able to use the main scheduler as well, but the built-in code would be better to use IMO.

October 19, 2016, 08:56:51 PM
Reply #2

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
I've been playing around with the new scheduler, and have gotten most stuff to work, but this one has got me stumped...

For example this works: (after a refresh of the screen, as the widget doesn;t refresh itself.)
Code: [Select]
var sensor = $$.modules.withName("Multi Sensor").get();
sensor.Parameter("Sensor.Luminance").Value = 131;

But this doesn't seem to work:
Code: [Select]
var sensor = $$.modules.withName("MyThermostat").get();
sensor.Parameter("Thermostat.Mode").Value = "Heat";
sensor.Parameter("Thermostat.SetPoint.Heating") = 19;

Maybe I'm doing something wrong, not sure. I renamed the default Thermostat to 'MyThermostat' to make sure I wasn't getting some other module that is named 'Thermostat' but that didn;t help.

October 21, 2016, 09:46:23 AM
Reply #3

perruca

  • *
  • Information
  • Newbie
  • Posts: 5
Hi!

I'm trying adding a few lines of code in the Thermostat Basic program, giving the temperature as a parameter instead of "Heat".

Code: [Select]
if (option == "19" || option == "20" || option == "21" || option == "22")
        {
        Program.RaiseEvent(thermostat, "Thermostat.SetPoint.Heating", option, EVENT_DESCRIPTION);
      holdingMode[index] = false;
      ThermostatLogicRun(thermostat);
      res = "OK";
         }

The call from scheduller:

Code: [Select]
// Heat, HeatEconomy, Cool, CoolEconomy, Auto, Off
mode = '19';
// set the mode of all selected thermostat modules to 'Heat'
$$.boundModules.command('Thermostat.ModeSet')
  .set(mode);

It seems to work fine.

Regards.

Nacho.-