Mit dem ASP Script lassen sich sowohl Anzahl (wie auch Details) zu allen gewünschten Computer Systeme in einer Microsoft Active Directory übersichtlich auf einer ASP Classic Seite darstellen.

Das Script muss auf einen entsprechenden IIS hochgeladen werden. Über die Arrays sowie die Queries lassen sich die Felder die angezeigt werden sollen steuern und filtern. In dem Beispiel wird eine Zusammenfassung der Anzahl aller aktiven Systeme in Active Directory nach Build Nummer gezeigt. Basierend auf den entsprechenden OU`s lassen sich weitere Filter realisieren. Die Hyperlinks verweisen auf eine zweite Seite welche dann die Details zum ausgewählten Hyperlink anzeigt. 

<!--
'--###################################################################
'--#Script Name	: ad_query.asp                                                                                              
'--#Description	: ASP Classic script to gather OS Information of computer  
'--#              systems out of Microsoft Active directory            
'--#Args         :
'--#Date         : 03. January 2020
'--#Author       : Heiko Zschenderlein                                                
'--#Email        : Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!
'--#Comments     : Development State, to be improved
'--#Disclaimer   : Please read the Disclaimer at the end of the script 
'--#             : Bitte lesen Sie den Haftungsausschluss am Ende des Scripts
'--###################################################################
-->
<%@ Language=VBScript  %>
<% response.Buffer = True %>
<font face="arial" size="-1">
<html><head>
<title>Domain enabled Device Details based on OS Level and Hostnames</title>

</head>
<body>
<h1>Domain enabled Device Details based on OS Level and Hostnames</h1>
<%

DeviceOU = "LDAP://DC=DOMAIN,DC=EXAMPLE,DC=COM"
base_query = "Select Name, description, operatingSystem, operatingSystemVersion from '"& DeviceOU &"' Where objectClass='computer' AND UserAccountControl=4096  "
response.write(Date)
Set objCon = Server.CreateObject("ADODB.Connection")
objCon.provider ="ADsDSOObject"
objCon.Properties("User ID") = "DOMAIN\USERNAME"
objCon.Properties("Password") = "PassW00rd"
objCon.Properties("Encrypt Password") = TRUE
objCon.open "Active Directory Provider"
Set objCom = CreateObject("ADODB.Command")
Set objCom.ActiveConnection = objCon


Dim arrSites(1,12) ' erstes Paar, ANzahl Sites
Dim arrOS(2,11) ' OS Name & OS Version
'arrSites(col,row)
arrSites(0,0) = "Location" ' location
arrSites(1,0) = " " ' location code
arrSites(0,1) = "Berlin"
arrSites(1,1) = "AND Name = 'DEBER*'"
arrSites(0,2) = "Stuttgard"
arrSites(1,2) = "AND NAME = 'DESTUT*'"
arrSites(0,3) = "Muenchen"
arrSites(1,3) = "AND NAME = 'DEMUEN*'"
arrSites(0,4) = "..."
arrSites(1,4) = "AND NAME = '...*'"
'-->> ... arrSites(1,12)


arrOS(0,0) = "Windows 7"
arrOS(1,0) = "AND  operatingSystemVersion ='*7601*' AND operatingSystem = 'Windows 7*' "
arrOS(2,0) = "10/31/2016"
arrOS(0,1) = "Windows 10 1703"
arrOS(1,1) = "AND  operatingSystemVersion ='*15063*'"
arrOS(2,1) = "10/08/2019"
arrOS(0,2) = "Windows 10 1803"
arrOS(1,2) = "AND  operatingSystemVersion ='*17134*'"
arrOS(2,2) = "11/10/2020"
arrOS(0,3) = "Windows 10 1809"
arrOS(1,3) = "AND  operatingSystemVersion ='*17763*'"
arrOS(2,3) = "05/11/2021"
arrOS(0,4) = "Windows 10 1903"
arrOS(1,4) = "AND  operatingSystemVersion ='*18362*'"
arrOS(2,4) = "12/08/2020"
arrOS(0,5) = "Windows 10 1909"
arrOS(1,5) = "AND  operatingSystemVersion ='*18363*'"
arrOS(2,5) = "05/10/2022"
arrOS(0,6) = "Server 2003"
arrOS(1,6) = "AND operatingSystem = '*Server 2003*' "
arrOS(2,6) = "07/14/2015"
arrOS(0,7) = "Server 2008"
arrOS(1,7) = "AND operatingSystem = '*Server 2008*' "
arrOS(0,8) = "Server 2012"
arrOS(1,8) = "AND operatingSystem = '*Server 2012*' "
arrOS(2,8) = "10/10/2023"
arrOS(0,9) = "Server 2016"
arrOS(1,9) = "AND operatingSystem = '*Server 2016*' "
arrOS(2,9) = "01/12/2027"
arrOS(0,10) = "Server 2019"
arrOS(1,10) = "AND operatingSystem = '*Server 2019*' "
arrOS(2,10) = "01/09/2029"
'arrOS(0,9) = "Virtual Machines"
'arrOS(1,9) = "AND NAME = '*VM*'"

Response.Write("<table cellspacing='2' cellpadding='2' width=100% valign='top' border='2' >" + vbCrLf)

Response.Write("<TR><TD><b>Location</b></TD> ")
For b = 0 to UBound(arrOS, 2)
Response.Write("<TD align='center'><b>" & arrOS(0,b) & "</b></TD>")
Next
Response.Write("</TR>")

For i = 0 to UBound(arrSites, 2)

Response.Write("<TR><TD><b><i>" & arrSites(0,i) & "</i></b></TD>")

For a = 0 to 10
Set objRS = Nothing
objCom.CommandText = base_query & arrOS(1,a) & arrSites(1,i)
Set objRS = objCom.Execute

result_count = objRS.recordCount
if result_count > 0 then

Response.Write("<td align='center'><a href="/"")
Response.Write("ad_details.asp")
Response.Write("?QueryC=" & Server.URLEncode(objCom.CommandText & " ORDER by Name")) 
Response.Write("""<TD align='center'>" & cstr(objRS.recordCount))

else
Response.Write("<TD align='center'>" & cstr(objRS.recordCount)) 
end if


objRS.Close
next

Next
Response.Write("</TR>")
Response.Write("</TABLE>")


objCon.Close
Set objRS = Nothing
Set objCon = Nothing
Set objCom = Nothing
%>
<!--
'--# DISCLAIMER :
'--# Downloading and using data from this website occurs at the own risk of the User. The Provider does not accept any liability for damages that occur directly or indirectly through the use of provided data.
'--# All logos, trademarks and word marks used, even if not expressly marked as such, are the property of their respective owners.
'--# Das Herunterladen und Verwenden von Daten von dieser Website erfolgt auf eigenes Risiko des Benutzers. Der Anbieter übernimmt keine Haftung für Schäden, die direkt oder indirekt durch die Verwendung der bereitgestellten Daten entstehen.
'--# Alle verwendeten Logos, Markenzeichen und Wortmarken sind, auch wenn nicht ausdrücklich als solche gekennzeichnet, Eigentum ihrer jeweiligen Inhaber.
-->

Da wir auch dieses Jahr unsere Script Suite zur Verwaltung und Ansteuerung von Sensoren und Aktoren verschiedener Hersteller erweitern wollen, hier ein kleiner Vorgeschmack auf ein neues Script mit dem sich mehrere Homematik  Temperatur Sensoren in einem Rutsch abfragen und den entsprechenden DomoticZ Geräten zuweisen lassen.

HomeMatic CCU XMLAPI, DomoticZ Scripting engine -> LUA interpreter

Das Script erwartet die Angabe der CCU IP (xmlAPI muss dort installiert sein) und die Zuordnung der localen DomoticZ IDX sowie CCU Temperatur Sensoren IDX in einem Array HMSensors im Format "DOM_IDX","HM_IDX". 

--###################################################################
--#Script Name	: dom_hm_get_temp.lua                                                                                              
--#Description	: get multiple temperatur values from homematic CCU 
--#               and pass them to the right local domotiz devices
--#Args         :                                                                                           
--#Date         : 03. February 2019
--#Author       : Heiko Zschenderlein                                                
--#Email        : Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!
--#Comments     : Development State, to be improved
--#Disclaimer   : Please read the Disclaimer at the end of the script 
--#             : Bitte lesen Sie den Haftungsausschluss am Ende des Scripts
--###################################################################
commandArray = {}
now=os.date("*t")
-- run script every 3 minutes
if now.min % 3 == 0 then

-- function to read xmlAPI output from CCU
function XML_Capture(cmd,flatten)
   local f = assert(io.popen(cmd, 'r'))
   local s = assert(f:read('*a'))
   f:close()
   if flatten  then
      s = string.gsub(s, '^%s+', '')
      s = string.gsub(s, '%s+$', '')
      s = string.gsub(s, '[\n\r]+', ' ')
   end
   return s
end

-- function to update local device values
local function update(idx, value1)
    local cmd = string.format("%d|0|%.2f", idx, value1)
    table.insert (commandArray, { ['UpdateDevice'] = cmd } )
end


debug = false
-- Array to assign local device id`s to the once we need to get the value off the CCU
HMSensors = {[2]=1648,[3]=1499,[4]=1420,[5]=1727}

