- Offizieller Beitrag Autor
© 2020 Stefan K. (aka 66er)
Today I can introduce the integration of the temperature addon on Shelly1 with 1-3 DS18B20.
Many thanks to neo-v for the friendly support, the sharing of your pictures and the testing.
Source: neo-v
Requirement:
The coupling requires an existing integration of a Shelly1 according to these instructions. It has been tested on Shelly1, but should also work 1:1 on the Shelly1PM.
Implementation:
First we need 1 system variable for each channel of the addon, which is linked to the corresponding Shelly1.
Now all you need is a script that is inserted in the update program (see coupling instructions Shelly1) as further THEN line:
!Skript V3.1.3 zur Temperaturaktualisierung des Temp-Addon mit Originalfirmware (c)2020 by 66er (alias Stefan K.)
!***********************************************************************
!Mein Dank an alchy aus dem Homematic-Forum. Ich setze zur Auswertung einen von Ihm veröffentlichten Code mit ein, der von mir angepasst wurde.
!Quelle des Originalcode:https://homematic-forum.de/for…&t=43632&p=435194#p435194
!***********************************************************************
!Raumbezeichnung (nur zur Orientierung, ggf anpassen)
!**** SETUP ******** SETUP ******** SETUP ******** SETUP ***
! ACHTUNG: Beim Anpassen der Adressen keine "" löschen!
! Setup der CUxD-GERÄTE
var url = "http://192.168.5.125/status"; ! IP-Adresse des Shelly mit Temp-Addon anpassen
var execta = "CUxD.CUX2801001:1"; ! Adresse und Kanal des CUxD-Exec-Device angeben
!Setup der SYSTEMVARIABLEN
var temp0 = "Shelly-TA_0"; !Name der Systemvariablen anpassen
var temp1 = "Shelly-TA_1"; ! Name der Systemvariablen anpassen
var temp2 = "Shelly-TA_2"; !Name der Systemvariablen anpassen
!Setup der OFFSET-Werte
!*** OFFSET Werte unbedingt im Format x.x (Punkt statt Komma!) eingeben
var offset1 = "0.0"; ! Sensor 1
var offset2 = "0.0"; ! Sensor 2
var offset3 = "0.0"; ! Sensor 3
!Setup Anzahl angeschlossene Sensoren
var anzahls = "3" ; ! erlaubt sind die Zahlen 1 bis 3
!****ENDE SETUP ********ENDE SETUP ********ENDE SETUP ******
!*****Ab hier NICHTS MEHR ÄNDERN *****
!****Abfrage des Temp-Addon****
dom.GetObject(""#execta#".CMD_SETS").State("wget -q -O - '"#url#"'");
dom.GetObject(""#execta#".CMD_QUERY_RET").State(1);
string Antwort = dom.GetObject(""#execta#".CMD_RETS").State();
string t = dom.GetObject(""#execta#".CMD_RETS").State();
dom.GetObject(""#execta#".CMD_SETS").State("0");
!WriteLine(Antwort);
!JSON String nach Vorgaben auslesen
! v0.2 (c) by Alchy und angepasst von 66er
string output = Antwort;
!WriteLine(output);
string part; string code;string slist;integer collect = -1;
foreach (part, output.Split("{")){
collect = part.Find("tC");
if (collect>-1){
code = ((part.StrValueByIndex(",",0)).StrValueByIndex(":",1));
code = code.Substr(0, code.Length()-1);
slist = slist#code#"/";
}}
!WriteLine(slist);
! Ergebnis in Einzelwerte auflösen
var t1 = slist.StrValueByIndex("/", 0);
var t2 = slist.StrValueByIndex("/", 1);
var t3 = slist.StrValueByIndex("/", 2);
!WriteLine(t1);
!WriteLine(t2);
!WriteLine(t3);
!um OFFSET korrigieren
real t1r = t1.ToFloat();
!WriteLine(t1r);
t1 = t1r + offset1;
!WriteLine(t1);
real t2r = t2.ToFloat();
!WriteLine(t2r);
t2 = t2r + offset2;
!WriteLine(t2);
real t3r = t3.ToFloat();
!WriteLine(t3r);
t3 = t3r + offset3;
!WriteLine(t3);
!Werte in Systemvariablen schreiben
dom.GetObject(""#temp0#"").State(t1);
if ((anzahls) == 1) { quit; };
dom.GetObject(""#temp1#"").State(t2);
if ((anzahls) == 2) { quit; };
dom.GetObject(""#temp2#"").State(t3);
!WriteLine("Skript beendet")
!Ende Skript
Alles anzeigen
Have fun with it.
____________________________________________________________
The instructions including the scripts and pictures are subject to copyright. Anyone who infringes the copyright (for example, pictures or texts illegally copied and published on other websites), according to §§ 106 ff UrhG punishable, can also be warned for a fee and must pay damages (§ 97 UrhG).
© 2020 Stefan K. (aka 66er)
All rights reserved