From 2798fd7f07cf492027b6af5e8a150b395f48e670 Mon Sep 17 00:00:00 2001 From: martinp876 <> Date: Sun, 10 Oct 2021 07:51:26 +0000 Subject: [PATCH] HMinfo: update init-procedure and commandref git-svn-id: https://svn.fhem.de/fhem/trunk@25060 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_HMinfo.pm | 360 +++++++++++++++++++++++------------------ 1 file changed, 199 insertions(+), 161 deletions(-) diff --git a/fhem/FHEM/98_HMinfo.pm b/fhem/FHEM/98_HMinfo.pm index 5b86b92a7..16a4cd6ad 100644 --- a/fhem/FHEM/98_HMinfo.pm +++ b/fhem/FHEM/98_HMinfo.pm @@ -15,6 +15,7 @@ sub HMinfo_SetFn($@); sub HMinfo_SetFnDly($); sub HMinfo_noDup(@); sub HMinfo_register ($); +sub HMinfo_init($); use Blocking; use HMConfig; @@ -69,7 +70,7 @@ sub HMinfo_Initialize($$) {#################################################### .$readingFnAttributes; $hash->{NOTIFYDEV} = "global"; $modules{HMinfo}{helper}{initDone} = 0; - HMinfo_init(); + $hash->{NotifyOrderPrefix} = "49-"; #Beta-User: make sure, HMinfo is up and running after CUL_HM but prior to user code e.g. in notify } sub HMinfo_Define($$){######################################################### my ($hash, $def) = @_; @@ -99,11 +100,13 @@ sub HMinfo_Define($$){######################################################### $hash->{nb}{cnt} = 0; $modules{HMinfo}{helper}{initDone} = 0; notifyRegexpChanged($hash,"global",0); - HMinfo_init(); + LoadModule('CUL_HM'); #Beta-User: Make sure, code from CUL_HM is available when attributes are set return; } sub HMinfo_Undef($$){########################################################## my ($hash, $name) = @_; + RemoveInternalTimer("sUpdt:".$name); + RemoveInternalTimer($name,"HMinfo_getCfgDefere"); return undef; } sub HMinfo_Attr(@) {########################################################### @@ -254,16 +257,18 @@ sub HMinfo_Notify(@){########################################################## if (grep /(SAVE|SHUTDOWN)/,@{$events}){# also save configuration HMinfo_archConfig($hash,$name,"","") if(AttrVal($name,"autoArchive",undef)); } - if (grep /INITIALIZED/,@{$events}){ + if (grep /(INITIALIZED|REREADCFG)/,@{$events}){ $modules{HMinfo}{helper}{initDone} = 0; - HMinfo_init(); + HMinfo_init($hash); } return undef; } -sub HMinfo_init(){############################################################# - RemoveInternalTimer("HMinfo_init");# just to be secure... +sub HMinfo_init($){############################################################# + my ($hash, $dev) = @_; + RemoveInternalTimer("HMinfo_init");# just to be sure... if ($init_done){ - if (!$modules{HMinfo}{helper}{initDone}){ # && !$modules{HMinfo}{helper}{initDone}){ + Log3($hash,5,"debug: HMinfo_init"); + if (!$modules{HMinfo}{helper}{initDone}){ my ($hm) = devspec2array("TYPE=HMinfo"); if (substr(AttrVal($hm, "autoLoadArchive", 0),0,1) ne 0){ HMinfo_SetFn($defs{$hm},$hm,"loadConfig"); @@ -3401,12 +3406,12 @@ sub HMinfo_noDup(@) {#return list with no duplicates########################### =pod =item command =item summary support and control instance for wireless homematic devices and IOs -=item summary_DE Unterstützung und Ueberwachung von Homematic funk devices und IOs +=item summary_DE Unterstützung und Überwachung von Homematic Funk devices und IOs =begin html - +

HMinfo