CCU_IP = "192.168.10.251"
print("...get Data from ".. CCU_IP)

for dom_idx,hm_idx in pairs(HMSensors) do

XML_string=XML_Capture("curl -s 'http://"..CCU_IP.."/addons/xmlapi/state.cgi?datapoint_id="..hm_idx.."'",1)

valid = string.find(XML_string, "<state>")    -- check we are looking in the right place

    if valid == nil then
        print ("Bad XML status read - info NOT updated")
    else


  t = string.find(XML_string,"value=")     -- read position of temperature string
    v = string.find(XML_string,"</state>")      -- read voltage string

 t1 = t+7
t2 = t1+4

 t = string.find(XML_string,"<gauge_temp>")  -- read temperature string
    print(t)
    temp = string.sub(XML_string,t1,t2)
    
    temp1 =tonumber(temp)

    
--    commandstring = 'curl -s "http://192.168.10.180/control?cmd=OLEDCMD,clear" && curl -s "http://192.168.10.180/control?cmd=OLED,1,1,Kueche:%20'..temp1..'%7FC"'
--    os.execute(commandstring) 

update(dom_idx,temp1)

   print("temperature given = "..dom_idx.."'"..temp1.."'")
    end 
 
end

end

return commandArray
--# DISCLAIMER :
--# Downloading and using data from this website occurs at the own risk of the User. The Provider does not accept any liability for damages that occur directly or indirectly through the use of provided data.
--# All logos, trademarks and word marks used, even if not expressly marked as such, are the property of their respective owners.
--# Das Herunterladen und Verwenden von Daten von dieser Website erfolgt auf eigenes Risiko des Benutzers. Der Anbieter übernimmt keine Haftung für Schäden, die direkt oder indirekt durch die Verwendung der bereitgestellten Daten entstehen.
--# Alle verwendeten Logos, Markenzeichen und Wortmarken sind, auch wenn nicht ausdrücklich als solche gekennzeichnet, Eigentum ihrer jeweiligen Inhaber.

