HestiaPi / hestia-touch-openhab

OpenHAB2 files for HestiaPi Touch model
GNU General Public License v3.0
60 stars 17 forks source link

Missing close quote in rule TempUnit changed #56

Closed gulliverrr closed 3 years ago

gulliverrr commented 3 years ago

@rkoshak creating the new image file 1.2, I stumbled upon this one: In rule "TempUnit changed" there is a closing quote missing at the end. Please change this line as I don't how to produce the commit for the new rules

var comfDef = DEFAULTS.get(newState+"_"+comfMode+"_DEF); 

to this:

var comfDef = DEFAULTS.get(newState+"_"+comfMode+"_DEF");

By changing (in EU mode) Humidify to Dehumidify I also get this other error:

2020-07-28 13:22:42.857 [ERROR] [internal.handler.ScriptActionHandler] - Script execution failed: TypeError: items.HumidityRemBoostTime.intValue is not a function in <eval> at line number 10

In rule "Humidity Type Changed"


var OPENHAB_CONF = Java.type('java.lang.System').getenv('OPENHAB_CONF');
load(OPENHAB_CONF + '/automation/lib/hestia/defaults.js');
load(OPENHAB_CONF + '/automation/lib/hestia/utils.js');

var logName = "humitype";

// Updating humiditymode file handle by the Exec binding when
// the Item changed.

if(items["HumidityRemBoostTime"].intValue() > 0){
  logInfo(logName, "Cancelling boost for humidity mode");
  events.sendCommand("HumidityRemBoostTime", 0);
}

logInfo(logName, "Turning off humidity mode");
events.sendCommand("HumidityMode", "OFF");

logInfo(logName, "Restoring setpoint to default");
events.postUpdate("HumiSetpoint", DEFAULTS.get("Humi_DEF"));

and this which I have no clue where it comes from:

2020-07-28 13:30:46.457 [ERROR] [internal.handler.ScriptActionHandler] - Script execution failed: TypeError: events.sendcommand is not a function in <eval> at line number 20

Any hints?

rkoshak commented 3 years ago

I don't want to be the single point of failure on how to update the rule. The steps to update a rule and get it committed is as follows:

  1. Make the changes on the running openHAB instance.
  2. Test the changes.
  3. The changed rules are located in /var/lib/openhab2/jsondb/automation_rules.json. Copy that file to hestia-touch-openhab/var/lib/openhab2/jsondb.
  4. Add, commit and push and it's done.

The humidity rule error is almost certainly because HumidityRemBoostTime is NULL. I'll add a check.

The last error is a typo. It should be events.sendCommand, not events.sendcommand. It doesn't provide which script it occurred in so the way I found it was to open the automation.json file with less and searched for it. Turns out it's in the "SystemType changed".

Alternatives to the steps above include:

gulliverrr commented 3 years ago

Thanks for the fix and the detailed steps on where to find the file to commit back here.