Skip to content

Commit 10b148f

Browse files
committed
v1.1-beta.505
- Updated Z-Wave Level Poll program to support SwitchBinary/MultiLevel command classes - Fixed XTenLib CM11 bug - Fixed issue in FibaroRGBW app - Added ":nopopup:" option to disable notification popup on RaiseEvent (":nopopup:" must be specified in the description field) - Fixed "Program.UiRefresh" event, that was working only for program modules - Fixed ZWaveLib SwitchBinary command class (sending 0x20 Basic instead of 0x25 SwitchBinary)
1 parent 42210d5 commit 10b148f

16 files changed

Lines changed: 95 additions & 79 deletions

File tree

203 Bytes
Binary file not shown.

BaseFiles/Common/html/pages/events/_events.js

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ HG.WebApp.Events.SendEventToUi = function (module, eventLog) {
147147
if ($.mobile.activePage.attr("id") == HG.WebApp.WidgetEditor.PageId) {
148148
HG.WebApp.WidgetEditor.RenderView(eventLog);
149149
}
150-
// when event is an automation program event, we update the whole module
151-
if (module.Domain == 'HomeAutomation.HomeGenie.Automation' && eventLog.Property != 'Program.Status') {
150+
// when event is an automation program event or the 'Program.UiRefresh' one, we update the whole module
151+
if ((module.Domain == 'HomeAutomation.HomeGenie.Automation' && eventLog.Property != 'Program.Status') || eventLog.Property == 'Program.UiRefresh') {
152152
HG.Configure.Modules.Get(module.Domain, module.Address, function (data) {
153153
try {
154154
var mod = eval('[' + data + ']')[0];
@@ -159,7 +159,6 @@ HG.WebApp.Events.SendEventToUi = function (module, eventLog) {
159159
});
160160
}
161161
}
162-
//
163162
// show event popup as needed
164163
var logdate = new Date(eventLog.UnixTimestamp);
165164
var date = HG.WebApp.Utility.FormatDateTime(logdate);
@@ -178,8 +177,7 @@ HG.WebApp.Events.SendEventToUi = function (module, eventLog) {
178177
case 'HomeGenie.UpdateChecker':
179178
if (eventLog.Property == 'InstallProgress.Message') {
180179
$('#configure_system_updateinstall_log').prepend('*&nbsp;' + eventLog.Value + '<br/>');
181-
}
182-
else {
180+
} else {
183181
$('#configure_system_updateinstall_log').prepend('*&nbsp;<strong>' + eventLog.Property + '</strong><br/>&nbsp;&nbsp;' + eventLog.Value + '<br/>');
184182
var iconImage = 'images/genie.png';
185183
popupdata = {
@@ -204,29 +202,25 @@ HG.WebApp.Events.SendEventToUi = function (module, eventLog) {
204202
if ($.mobile.activePage.attr("id") == 'page_automation_editprogram') {
205203
HG.WebApp.ProgramEdit.RefreshProgramOptions();
206204
}
207-
}
208-
else if (module != null && HG.WebApp.ProgramEdit._CurrentProgram.Address == module.Address) {
205+
} else if (module != null && HG.WebApp.ProgramEdit._CurrentProgram.Address == module.Address) {
209206
//var cp = HG.WebApp.Utility.GetProgramByAddress(module.Address);
210207
//if (cp != null) cp.ScriptErrors = '';
211208
HG.WebApp.ProgramEdit._CurrentProgram.ScriptErrors = '';
212209
HG.WebApp.ProgramEdit.RefreshProgramEditorTitle();
213210
}
214-
}
215-
else if (eventLog.Property == 'Program.Status') {
211+
} else if (eventLog.Property == 'Program.Status') {
216212
if (module != null && HG.WebApp.ProgramEdit._CurrentProgram.Address == module.Address) {
217213
HG.WebApp.ProgramEdit.RefreshProgramEditorTitle();
218214
}
219-
}
220-
else if (eventLog.Property == 'Program.Notification') {
215+
} else if (eventLog.Property == 'Program.Notification') {
221216
var notification = JSON.parse(eventLog.Value);
222217
popupdata = {
223218
icon: iconImage,
224219
title: '<span style="color:yellow;font-size:9pt;">' + notification.Title + '</span><br>' + notification.Message,
225220
text: '',
226221
timestamp: date
227222
};
228-
}
229-
else if (eventLog.Property != 'Program.UiRefresh') {
223+
} else if (eventLog.Property != 'Program.UiRefresh') {
230224
//var name = module.Domain.substring(module.Domain.indexOf('.') + 1) + ' ' + module.Address;
231225
//if (module.Name != '') name = module.Name;
232226
popupdata = {
@@ -265,8 +259,7 @@ HG.WebApp.Events.SendEventToUi = function (module, eventLog) {
265259
text: module.Address,
266260
timestamp: date
267261
};
268-
}
269-
else if (eventLog.Property.substring(0, 7) == 'Sensor.') {
262+
} else if (eventLog.Property.substring(0, 7) == 'Sensor.') {
270263
var group = HG.WebApp.GroupsList.GetModuleGroup(module);
271264
if (group != null) group = group.Name;
272265
var name = module.Domain.substring(module.Domain.indexOf('.') + 1) + ' ' + module.Address;
@@ -295,8 +288,7 @@ HG.WebApp.Events.SendEventToUi = function (module, eventLog) {
295288
text: parseFloat(eventLog.Value.replace(',', '.')).toFixed(2),
296289
timestamp: date
297290
};
298-
}
299-
else if (eventLog.Property.substring(0, 7) == 'Status.') {
291+
} else if (eventLog.Property.substring(0, 7) == 'Status.') {
300292
var group = HG.WebApp.GroupsList.GetModuleGroup(module);
301293
if (group != null) group = group.Name;
302294
var name = module.Domain.substring(module.Domain.indexOf('.') + 1) + ' ' + module.Address;
@@ -327,8 +319,7 @@ HG.WebApp.Events.SendEventToUi = function (module, eventLog) {
327319
};
328320
HG.WebApp.ProgramEdit._CurrentProgram.Conditions.push(conditionobj);
329321
automationpage_ConditionsRefresh();
330-
}
331-
else if (HG.WebApp.ProgramEdit._IsCapturingCommands && eventLog.Value != '') {
322+
} else if (HG.WebApp.ProgramEdit._IsCapturingCommands && eventLog.Value != '') {
332323
var command = HG.WebApp.Utility.GetCommandFromEvent(module, eventLog);
333324
if (command != null) {
334325
HG.WebApp.ProgramEdit._CurrentProgram.Commands.push(command);
@@ -338,8 +329,8 @@ HG.WebApp.Events.SendEventToUi = function (module, eventLog) {
338329
}
339330
break;
340331
}
341-
//
342-
if (popupdata != null && !HG.WebApp.Events.PopupHasIgnore(eventLog.Domain, eventLog.Source, eventLog.Property)) {
332+
333+
if (popupdata != null && !HG.WebApp.Events.PopupHasIgnore(eventLog.Domain, eventLog.Source, eventLog.Property) && eventLog.Description.indexOf(':nopopup:') < 0) {
343334

344335
HG.WebApp.Events.ShowEventPopup(popupdata, eventLog);
345336

BaseFiles/Common/programs.xml

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Program.GoBackground();</ScriptSource>
135135
</ProgramFeature>
136136
</Features>
137137
<ActivationTime xsi:nil="true" />
138-
<TriggerTime>2015-11-29T17:52:28.92703Z</TriggerTime>
138+
<TriggerTime>2015-12-04T11:41:37.245454Z</TriggerTime>
139139
<Type>CSharp</Type>
140140
<IsEnabled>true</IsEnabled>
141141
</ProgramBlock>
@@ -255,7 +255,7 @@ For instructions see: http://developers.meethue.com/gettingstarted.html .</Descr
255255
<Group>Devices and Things</Group>
256256
<Features />
257257
<ActivationTime xsi:nil="true" />
258-
<TriggerTime>2015-11-29T17:52:28.939759Z</TriggerTime>
258+
<TriggerTime>2015-12-04T11:41:37.261897Z</TriggerTime>
259259
<Type>CSharp</Type>
260260
<IsEnabled>true</IsEnabled>
261261
</ProgramBlock>
@@ -429,7 +429,7 @@ To activate this widget specify a valid user &lt;strong&gt;Key&lt;/strong&gt; th
429429
<Group>Weather and Enviroment</Group>
430430
<Features />
431431
<ActivationTime xsi:nil="true" />
432-
<TriggerTime>2015-11-29T17:52:29.076516Z</TriggerTime>
432+
<TriggerTime>2015-12-04T11:41:37.333313Z</TriggerTime>
433433
<Type>CSharp</Type>
434434
<IsEnabled>true</IsEnabled>
435435
</ProgramBlock>
@@ -501,7 +501,7 @@ while (Program.IsEnabled)
501501
</ProgramFeature>
502502
</Features>
503503
<ActivationTime xsi:nil="true" />
504-
<TriggerTime>2015-11-29T17:52:29.084289Z</TriggerTime>
504+
<TriggerTime>2015-12-04T11:41:37.348316Z</TriggerTime>
505505
<Type>CSharp</Type>
506506
<IsEnabled>true</IsEnabled>
507507
</ProgramBlock>
@@ -589,7 +589,22 @@ Program.Run();
589589
// basic get will returns current device level
590590
Modules.WithFeature("HomeGenie.ZWaveLevelPoll").Each((module) =&gt; {
591591
//Program.Notify("Z-Wave Level Poll", "Polling node " + module.Instance.Address + "&lt;br&gt;" + module.Instance.Name);
592-
module.Command("Basic.Get").Execute();
592+
var nif = "";
593+
// node information frame
594+
if (module.HasParameter("ZWaveNode.NodeInfo"))
595+
nif = (" " + module.Parameter("ZWaveNode.NodeInfo").Value + " ");
596+
if (nif.Contains(" 26 ")) // 0x26 Switch MultiLevel
597+
{
598+
module.Command("SwitchMultilevel.Get").Execute();
599+
}
600+
else if (nif.Contains(" 25 ")) // 0x25 Switch Binary
601+
{
602+
module.Command("SwitchBinary.Get").Execute();
603+
}
604+
else
605+
{
606+
module.Command("Basic.Get").Execute();
607+
}
593608
return false; // do not break, continue iterating...
594609
});
595610
// pause between each poll
@@ -1102,7 +1117,7 @@ Program.GoBackground();</ScriptSource>
11021117
</ProgramFeature>
11031118
</Features>
11041119
<ActivationTime xsi:nil="true" />
1105-
<TriggerTime>2015-11-29T17:52:28.282814Z</TriggerTime>
1120+
<TriggerTime>2015-12-04T11:41:37.430432Z</TriggerTime>
11061121
<Type>CSharp</Type>
11071122
<IsEnabled>true</IsEnabled>
11081123
</ProgramBlock>
@@ -1149,7 +1164,7 @@ Program.GoBackground();</ScriptSource>
11491164
</ProgramFeature>
11501165
</Features>
11511166
<ActivationTime xsi:nil="true" />
1152-
<TriggerTime>2015-11-29T17:52:28.282758Z</TriggerTime>
1167+
<TriggerTime>2015-12-04T11:41:36.538223Z</TriggerTime>
11531168
<Type>CSharp</Type>
11541169
<IsEnabled>true</IsEnabled>
11551170
</ProgramBlock>
@@ -1498,7 +1513,7 @@ while (Program.IsEnabled)
14981513
</ProgramFeature>
14991514
</Features>
15001515
<ActivationTime xsi:nil="true" />
1501-
<TriggerTime>2015-11-29T17:52:28.596772Z</TriggerTime>
1516+
<TriggerTime>2015-12-04T11:41:36.745841Z</TriggerTime>
15021517
<Type>CSharp</Type>
15031518
<IsEnabled>true</IsEnabled>
15041519
</ProgramBlock>
@@ -1611,8 +1626,8 @@ Program.GoBackground();</ScriptSource>
16111626
<Description>Send to sleep after given delay (seconds, 0=disabled)</Description>
16121627
</ProgramFeature>
16131628
</Features>
1614-
<ActivationTime>2015-11-29T17:53:35.775156Z</ActivationTime>
1615-
<TriggerTime>2015-11-29T17:53:35.805067Z</TriggerTime>
1629+
<ActivationTime xsi:nil="true" />
1630+
<TriggerTime>2015-12-04T11:41:36.736467Z</TriggerTime>
16161631
<Type>CSharp</Type>
16171632
<IsEnabled>true</IsEnabled>
16181633
</ProgramBlock>
@@ -1667,7 +1682,7 @@ Program.GoBackground();</ScriptSource>
16671682
</ProgramFeature>
16681683
</Features>
16691684
<ActivationTime xsi:nil="true" />
1670-
<TriggerTime>2015-11-29T17:52:28.660089Z</TriggerTime>
1685+
<TriggerTime>2015-12-04T11:41:37.012061Z</TriggerTime>
16711686
<Type>CSharp</Type>
16721687
<IsEnabled>true</IsEnabled>
16731688
</ProgramBlock>
@@ -1776,7 +1791,7 @@ Program.Run();
17761791
<Group>Messaging and Social</Group>
17771792
<Features />
17781793
<ActivationTime xsi:nil="true" />
1779-
<TriggerTime>2015-11-29T17:52:28.946235Z</TriggerTime>
1794+
<TriggerTime>2015-12-04T11:41:37.026948Z</TriggerTime>
17801795
<Type>CSharp</Type>
17811796
<IsEnabled>true</IsEnabled>
17821797
</ProgramBlock>
@@ -2114,7 +2129,7 @@ Currently limited to one client channel.</Description>
21142129
</ProgramFeature>
21152130
</Features>
21162131
<ActivationTime xsi:nil="true" />
2117-
<TriggerTime>2015-11-29T17:52:29.167596Z</TriggerTime>
2132+
<TriggerTime>2015-12-04T11:41:37.173839Z</TriggerTime>
21182133
<Type>CSharp</Type>
21192134
<IsEnabled>true</IsEnabled>
21202135
</ProgramBlock>
@@ -2212,7 +2227,7 @@ energy consumption.</Description>
22122227
<Group>Energy Management</Group>
22132228
<Features />
22142229
<ActivationTime xsi:nil="true" />
2215-
<TriggerTime>2015-11-29T17:52:29.404342Z</TriggerTime>
2230+
<TriggerTime>2015-12-04T11:41:37.466047Z</TriggerTime>
22162231
<Type>CSharp</Type>
22172232
<IsEnabled>true</IsEnabled>
22182233
</ProgramBlock>
@@ -2361,7 +2376,7 @@ It requires that a manufacturer specific get has been issued on the node.</Descr
23612376
<Group>Z-Wave</Group>
23622377
<Features />
23632378
<ActivationTime xsi:nil="true" />
2364-
<TriggerTime>2015-11-29T17:52:29.400148Z</TriggerTime>
2379+
<TriggerTime>2015-12-04T11:41:37.671966Z</TriggerTime>
23652380
<Type>CSharp</Type>
23662381
<IsEnabled>true</IsEnabled>
23672382
</ProgramBlock>
@@ -2608,7 +2623,7 @@ while (Program.IsEnabled)
26082623
</ProgramFeature>
26092624
</Features>
26102625
<ActivationTime xsi:nil="true" />
2611-
<TriggerTime>2015-11-29T17:52:29.599789Z</TriggerTime>
2626+
<TriggerTime>2015-12-04T11:41:37.676424Z</TriggerTime>
26122627
<Type>CSharp</Type>
26132628
<IsEnabled>true</IsEnabled>
26142629
</ProgramBlock>
@@ -2692,25 +2707,26 @@ Program.Run();</ScriptCondition>
26922707
Func&lt;string, string, bool&gt; bridgeapicall = (string lightnumber, string parameter) =&gt;
26932708
{
26942709
var moduleRaise = Modules.InDomain("HomeAutomation.FibaroRGBW").WithAddress(lightnumber).Get();
2710+
var parentModule = Modules.InDomain("HomeAutomation.ZWave").WithAddress(lightnumber).Get();
26952711
string[] values = parameter.Split(',');
26962712

26972713
double level = (double.Parse(values[0].Replace(",", "."), CultureInfo.InvariantCulture)/255D)*99D ;
26982714
int iRed = (int)Math.Truncate(level) ;
2699-
var moduleRed = Modules.InDomain("HomeAutomation.ZWave").WithAddress(lightnumber+".2").Get();
2700-
moduleRed.Command("Control.Level").Set( ((int)iRed).ToString() ) ;
2715+
parentModule.Command("MultiInstance.Set").Set("Switch.MultiLevel/2/" + ((int)iRed).ToString());
2716+
27012717
level = (double.Parse(values[1].Replace(",", "."), CultureInfo.InvariantCulture)/255D)*99D ;
27022718
int iGreen = (int)Math.Truncate(level) ;
2703-
var moduleGreen = Modules.InDomain("HomeAutomation.ZWave").WithAddress(lightnumber+".3").Get();
2704-
moduleGreen.Command("Control.Level").Set( ((int)iGreen).ToString() ) ;
2719+
parentModule.Command("MultiInstance.Set").Set("Switch.MultiLevel/3/" + ((int)iGreen).ToString());
2720+
27052721
level = (double.Parse(values[2].Replace(",", "."), CultureInfo.InvariantCulture)/255D)*99D ;
27062722
int iBlue = (int)Math.Truncate(level) ;
2707-
var moduleBlue = Modules.InDomain("HomeAutomation.ZWave").WithAddress(lightnumber+".4").Get();
2708-
moduleBlue.Command("Control.Level").Set( ((int)iBlue).ToString() ) ;
2723+
parentModule.Command("MultiInstance.Set").Set("Switch.MultiLevel/4/" + ((int)iBlue).ToString());
27092724

27102725
Program.RaiseEvent(moduleRaise, "Status.ColorRgb", parameter, "Fibaro RGBW");
27112726

2712-
double average = (iRed + iGreen + iBlue) / 3;
2713-
Program.RaiseEvent(moduleRaise, "Status.Level", (average / 100).ToString(), "Fibaro RGBW");
2727+
// double average = (iRed + iGreen + iBlue) / 3;
2728+
// Program.RaiseEvent(moduleRaise, "Status.Level", (average / 100).ToString(), "Fibaro RGBW");
2729+
Program.RaiseEvent(moduleRaise, "Status.Level", "1", "Fibaro RGBW");
27142730

27152731
return true;
27162732
};
@@ -2792,16 +2808,17 @@ When.WebServiceCallReceived("HomeAutomation.FibaroRGBW", ( args ) =&gt; {
27922808
//
27932809
switch(command)
27942810
{
2795-
// eg. http://&lt;hg_address&gt;/api/HomeAutomation.fibarorgbw/&lt;light_number&gt;/Control.On
2811+
// API : http://&lt;hg_address&gt;/api/HomeAutomation.fibarorgbw/&lt;light_number&gt;/Control.On
27962812
case "Control.On":
27972813
module.On();
27982814
Program.RaiseEvent(moduleRaise, "Status.Level", "1", "Fibaro RGBW");
27992815
break;
2800-
// eg. http://&lt;hg_address&gt;/api/HomeAutomation.fibarorgbw/&lt;light_number&gt;/Control.Off
2816+
// API : http://&lt;hg_address&gt;/api/HomeAutomation.fibarorgbw/&lt;light_number&gt;/Control.Off
28012817
case "Control.Off":
28022818
module.Off();
28032819
Program.RaiseEvent(moduleRaise, "Status.Level", "0", "Fibaro RGBW");
28042820
break;
2821+
// API : http://&lt;hg_address&gt;/api/HomeAutomation.fibarorgbw/&lt;light_number&gt;/Control.Off
28052822
case "Control.Toggle":
28062823
if (module.Parameter("Status.Level").DecimalValue == 0)
28072824
{
@@ -2814,10 +2831,12 @@ When.WebServiceCallReceived("HomeAutomation.FibaroRGBW", ( args ) =&gt; {
28142831
Program.RaiseEvent(moduleRaise, "Status.Level", "0", "Fibaro RGBW");
28152832
}
28162833
break;
2834+
// API : http://&lt;hg_address&gt;/api/HomeAutomation.fibarorgbw/&lt;light_number&gt;/Control.Level/&lt;level&gt; 0.00 to 1.00
28172835
case "Control.Level":
28182836
module.Command("Control.Level").Set((double.Parse(parameter.Replace(",", "."), CultureInfo.InvariantCulture)).ToString()) ;
28192837
Program.RaiseEvent(moduleRaise, "Status.Level", (double.Parse(parameter.Replace(",", "."), CultureInfo.InvariantCulture) / 100D).ToString(), "Fibaro RGBW");
28202838
break;
2839+
// API : http://&lt;hg_address&gt;/api/HomeAutomation.fibarorgbw/&lt;light_number&gt;/Control.ColorHsb/&lt;hue&gt;,&lt;sat&gt;,&lt;bri&gt;
28212840
case "Control.ColorHsb":
28222841
Program.RaiseEvent(moduleRaise, "Status.ColorHsb", parameter, "Fibaro RGBW");
28232842
string[] hsbValues = parameter.Split(',');
@@ -2829,14 +2848,14 @@ When.WebServiceCallReceived("HomeAutomation.FibaroRGBW", ( args ) =&gt; {
28292848
// then you have rgbColor.Red, rgbColor.Green and rgbColor.Blue properties.
28302849
bridgeapicall(lightnumber, String.Format("{0},{1},{2}", rgbColor.Red, rgbColor.Green, rgbColor.Blue));
28312850
break;
2832-
// eg. http://&lt;hg_address&gt;/api/HomeAutomation.fibarorgbw/&lt;light_number&gt;/Control.ColorHsb/&lt;hue&gt;,&lt;sat&gt;,&lt;bri&gt;
2851+
// API : http://&lt;hg_address&gt;/api/HomeAutomation.fibarorgbw/&lt;light_number&gt;/Control.ColorRgb/&lt;red&gt;,&lt;green&gt;,&lt;blue&gt;
28332852
case "Control.ColorRgb":
28342853
bridgeapicall(lightnumber, parameter);
28352854
break;
2855+
// API : http://&lt;hg_address&gt;/api/HomeAutomation.fibarorgbw/&lt;light_number&gt;/Control.ProgramRGB/&lt;nprog&gt; 6 to 10
28362856
case "Control.ProgramRGB" :
28372857
module.Command("Config.ParameterSet").Set("72/" + parameter);
28382858
Program.RaiseEvent(moduleRaise, "Status.Level", "1", "Fibaro RGBW");
2839-
// Program.Notify("Program RGB", "N� " + parameter + " running" );
28402859
break;
28412860
}
28422861
//
@@ -6852,7 +6871,7 @@ while (Program.IsEnabled)
68526871
</ProgramFeature>
68536872
</Features>
68546873
<ActivationTime xsi:nil="true" />
6855-
<TriggerTime>2015-11-29T17:52:29.811091Z</TriggerTime>
6874+
<TriggerTime>2015-12-04T11:41:37.892342Z</TriggerTime>
68566875
<Type>CSharp</Type>
68576876
<IsEnabled>true</IsEnabled>
68586877
</ProgramBlock>
@@ -7565,7 +7584,7 @@ Also it lets you dim last addressed module using Up/Down button which can be def
75657584
</ProgramFeature>
75667585
</Features>
75677586
<ActivationTime xsi:nil="true" />
7568-
<TriggerTime>2015-11-29T17:52:29.792623Z</TriggerTime>
7587+
<TriggerTime>2015-12-04T11:41:38.064393Z</TriggerTime>
75697588
<Type>CSharp</Type>
75707589
<IsEnabled>true</IsEnabled>
75717590
</ProgramBlock>

BaseFiles/Common/programs/39.dll

0 Bytes
Binary file not shown.

BaseFiles/Common/programs/502.dll

0 Bytes
Binary file not shown.
1.5 KB
Binary file not shown.
418 Bytes
Binary file not shown.

Externals/g-labs/XTenLib.dll

0 Bytes
Binary file not shown.

Externals/g-labs/XTenLib.dll.mdb

-2 Bytes
Binary file not shown.

Externals/g-labs/ZWaveLib.dll

512 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)