Die Ansteuerung von Homematic Gerät mit DomoticZ ist nicht immer trivial. Anbei ein LUA Script zur Ansteuerung von Homematic Jalousien über eine CCU mit installierter XML_API.

Das komplette Setup ist in diesem TecFacts Artikel beschrieben.

--###################################################################
--#Script Name	: homematic_blinds.lua                                                                                              
--#Description	: Script to operate blinds on Homematic CCU 
--#               based on a inverted DomoticZ Blind Slider device 
--#Args         : needs 2 User Variables : CCU_IP and HMBlinds
--#Date         : 03. February 2019
--#Author       : Heiko Zschenderlein                                                
--#Email        : Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!
--#Comments     : Development State, to be improved
--#Disclaimer   : Please read the Disclaimer at the end of the script 
--#             : Bitte lesen Sie den Haftungsausschluss am Ende des Scripts
--###################################################################
commandArray = {}
--Uservariables to String VAriable
CCU_IP = uservariables["CCU_IP"]
UserVar = uservariables["HMBlinds"]

-- Array to store identifier pairs
parameterA = {}
-- create array from user string variable        
        for k, v in string.gmatch(UserVar,"(%w+):(%w+)") do
            parameterA[tonumber(k)] = tonumber(v)
        end             

-- function to read xmlAPI output from CCU
function XML_Capture(cmd,flatten)
   local f = assert(io.popen(cmd, 'r'))
   local s = assert(f:read('*a'))
   f:close()
   if flatten  then
      s = string.gsub(s, '^%s+', '')
      s = string.gsub(s, '%s+$', '')
      s = string.gsub(s, '[\n\r]+', ' ')
   end
   return s
