From: Mario Höllein Date: Tue, 19 Jun 2018 10:30:11 +0000 (+0200) Subject: neue hm skripte X-Git-Url: https://git.hoellein.online/?a=commitdiff_plain;p=help neue hm skripte --- diff --git a/homematic/dutyCycle.tcl b/homematic/dutyCycle.tcl new file mode 100644 index 0000000..e32ad7d --- /dev/null +++ b/homematic/dutyCycle.tcl @@ -0,0 +1,44 @@ +#!/bin/tclsh +# +# Ermitteln des duty cycle der CCU +# ================================================= +# Michael Thelen aka Black in Juni 2016 +# +# Aufruf mit +# tclsh dutyccu.tcl oder +# Wenn nur eine CCU da ist mit +# tclsh dutyccu.tcl CCU2 +# ================================================= + +load tclrpc.so +load tclrega.so + +#Beide Übergabeparameter aus CMD holen +set item1 [lindex $argv 0] +set item2 [lindex $argv 1] +# item1 enthält den Suchbegriff +# item2 enthält den Namen der Systemvariablen +# Seriennummer ist item2 eingepackt in 2 "*" +set sernr "" +append sernr "*" $item1 "*" + +set r [xmlrpc http://127.0.0.1:2001/ listBidcosInterfaces ] +set dutycycle -1 +set lines [split [string map [list "ADDRESS" "\x00"] $r] "\x00"] + # und nun durch alle teile mal durch + foreach line $lines { + set treffer [string match $sernr $line] + # Seriennummer wurde gefunden + if {$treffer==1} { + regexp "DUTY_CYCLE (.*?) " $line dummy dutycycle + break + #dann aber auch break der schleife + } +} +# Es wurde ein Dutycycle gefunden () +if {$dutycycle != -1} { + set rega_cmd "" + append rega_cmd "dom.GetObject('$item2').State('$dutycycle');" + rega_script $rega_cmd + puts "Success - Duty Cycle: $dutycycle" +} diff --git a/homematic/oled_alarm_anzeige_zonen.hm b/homematic/oled_alarm_anzeige_zonen.hm new file mode 100644 index 0000000..7008754 --- /dev/null +++ b/homematic/oled_alarm_anzeige_zonen.hm @@ -0,0 +1,60 @@ +!Version mit zwei foreach, geht noch nicht, +!erst mal sehen wie man sich die unterschiedlichen zonee +!merken kann, gibt keine arrays oder listen +! +string zeile1 = ""; +string color1 = "0x80"; +string icon1 = ""; + +string zeile2 = ""; +string color2 = "0x80"; +string icon2 = ""; + +string zeile3 = ""; +string color3 = "0x80"; +string icon3 = ""; + +string zeile4 = ""; +string color4 = "0x80"; +string icon4 = ""; + +string zeile5 = ""; +string color5 = "0x80"; +string icon5 = ""; + +string zeile6 = ""; +string color6 = "0x80"; +string icon6 = ""; + +string alarmZones = "Alarm_EGR,Alarm_EGL,Alarm_KEL,Alarm_WKG,Alarm_WDG,Alarm_TKG,Alarm_TEG,Alarm_TDG"; +string counterList=-1; +string zone; +integer counter=0; +string lastzone; +foreach(zone,alarmZones.Split(",")) { + var sec=dom.GetObject(zone); + string i; + foreach(i,sec.EnumUsedIDs()) { + var item=dom.GetObject(i); + if(item.IsTypeOf(OT_CHANNEL)) { + var dev=dom.GetObject(item.Device()); + if((dev.HssType()=="HM-Sec-SCo") || (dev.HssType()=="HM-Sec-SC-2")) { + var state=item.DPByHssDP("STATE"); + if(state.Value()) { + if (lastzone != zone) { + counter=counter+1; + } else { + counter = 1; + } + } + } + } + } + if (counterList == "-1") { + counterList=counter; + } else { + counterList=counterList#","#counter; + } + lastzone = zone; +} +WriteLine(counterList); diff --git a/homematic/oled_fenster_offen_anzeige.hm b/homematic/oled_fenster_offen_anzeige.hm new file mode 100644 index 0000000..0bdfed8 --- /dev/null +++ b/homematic/oled_fenster_offen_anzeige.hm @@ -0,0 +1,147 @@ +!Zeigt aus zwei Gewerken an, ob bzw. wieviele Fenster +!offen sind +!Vorlage für ein +! +! +string zeile1 = ""; +string color1 = "0x80"; +string icon1 = ""; + +string zeile2 = ""; +string color2 = "0x80"; +string icon2 = ""; + +string zeile3 = ""; +string color3 = "0x80"; +string icon3 = ""; + +string zeile4 = ""; +string color4 = "0x80"; +string icon4 = ""; + +string zeile5 = ""; +string color5 = "0x80"; +string icon5 = ""; + +string zeile6 = ""; +string color6 = "0x80"; +string icon6 = ""; + + +!################################################################# +!eigentliche Ermittlung der offenen Fenster in den beiden +!Gewerken + +string gewerk = "WGR_TK"; +integer wgr_open = 0; +var sec=dom.GetObject(gewerk); +string i; +foreach(i,sec.EnumUsedIDs()) { + var item=dom.GetObject(i); + if(item.IsTypeOf(OT_CHANNEL)) { + var dev=dom.GetObject(item.Device()); + if((dev.HssType()=="HM-Sec-SCo") || (dev.HssType()=="HM-Sec-SC-2")) { + var state=item.DPByHssDP("STATE"); + if(state.Value()) { + wgr_open = wgr_open+1; + } + } + } +} +gewerk="WGL_TK"; +integer wgl_open=0; +sec=dom.GetObject(gewerk); +foreach(i,sec.EnumUsedIDs()) { + var item=dom.GetObject(i); + if(item.IsTypeOf(OT_CHANNEL)) { + var dev=dom.GetObject(item.Device()); + if((dev.HssType()=="HM-Sec-SCo") || (dev.HssType()=="HM-Sec-SC-2")) { + var state=item.DPByHssDP("STATE"); + if(state.Value()) { + wgl_open = wgl_open+1; + } + } + } +} +!################################################################# +zeile1 = "Marlies:"; +color1 = "0x80"; + +zeile4 = "Susi:"; +color4 = "0x80"; +if (wgr_open > 0) { + zeile2 = wgr_open#" Fenster"; + color2 = "0x81"; + icon2 = ""; + zeile3 = "offen"; + color3 = "0x81"; + icon3 = ""; +} else { + zeile2 = "Fenster zu"; + color2 = "0x84"; + icon2 = ""; +} + +if (wgl_open > 0) { + zeile5 = wgl_open#" Fenster"; + color5 = "0x81"; + icon5 = ""; + zeile6 = "offen"; + color6 = "0x81"; + icon6 = ""; +} else { + zeile5 = "Fenster zu"; + color5 = "0x84"; + icon5 = ""; +} + +string splitter="|"; +string msgBuffer = zeile1 # splitter # color1 # splitter # icon1 # "\t"; +msgBuffer = msgBuffer # zeile2 # splitter # color2 # splitter # icon2 # "\t"; +msgBuffer = msgBuffer # zeile3 # splitter # color3 # splitter # icon3 # "\t"; +msgBuffer = msgBuffer # zeile4 # splitter # color4 # splitter # icon4 # "\t"; +msgBuffer = msgBuffer # zeile5 # splitter # color5 # splitter # icon5 # "\t"; +msgBuffer = msgBuffer # zeile6 # splitter # color6 # splitter # icon6; + +string substitutions = "A,0x41\tB,0x42\tC,0x43\tD,0x44\tE,0x45\tF,0x46\tG,0x47\tH,0x48\tI,0x49\tJ,0x4A\tK,0x4B\tL,0x4C\tM,0x4D\tN,0x4E\tO,0x4F\tP,0x50\tQ,0x51\tR,0x52\tS,0x53\tT,0x54\tU,0x55\tV,0x56\tW,0x57\tX,0x58\tY,0x59\tZ,0x5A"; +substitutions = substitutions # "\ta,0x61\tb,0x62\tc,0x63\td,0x64\te,0x65\tf,0x66\tg,0x67\th,0x68\ti,0x69\tj,0x6A\tk,0x6B\tl,0x6C\tm,0x6D\tn,0x6E\to,0x6F\tp,0x70\tq,0x71\tr,0x72\ts,0x73\tt,0x74\tu,0x75\tv,0x76\tw,0x77\tx,0x78\ty,0x79\tz,0x7A"; +substitutions = substitutions # "\t0,0x30\t1,0x31\t2,0x32\t3,0x33\t4,0x34\t5,0x35\t6,0x36\t7,0x37\t8,0x38\t9,0x39\t ,0x20\t!,0x21\t\",0x22\t%,0x25\t&,0x26\t=,0x27\t(,0x28\t),0x29\t*,0x2A\t+,0x2B\t,,0x2C\t-,0x2D\t.,0x2E\t/,0x2F"; +substitutions = substitutions # "\tÄ,0x5B\tÖ,0x23\tÜ,0x24\tä,0x7B\tö,0x7C\tü,0x7D\tß,0x5F\t:,0x3A\t;,0x3B\t@,0x40\t>,0x3E"; + +string bufferLine; +string substEntry; +integer i; +string char; +string line; +string icon; + +string command = "0x02"; +foreach(bufferLine, msgBuffer) { + line = bufferLine.StrValueByIndex(splitter, 0); + icon = bufferLine.StrValueByIndex(splitter, 2); + if ((line <> "") || (icon <> "")) { + command = command # ",0x12"; + if ((line.Substr(0,2) == "0x") && (line.Length() == 4)) { + command = command # "," # line; + i = 12; + } + else { + i = 0; + } + while ((i < line.Length()) && (i < 12)) { + char = line.Substr(i, 1); + foreach(substEntry, substitutions){ + if (char == substEntry.Substr(0,1)){command = command # substEntry.Substr(1,5);} + } + i = i + 1; + } + command = command # ",0x11," # bufferLine.StrValueByIndex(splitter, 1); + if (icon <> "") { + command = command # ",0x13," # icon; + } + } + command = command # ",0x0A"; +} +command = command # ",0x03"; + +dom.GetObject("BidCos-RF." # dom.GetObject("$src$").Name().StrValueByIndex(".",1) # ".SUBMIT").State(command); diff --git a/homematic/oled_fenster_offen_anzeige_ueber_mehrere_gewerke.hm b/homematic/oled_fenster_offen_anzeige_ueber_mehrere_gewerke.hm new file mode 100644 index 0000000..183fb86 --- /dev/null +++ b/homematic/oled_fenster_offen_anzeige_ueber_mehrere_gewerke.hm @@ -0,0 +1,61 @@ +!Version mit zwei foreach, geht noch nicht, +!erst mal sehen wie man sich die unterschiedlichen gewerke +!merken kann, gibt keine arrays oder listen +! +string zeile1 = ""; +string color1 = "0x80"; +string icon1 = ""; + +string zeile2 = ""; +string color2 = "0x80"; +string icon2 = ""; + +string zeile3 = ""; +string color3 = "0x80"; +string icon3 = ""; + +string zeile4 = ""; +string color4 = "0x80"; +string icon4 = ""; + +string zeile5 = ""; +string color5 = "0x80"; +string icon5 = ""; + +string zeile6 = ""; +string color6 = "0x80"; +string icon6 = ""; + +string gewerkeListe = "WGR_TK,WGL_TK"; +string counterList=-1; +integer wgr_open = 0; +string gewerk; +integer counter=0; +string lastGewerk; +foreach(gewerk,gewerkeListe.Split(",")) { + var sec=dom.GetObject(gewerk); + string i; + foreach(i,sec.EnumUsedIDs()) { + var item=dom.GetObject(i); + if(item.IsTypeOf(OT_CHANNEL)) { + var dev=dom.GetObject(item.Device()); + if((dev.HssType()=="HM-Sec-SCo") || (dev.HssType()=="HM-Sec-SC-2")) { + var state=item.DPByHssDP("STATE"); + if(state.Value()) { + if (lastGewerk != gewerk) { + counter=counter+1; + } else { + counter = 1; + } + } + } + } + } + if (counterList == "-1") { + counterList=counter; + } else { + counterList=counterList#","#counter; + } + lastGewerk = gewerk; +} +WriteLine(counterList); diff --git a/mirumod.txt b/mirumod.txt new file mode 100644 index 0000000..80d2bb6 --- /dev/null +++ b/mirumod.txt @@ -0,0 +1,4 @@ +###arduino öffnen und sketch hinzufügen rx2atp.c +###anpassen an dx6i +#define S_LAND S_GEAR +#define S_FMOD S_AUX1 diff --git a/openwrt/fix_sta_ap.sh b/openwrt/fix_sta_ap.sh new file mode 100644 index 0000000..f833cc7 --- /dev/null +++ b/openwrt/fix_sta_ap.sh @@ -0,0 +1,43 @@ +#!/bin/sh +# +# https://wiki.openwrt.org/doc/recipes/ap_sta +# +# +# Fix loss of AP when STA (Client) mode fails by reverting to default +# AP only configuration. Default AP configuration is assumed to be in +# /etc/config/wireless.ap-only +# +# +# +# Add fix_sta_ap.sh /etc/rc.local +# +# Example: +# Put your custom commands here that should be executed once +# the system init finished. By default this file does nothing. +# +# /bin/sh /usr/local/bin/fix_sta_ap.sh > /dev/null & +# +# exit 0 +# +# + + +TIMEOUT=30 +SLEEP=3 + +sta_err=0 + +while [ $(iwinfo | grep -c "ESSID: unknown") -ge 1 ]; do + let sta_err=$sta_err+1 + if [ $((sta_err * SLEEP)) -ge $TIMEOUT ]; then + cp /etc/config/wireless.ap-only /etc/config/wireless + wifi up +# uncomment the following lines to try AP+STA after reboot +# sleep 3 +# cp /etc/config/wireless.ap+sta /etc/config/wireless + break + fi + + sleep $SLEEP + +done