@@ -3436,7 +3441,7 @@ sub HMinfo_noDup(@) {#return list with no duplicates########################### Commands are executed on all HM entities. If applicable and evident execution is restricted to related entities. e.g. rssi is executed on devices only since channels do not support rssi values.

- Filter + Filter
- Define +

Define


- Get +

Get

-
  • showTimer
    +
  • showTimer
    show all timer currently running at this point in time.
  • - Set +

    Set

    + tempListG (for all devices)

    -
  • cpRegs <src:peer> <dst:peer>
    +
  • cpRegs <src:peer> <dst:peer>
    allows to copy register, setting and behavior of a channel to another or for peers from the same or different channels. Copy therefore is allowed intra/inter device and intra/inter channel.
    @@ -3681,7 +3689,7 @@ sub HMinfo_noDup(@) {#return list with no duplicates########################### cpRegs expets that all readings are up-to-date. It is up to the user to ensure data consistency.
  • -
  • templateDef <name> <param> <desc> <reg1:val1> [<reg2:val2>] ...
    +
  • templateDef <name> <param> <desc> <reg1:val1> [<reg2:val2>] ...
    define a template.
    param gives the names of parameter necesary to execute the template. It is template dependant and may be onTime or brightnesslevel. A list of parameter needs to be separated with colon
    @@ -3701,7 +3709,7 @@ sub HMinfo_noDup(@) {#return list with no duplicates########################### set hm templateDef SwOnCond fromMaster myChannel peerChannel:long #
  • -
  • templateSet <entity> <template> <peer:[long|short]> [<param1> ...]
    +
  • templateSet <entity> <template> <peer:[long|short]> [<param1> ...]
    sets a bunch of register accroding to a given template. Parameter may be added depending on the template setup.
    templateSet will collect and accumulate all changes. Finally the results are written streamlined.
    @@ -3723,15 +3731,15 @@ sub HMinfo_noDup(@) {#return list with no duplicates###########################
  • -
  • templateDel <entity> <template> <peer:[long|short]> ]
    +
  • templateDel <entity> <template> <peer:[long|short]> ]
    remove a template installed by templateSet
  • -
  • templateExe <template>
    +
  • templateExe <template>
    executes the register write once again if necessary (e.g. a device had a reset)
  • -
  • x-deviceReplace <oldDevice> <newDevice>
    +
  • x-deviceReplace <oldDevice> <newDevice>
    replacement of an old or broken device with a replacement. The replacement needs to be compatible - FHEM will check this partly. It is up to the user to use it carefully.
    The command needs to be executed twice for safety reasons. The first call will return with CAUTION remark. Once issued a second time the old device will be renamed, the new one will be named as the old one. Then all peerings, register and templates are corrected as best as posible.
    NOTE: once the command is executed devices will be reconfigured. This cannot be reverted automatically.
    @@ -3742,9 +3750,10 @@ sub HMinfo_noDup(@) {#return list with no duplicates###########################


    - Attributes +

    Attributes

  • -
  • autoUpdate + +
  • autoUpdate
    retriggers the command update periodically.
    Example:
    will trigger the update every 10 min
  • -
  • autoArchive + +
  • autoArchive
    if set fhem will update the configFile each time the new data is available. - The update will happen with autoUpdate. It will not + The update will happen with autoUpdate. It will not work it autoUpdate is not used.
    - see also archConfig + see also archConfig
  • -
  • hmAutoReadScan + +
  • hmAutoReadScan
    defines the time in seconds CUL_HM tries to schedule the next autoRead from the queue. Despite this timer FHEM will take care that only one device from the queue will be handled at one point in time. With this timer user can stretch timing even further - to up to 300sec @@ -3800,52 +3813,60 @@ sub HMinfo_noDup(@) {#return list with no duplicates########################### Setting to 1 still obeys the "only one at a time" prinzip.
    Note that compressing will increase message load while stretch will extent waiting time.
  • -
  • hmIoMaxDly + +
  • hmIoMaxDly
    max time in seconds CUL_HM stacks messages if the IO device is not ready to send. If the IO device will not reappear in time all command will be deleted and IOErr will be reported.
    Note: commands will be executed after the IO device reappears - which could lead to unexpected activity long after command issue.
    default is 60sec. max value is 3600sec
  • -
  • configDir + +
  • configDir
    default directory where to store and load configuration files from. This path is used as long as the path is not given in a filename of a given command.
    - It is used by commands like tempList or saveConfig
    + It is used by commands like tempList or saveConfig
  • -
  • configFilename + +
  • configFilename
    default filename used by - saveConfig, - purgeConfig, - loadConfig
    - verifyConfig
    + saveConfig, + purgeConfig, + loadConfig
    + verifyConfig
  • -
  • configTempFile<;configTempFile2><;configTempFile3> + +
  • configTempFile<;configTempFile2><;configTempFile3>
    Liste of Templfiles (weekplan) which are considered in HMInfo and CUL_HM
    Files are comma separated. The first file is default. Its name may be skipped when setting a tempalte.
  • -
  • hmManualOper + +
  • hmManualOper
    set to 1 will prevent any automatic operation, update or default settings in CUL_HM.
  • -
  • hmDefaults + +
  • hmDefaults
    set default params for HM devices. Multiple attributes are possible, comma separated.
    example:
    attr hm hmDefaults hmProtocolEvents:0_off,rssiLog:0
  • -
  • verbCULHM + +
  • verbCULHM
    set verbose logging for a special action for any CUL_HM entity.
    allSet: all set commands to be executed.
    allGet: all get requests to be executed.
  • -
  • autoLoadArchive - if set the register config will be loaded after reboot automatically. See loadConfig for details
    + +
  • autoLoadArchive
    + if set the register config will be loaded after reboot automatically. See loadConfig for details

  • - Variables + Variables -
  • templateDel <entity> <template> <peer:[long|short]>
    +
  • templateDel <entity> <template> <peer:[long|short]> ]
    entfernt ein Template das mit templateSet eingetragen wurde
  • -
  • templateExe <template>
    +
  • templateExe <template>
    führt das templateSet erneut aus. Die Register werden nochmals geschrieben, falls sie nicht zum template passen.
  • -
  • x-deviceReplace <oldDevice> <newDevice>
    +
  • x-deviceReplace <oldDevice> <newDevice>
    Ersetzen eines alten oder defekten Device. Das neue Ersatzdevice muss kompatibel zum Alten sein - FHEM prüft das nur rudimentär. Der Anwender sollt es sorgsam prüfen.
    Das Kommando muss aus Sicherheitsgründen 2-fach ausgeführt werden. Der erste Aufruf wird mit einem CAUTION quittiert. Nach Auslösen den Kommandos ein 2. mal werden die Devices umbenannt und umkonfiguriert. Er werden alle peerings, Register und Templates im neuen Device UND allen peers umgestellt.
    ACHTUNG: Nach dem Auslösen kann die Änderung nicht mehr automatisch rückgängig gemacht werden. Manuell ist das natürlich möglich.
    @@ -4212,9 +4236,10 @@ sub HMinfo_noDup(@) {#return list with no duplicates###########################
    - Attribute +

    Attribute

  • -
  • autoUpdate + +
  • autoUpdate
    führt den Befehl periodisch aus.
    Beispiel:
    führt den Befehl alle 10 Minuten aus
  • -
  • autoArchive + +
  • autoArchive
    Sobald neue Daten verfügbar sind, wird das configFile aktualisiert. - Für die Aktualisierung ist autoUpdate zwingend erforderlich.
    - siehe auch archConfig + Für die Aktualisierung ist autoUpdate zwingend erforderlich.
    + siehe auch archConfig
  • -
  • hmAutoReadScan + +
  • hmAutoReadScan
    definiert die Zeit in Sekunden bis zum nächsten autoRead durch CUL_HM. Trotz dieses Zeitwertes stellt FHEM sicher, dass zu einem Zeitpunkt immer nur ein Gerät gelesen wird, auch wenn der Minimalwert von 1 Sekunde eingestellt ist. Mit dem Timer kann der Zeitabstand ausgeweitet werden - bis zu 300 Sekunden zwischen zwei Ausführungen.
    Das Herabsetzen erhöht die Funkbelastung, Heraufsetzen erhöht die Wartzezeit.
  • -
  • hmIoMaxDly + +
  • hmIoMaxDly
    maximale Zeit in Sekunden für die CUL_HM Meldungen puffert, wenn das Gerät nicht sendebereit ist. Ist das Gerät nicht wieder rechtzeitig sendebereit, werden die gepufferten Meldungen verworfen und IOErr ausgelöst.
    Hinweis: Durch die Pufferung kann es vorkommen, dass Aktivität lange nach dem Absetzen des Befehls stattfindet.
    Standard ist 60 Sekunden, maximaler Wert ist 3600 Sekunden.
  • -
  • configDir + +
  • configDir
    Verzeichnis für das Speichern und Lesen der Konfigurationsdateien, sofern in einem Befehl nur ein Dateiname ohne Pfad angegen wurde.
    - Verwendung beispielsweise bei tempList oder saveConfig
    + Verwendung beispielsweise bei tempList oder saveConfig
  • -
  • configFilename + +
  • configFilename
    Standard Dateiname zur Verwendung von - saveConfig, - purgeConfig, - loadConfig
    + saveConfig, + purgeConfig, + loadConfig
    + verifyConfig
  • -
  • configTempFile<;configTempFile2><;configTempFile3> + +
  • configTempFile<;configTempFile2><;configTempFile3> Liste der Templfiles (weekplan) welche in HM berücksichtigt werden
    Die Files werden kommasepariert eingegeben. Das erste File ist der Default. Dessen Name muss beim Template nicht eingegeben werden.
  • -
  • hmManualOper + +
  • hmManualOper
    auf 1 gesetzt, verhindert dieses Attribut jede automatische Aktion oder Aktualisierung seitens CUL_HM.
  • -
  • hmDefaults + +
  • hmDefaults
    setzt default Atribute fuer HM devices. Mehrere Attribute sind moeglich, Komma separiert.
    Beispiel:
    attr hm hmDefaults hmProtocolEvents:0_off,rssiLog:0
  • -
  • verbCULHM - set verbose logging fuer ausgewaehlte aktionen von allen CUL_HM entities.
    + +
  • verbCULHM
    + Setzt das verbose logging für ausgewählte Aktionen von allen CUL_HM entities.
    allSet: alle set Kommandos fertig zur Ausführung.
    allGet: alle get Anfragen fertig zur Ausführung.
  • -
  • autoLoadArchive - das Register Archive sowie Templates werden nach reboot automatischgeladen. - Siehe loadConfig fuer details
    + +
  • autoLoadArchive
    + das Register Archive sowie Templates werden nach reboot automatisch geladen. + Siehe loadConfig für Details.

  • - Variablen + Variablen