end

-- function to update local device values
local function update(idx, value1)
    local cmd = string.format("%d|2|%d", idx, value1)
    table.insert (commandArray, { ['UpdateDevice'] = cmd } )
end

-- function to round numbers
function round(number, decimals)
    local power = 10^decimals
    return math.floor(number * power) / power
end

-- loop through array, get current status from Homematic CCU and update devices in DomoticZ accordingly
for dom_idx,hm_idx in pairs(parameterA) do
    XML_string=XML_Capture("curl -s 'http://"..CCU_IP.."/addons/xmlapi/state.cgi?datapoint_id="..hm_idx.."'",1)
    valid = string.find(XML_string, "<state>")    -- check we are looking in the right place

    if valid == nil then
        print ("Bad XML status read - info NOT updated")
    else
        level = round(tonumber(string.sub(XML_string,string.find(XML_string,"value=")+7,string.find(XML_string,"value=")+11)) * 100,0)
        update(tonumber(dom_idx),tonumber(level))
    end 
 
end

-- function to control Homematic Devices 
for deviceName,deviceValue in pairs(devicechanged) do

    for dom_idx,hm_idx in pairs(parameterA) do

        if (otherdevices_idx[deviceName] == dom_idx) then
            if deviceValue == "Open" then
                    commandstring = 'curl -s "http://'..CCU_IP..'/addons/xmlapi/statechange.cgi?ise_id='..hm_idx..'&new_value=1"'
                elseif deviceValue == "Closed" then
                   commandstring = 'curl -s "http://'..CCU_IP..'/addons/xmlapi/statechange.cgi?ise_id='..hm_idx..'&new_value=0"'
                else
                    level= otherdevices_svalues[deviceName]/100
                    commandstring = 'curl -s "http://'..CCU_IP..'/addons/xmlapi/statechange.cgi?ise_id='..hm_idx..'&new_value='..level..'"'
            end
--  print(commandstring)
    os.execute(commandstring) 
end 
end
end

return commandArray
--# DISCLAIMER :
--# Downloading and using data from this website occurs at the own risk of the User. The Provider does not accept any liability for damages that occur directly or indirectly through the use of provided data.
--# All logos, trademarks and word marks used, even if not expressly marked as such, are the property of their respective owners.
--# Das Herunterladen und Verwenden von Daten von dieser Website erfolgt auf eigenes Risiko des Benutzers. Der Anbieter übernimmt keine Haftung für Schäden, die direkt oder indirekt durch die Verwendung der bereitgestellten Daten entstehen.
--# Alle verwendeten Logos, Markenzeichen und Wortmarken sind, auch wenn nicht ausdrücklich als solche gekennzeichnet, Eigentum ihrer jeweiligen Inhaber.

