Optional ads:
1.) Current brightness value:
Evaluates the brightness of the Shelly Dimmer, displays it in the CUxD device and of course the value can also be used in programs.
To display the brightness value, 1 system variable is required:
The variables are assigned to the corresponding channel of the Shelly CUxD device. This makes it visible as shown in Figure 1 in # 1.
In the status updating program (see picture in # 2) we add a 2nd THEN line to update the brightness value data.
Attention:
The names of the system variables must not contain any "spaces" !
The script for this:
!Skript zur Helligkeitsaktualisierung Shelly Dimmer mit Originalfirmware (by SparkyMaster V1.0)
!Raumbezeichnung (nur zur Orientierung, ggf anpassen)
!****Abfrage des Shelly Dimmer*****
!In der folgenden Zeile IP des Shelly Dimmer anpassen!
var url = "http://192.168.178.20/light/0?status";
!In den folgenden Zeilen die CUxD-Exec-Kanal anpassen (hier: 2801001:16)
dom.GetObject("CUxD.CUX2801001:16.CMD_SETS").State("wget -q -O - '"#url#"'");
dom.GetObject("CUxD.CUX2801001:16.CMD_QUERY_RET").State(1);
string Antwort = dom.GetObject("CUxD.CUX2801001:16.CMD_RETS").State();
string t = dom.GetObject("CUxD.CUX2801001:16.CMD_RETS").State();
dom.GetObject("CUxD.CUX2801001:16.CMD_SETS").State("0");
!WriteLine(Antwort);
!WriteLine(t);
!****Auswertung des Antwortstrings ****
!Hier NICHTS ändern
string s;
foreach (s,t.Split (",")) {
if (s.LTrim ("{").StartsWith ('"brightness"')) {
string p = (s.StrValueByIndex (":",1).RTrim ("}"));
! WriteLine(p);
}
}
!**** Variable setzen****
!Variablennamen anpassen (hier: Shelly_Dimmer_Vivian_Helligkeit)
dom.GetObject("Shelly_Dimmer_Vivian_Helligkeit").State(p);
!Ende Skript
Alles anzeigen
According to the instructions in the script have to be adapted:
IP of the Shelly Dimmer
CUxD Exec channel
System variable (Shelly_Dimmer_Vivian_Helligkeit)
In the set interval of the timer, the current brightness value is now updated. ![]()
2.) Online Status:
As with all other couplings, the opt. display of the online status is also made using the system variable and CUxD ping device (28).
To display the online status, 1 system variable is required:
The variable is linked again to the corresponding channel of the CUxD device and thus displayed there.
The online status is monitored and controlled by a CUxD ping channel. That, with 1 CUxd Ping device (28) up to 16 Shelly Dimmer can be monitored. Of course, a free channel of an existing CUxD ping can be used.
Adjust IP!
Settings for: SWITCH|CMD_EXEC_TRUE:
Settings for SWITCH|CMD_EXEC_FALSE:
Adapt the name of the system variable in each case! (here: Onlinestatus_ShellyDimmer_Vivian)
In the set interval of the timer, the online status is now updated. ![]()
3.) Current power display:
evaluates the current power of the Shelly Dimmer, displays it in the CUxD device and of course the value can also be used in programs.
For this we need 1 system variable for the current power values:
The variables are assigned to the corresponding channel of the Shelly CUxD device. This makes it visible as shown in Figure 1 in # 1.
In the status updating program (see picture in # 2) we add a 2nd THEN line to update the current power values.
Attention:
The names of the system variables must not contain any "spaces" !
The script for this:
!Skript V1.0.2 Leistungsaktualisierung Shelly Dimmer mit Originalfirmware © 2019 by 66er
!Raumbezeichnung (nur zur Orientierung, ggf anpassen)
!****Abfrage des Shelly Dimmer*****
!In der folgenden Zeile IP des Shelly Dimmer anpassen!
var url = "http://192.168.178.20/status";
!In den folgenden Zeilen die CUxD-Exec-Kanal anpassen (hier: 2801001:16)
dom.GetObject("CUxD.CUX2801001:16.CMD_SETS").State("wget -q -O - '"#url#"'");
dom.GetObject("CUxD.CUX2801001:16.CMD_QUERY_RET").State(1);
string Antwort = dom.GetObject("CUxD.CUX2801001:16.CMD_RETS").State();
string t = dom.GetObject("CUxD.CUX2801001:16.CMD_RETS").State();
dom.GetObject("CUxD.CUX2801001:16.CMD_SETS").State("0");
!WriteLine(Antwort);
!WriteLine(t);
!****Auswertung des Antwortstrings für Leistung ****
!ACHTUNG: Hier NICHTS ändern
string s;
foreach (s,t.Split (",")) {
if (s.LTrim ("{").StartsWith ('"meters"')) {
string power = (s.StrValueByIndex (":",2).RTrim ("}"));
! WriteLine(power);
}
}
!**** Variable setzen****
!Variablennamen anpassen (hier: Shelly_Dimmer_Vivian_Leistung)
dom.GetObject("Shelly_Dimmer_Vivian_Leistung").State(power);
!Ende Skript
Alles anzeigen
According to the instructions in the script have to be adapted:
IP of the Shelly Dimmer
CUxD Exec channel
System variable (Shelly_Dimmer_Vivian_Leistung)
In the set interval of the timer, the current power is now updated. ![]()
And now good luck and fun with the implementation! ![]()
____________________________________________________________
The instructions including the scripts and pictures are subject to copyright. Who violates the copyright (for example, images or texts illegally copied and published on other websites), makes itself gem. §§ 106 ff UrhG punishable, can also be warned with costs and must pay damages (§ 97 UrhG).
© 2019 SparkyMaster