Der CCU Helper ist ein kleines Windows Programm welches verschiedene Informationen von einer HM CCU per XML-API lesen und "leserlich" darstellen  kann. Voraussetzung hierfür ist eine XML-API Installation auf der Homematic CCU und die Ausführung der Software auf einem Windows PC im gleichen Netzwerk/IP Segment.

Nach Installation der Software muss die IP der CCU eingegeben werden. Der Aufbau der Anwendungsfenster kann einige Zeit dauern da die Software im Alpha Stadium ist und noch nicht optimiert wurde. 

CCU Helper 

Besonders hilfreich ist die Software wenn man Werte wie den Identifier eines Gerätes in einer CCU sucht.

Für Dowlnoad des Programms bitte eine Mail schreiben

zip: SHA256  22573A99CAF12D51E4746284A9A8B79282D1104057153DBC96F9CEC5FF612BEE

installer : SHA256 3A917964A0FE2E8EB30BDA6C28AD8B53D26CBE56886766633DCDFAE24D8C72CD

 

 

Ein Thema bei DomoticZ und der Steuerung von Komponenten ist immer wieder mit Timern verbunden. Hier ein simples LUA Script welches zu verschiedenen Zeitpunkten die gewünschten Funktionen ausführt. Konkret : Es wird alle 5 Minuten eine LED Leiste für 2 Minuten eingeschaltet.

--###################################################################
--#Script Name	: timer_init.lua                                                                                              
--#Description	: Timer Script to run a command scheduled with runtime  
--#                 various timings are possible            
--#Args         :
--#Date         : 27. January 2019
--#Author       : Heiko Zschenderlein                                                
--#Email        : Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!
--#Comments     : Development State, to be improved
--#Disclaimer   : Please read the Disclaimer at the end of the script 
--#             : Bitte lesen Sie den Haftungsausschluss am Ende des Scripts
--###################################################################
commandArray = {}

-- device to trigger
triggerDevice='Kueche LED'


-- entire trigger function
local function switch_on()
    if (otherdevices[triggerDevice] == 'Off') then
        -- switch on desired device for 2 minutes
        commandArray[triggerDevice]='On FOR 2' 
        print('+++++++++++++++++ toggle '.. triggerDevice ..' for 2 Minutes')
    end

end

-- additional trigger funktion
local function warnTimeExceeded()
    -- print('Execute when 1 Hour Timer as been reached')
end

local m = os.date('%M')

if (m % 5 == 0) then
    -- print('5 Minutes Timer as been reached')
    -- Call function you want to execute after 5 minutes
	print(' 5 minutes interval has been passed, toggle switch ' .. triggerDevice)
	switch_on()
end

if (m % 10 == 0) then
    -- print('10 Minutes Timer as been reached')
    -- Call function you want to execute after 10 minutes
end
if (m % 30 == 0) then
    -- print('10 Minutes Timer as been reached')
    -- Call function you want to execute after 10 minutes
end
if (m % 60 == 0) then
    -- print('1 Hour Timer as been reached')
    -- Call function you want to execute after 1 Hour
	warnTimeExceeded()
end

return commandArray
--# DISCLAIMER :
--# Downloading and using data from this website occurs at the own risk of the User. The Provider does not accept any liability for damages that occur directly or indirectly through the use of provided data.
--# All logos, trademarks and word marks used, even if not expressly marked as such, are the property of their respective owners.
--# Das Herunterladen und Verwenden von Daten von dieser Website erfolgt auf eigenes Risiko des Benutzers. Der Anbieter übernimmt keine Haftung für Schäden, die direkt oder indirekt durch die Verwendung der bereitgestellten Daten entstehen.
--# Alle verwendeten Logos, Markenzeichen und Wortmarken sind, auch wenn nicht ausdrücklich als solche gekennzeichnet, Eigentum ihrer jeweiligen Inhaber.