diff --git a/fhem/CHANGED b/fhem/CHANGED
index 7473a5ee5..6b207a13e 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,5 +1,8 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
+ - change: 10_KNX: moved KNX_scan function to KNXIO-module, see Forum #122582
+ - change: 00_KNXIO: update KNX and KNXIO-module at same time!, Forum #127792
+ added new Attr. enableKNXscan, see cmd-ref
- change: 74_AutomowerConnect: Common.pm, automowerconnect.js
improved disabled handling, reworked use only differential data
- feature: OpenWeatherMapAPI: add human-readable text of daily forecast
diff --git a/fhem/FHEM/10_KNX.pm b/fhem/FHEM/10_KNX.pm
index 1493a4947..58f4066d3 100644
--- a/fhem/FHEM/10_KNX.pm
+++ b/fhem/FHEM/10_KNX.pm
@@ -138,6 +138,9 @@
# cmd-ref: correct wiki links, W3C conformance...
# error-msg on invalid set dpt1 cmd (on-till...)
# Attr anwerReading now deprecated - converted to putCmd - autosave will be deactivated during fhem-restart if a answerReading is converted - use save!
+# MH 292306xx move KNX_scan Function to KNXIO-Module - update both KNXIO and KNX-Module !!!
+# update cmd-ref
+#
# todo replace cascading if..elsif with given
# todo-9/2023 final removal of attr answerReading conversion
@@ -455,9 +458,6 @@ sub Initialize {
$hash->{noAutocreatedFilelog} = 1; # autocreate devices create no FileLog
$hash->{AutoCreate} = {'KNX_.*' => { ATTR => 'disable:1'} }; #autocreate devices are disabled by default
- # register KNX_scan cmd (use from cmd-line)
- $cmds{KNX_scan} = { Fn => "KNX_scancmd", Hlp => ' KNX is a standard for building automation / home automation. It is mainly based on a twisted pair wiring, but also other mediums (ip, wireless) are specified. For getting started, please refer to this document: KNX for your home - knx.org web-site. While the TUL-module, KNXTUL-module, or KNXIO-module represent the connection to the KNX network,
- the KNX module represent a individual KNX device. Sophisticated setups can be achieved by combining multiple KNX-groupaddresses:datapoints (GAD's:dpt's) in one KNX device instance. KNX defines a series of Datapoint Type as standard data types used to allow general interpretation of values of devices manufactured by different vendors.
- These datatypes are used to interpret the status of a device, so the readings in FHEM will show the correct value and optional unit. For each received telegram there will be a reading containing the received value and the sender address. KNX is a standard for building automation / home automation. It is mainly based on a twisted pair wiring,
+but also other mediums (ip, wireless) are specified. For getting started, please refer to this document:
+KNX for your home - knx.org web-site. While the TUL-module, KNXTUL-module,
+or KNXIO-module represent the connection to the KNX network,
+ the KNX module represent a individual KNX device. Sophisticated setups can be achieved by combining multiple KNX-groupaddresses:datapoints (GAD's:dpt's)
+ in one KNX device instance. KNX defines a series of Datapoint Type as standard data types used to allow general interpretation of values
+ of devices manufactured by different vendors.
+ These datatypes are used to interpret the status of a device, so the readings in FHEM will show the
+ correct value and optional unit. For each received telegram there will be a reading containing the received value and the sender address. A (german) wiki page is avaliable here: FHEM Wiki A (german) wiki page is avaliable here: FHEM Wiki Important: a KNX device needs at least one valid DPT. Please refer to avaliable DPT.
- Otherwise the system cannot en- or decode messages. The <group> parameter is either a group name notation (0-31/0-7/0-255) or the hex representation of it ([00-1f][0-7][00-ff]) (5 digits).
- All of the defined groups can be used for bus-communication.
- It is not allowed to have the same group-address more then once in one device. You can have multiple devices containing the same group-adresses. The GAD's are per default named with "g<number>". The corresponding reading-names are getG<number> and setG<number>. Important: a KNX device needs at least one valid DPT. Please refer to avaliable DPT.
+ Otherwise the system cannot en- or decode messages. The <group> parameter is either a group name notation (0-31/0-7/0-255) or the hex representation of it
+ ([00-1f][0-7][00-ff]) (5 digits). All of the defined groups can be used for bus-communication.
+ It is not allowed to have the same group-address more then once in one device. You can have multiple devices containing
+ the same group-adresses. The gadNames are default named "g<number>". The corresponding reading-names are getG<number>
+and setG<number>. Specifying an IO-Device in define is now deprecated! Use attribute IODev instead, but only if absolutely required! The first group is used for sending by default. If you want to send to a different group, you have to address it. E.g: Specifying an IO-Device in define is now deprecated! Use attribute IODev instead,
+ but only if absolutely required! The first group is used for sending by default. If you want to send to a different group, you have to address it.
+ E.g: If enabled, the module autocreate is creating a new definition for any unknown group-address. However, the new device will be disabled
- until you added a DPT to the definition and delete the disable attribute. The device name will be KNX_nnmmooo where nn is the line adress, mm the area and ooo the device.
- No FileLog or SVG definition is created for KNX-devices by autocreate. Use for example If enabled, the module autocreate is creating a new definition for any unknown group-address.
+ However, the new device will be disabled until you added a DPT to the definition and delete the
+ disable attribute. The device name will be KNX_nnmmooo where nn is the line adress,
+ mm the area and ooo the device.
+ No FileLog or SVG definition is created for KNX-devices by autocreate. Use for example
+ Set sends the given value to the bus. Set sends the given value to the bus.KNX
-
-This module provides a basic set of operations (on, off, toggle, on-until, on-for-timer) to switch on/off KNX devices and to send values to the bus.
-For every set, there will be a reading containing the sent value.
+
+This module provides a basic set of operations (on, off, toggle, on-until, on-for-timer) to switch on/off KNX
+ devices and to send values to the bus.
+For every set, there will be a reading containing the sent value.
The reading <state> will be updated with the last sent or received value.
-define <name> KNX <group>:<dpt>[:[<gadName>]:[set|get|listenonly]:[nosuffix]] [<group>:<dpt> ..] [IODev]
-Devices defined by autocreate have to be reworked with the suitable dpt and the disable attribute deleted. Otherwise they won't do anything.
-As described above the parameter <DPT> must contain the corresponding DPT - matching the dpt-spec of the KNX-Hardware.
-The optional parameteter <gadName> may contain an alias for the GAD. The following gadNames are not allowed: on, off, on-for-timer,
- on-until, off-for-timer, off-until, toggle, raw, rgb, string, value, set, get, listenonly, nosuffix - because of conflict with cmds & parameters.
+define <name> KNX <group>:<dpt>[:[<gadName>]:[set|get|listenonly]:[nosuffix]] [<group>:<dpt> ..] [IODev]
+Devices defined by autocreate have to be reworked with the suitable dpt and the disable attribute deleted.
+ Otherwise they won't do anything.
+As described above the parameter <dpt> has to contain the corresponding DPT - matching the dpt-spec of the KNX-Hardware.
+The optional parameteter <gadName> may contain an alias for the GAD. The following gadNames are not allowed:
+ on, off, on-for-timer, on-until, off-for-timer, off-until, toggle, raw, rgb, string, value, set, get, listenonly, nosuffix
+ - because of conflict with cmds & parameters.
If you supply <gadName> this name is used instead. The readings are <gadName>-get and <gadName>-set.
The synonyms <getName> and <setName> are used in this documentation.
If you add the option "nosuffix", <getName> and <setName> have the identical name - only <gadName>.
-If you want to restrict the GAD, you can use the options "get", "set", or "listenonly". The usage should be self-explanatory. It is not possible to combine the options.set <name> <gadName> <value>
+If you want to restrict the GAD, you can use the options "get", "set", or "listenonly". The usage should be self-explanatory.
+ It is not possible to combine the options.set <name> <gadName> <value>
Without additional attributes, all incoming and outgoing messages are in addition copied into reading <state>.define <name> FileLog <filename> KNX_.*
- to create a single FileLog-definition for all KNX-devices created by autocreate.
- Another option is to disable autocreate for KNX-devices in production environments (when no changes / additions are expected) by using:
- attr <autocreate> ignoreTypes KNX_.*
-Examples:define <name> FileLog <filename> KNX_.* to create a single FileLog-definition for all KNX-devices
+ created by autocreate.
+ Another option is to disable autocreate for KNX-devices in production environments (when no changes / additions are expected)
+ by using:
+ attr <autocreate> ignoreTypes KNX_.*
-
+Examples:
+ define lamp1 KNX 0/10/11:dpt1
- attr lamp1 webCmd on:off
- attr lamp1 devStateIcon on:li_wht_on:off off:li_wht_off:on
-
- define lamp2 KNX 0/10/12:dpt1:steuern:set 0/10/13:dpt1.001:status:listenonly
-
- define lamp3 KNX 00A0D:dpt1.001
- define lamp1 KNX 0/10/11:dpt1
+ attr lamp1 webCmd on:off
+ attr lamp1 devStateIcon on:li_wht_on:off off:li_wht_off:on
+
+ define lamp2 KNX 0/10/12:dpt1:steuern:set 0/10/13:dpt1.001:status:listenonly
+
+ define lamp3 KNX 00A0D:dpt1.001
+
-set <deviceName> [<gadName>] <on|off|toggle>
- set <deviceName> [<gadName>] <on-for-timer|off-for-timer> <on/off time in seconds>
- set <deviceName> [<gadName>] <on-until|off-until> <timespec>
- set <deviceName> [<gadName>] <value>
If <gadName> is omitted, the first listed GAD of the device is used.
- If the GAD is restricted in the definition with "get" or "listenonly", the set-command will be refused.
+set <deviceName> [<gadName>] <on|off|toggle>
+ set <deviceName> [<gadName>] <on-for-timer|off-for-timer> <duration seconds>
+ set <deviceName> [<gadName>] <on-until|off-until> <timespec>
+ set <deviceName> [<gadName>] <value>
If <gadName> is omitted, the first listed GAD of the device is used.
+ If the GAD is restricted in the definition with "get" or "listenonly", the set-command will be refused.
For dpt1 and dpt1.001 valid values are on, off, toggle and blink. Also the timer-functions can be used.
- A running Timer-function will be canncelled if a new set cmd (on,off,on-for-,....) for this GAD is issued.
- For all other DPT (dpt1.xxx) the min- and max-values can be used for en- and decoding alternatively to on/off.
- All other DPTs: allowed values or range of values are spedicified here: KNX-dpt
- After successful sending the value, it is stored in the readings <setName> and state.
-
-
-Examples:
+ For all other dpt1.<xxx> the min- and max-values can be used for en- and decoding alternatively to on/off.
+ All DPTs: allowed values or range of values are specified here: KNX-dpt
+ After successful sending, the value is stored in readings <setName> and state.
-+Examples: +set lamp2 on # gadName omitted-set lamp2 off # gadName omitted-set lamp2 steuern on-set lamp2 steuern off-set lamp2 steuern on-for-timer 10 # seconds-set lamp2 steuern on-until 13:15:00--set lamp3 g1 off-until 13:15:00-set lamp3 g1 toogle # lamp3 change state-set lamp3 g1 blink 2 4 # lamp3 on for 4 seconds, off for 4 seconds, 2 repeats--set myThermoDev g1 23.44--set myMessageDev g1 Hello World! # dpt16 def-
set lamp2 on # gadName omitted
+ set lamp2 off # gadName omitted
+ set lamp2 steuern on
+ set lamp2 steuern off
+ set lamp2 steuern on-for-timer 10 # seconds
+ set lamp2 steuern on-until 13:15:00
+
+ set lamp3 g1 off-until 13:15:00
+ set lamp3 g1 toogle # lamp3 change state
+ set lamp3 g1 blink 2 4 # lamp3 on for 4 seconds, off for 4 seconds, 2 repeats
+
+ set myThermoDev g1 23.44
+
+ set myMessageDev g1 Hello World! # dpt16 def
+
More complex examples can be found on the (german) Wiki
If you execute "get" for a KNX-Element the status will be requested from the device. The device has to be able to respond to a read -
- this might not be supported by the target device.
-If the GAD is restricted in the definition with "set" or "listenonly", the execution will be refused.
+ this might not be supported by the target KNX-device.
+If the GAD is restricted in the definition with "set" or "listenonly", the execution will be refused.
The answer from the bus-device updates the readings <getName> and state.
-+ Like in stateCmd you can access the device hash ("$hash") in yr. perl-cmd. In addition the variables + "$name", "$gadName" and "$state" are avaliable. On entry, "$state" contains the current value of reading "state". + The return-value will be sent to KNX-bus. The value has to be in the allowed range for the corresponding dpt, + else the send is rejected. The reading "state" will NOT get updated! +attr <device> putCmd {return $state if($gadName eq 'status');}#returns value of reading state on request from bus for gadName "status". -attr <device> putCmd {return ReadingsVal('dummydev','state','error') if(...);}#returns value of device "dummydev" reading "state". -attr <device> putCmd {return (split(/[\s]/xms,TimeNow()))[1] if ($gadName eq 'time');}#returns systemtime-stamp ...
+Examples:
+ attr <device> putCmd {return $state if($gadName eq 'status');} #returns value of reading state on request from bus for gadName "status".
+ attr <device> putCmd {return ReadingsVal('dummydev','state','error') if(...);} #returns value of device "dummydev" reading "state".
+ attr <device> putCmd {return (split(/[\s]/xms,TimeNow()))[1] if ($gadName eq 'time');} #returns systemtime-stamp ...
+
set device <gadName> toggle cmd. attr <device> putCmd {return $state;}
--When using KNX_scan or any 'set or get <KNX-device> ...' in a global:INITIALIZED notify, pls. ensure to have some delay in processing the cmd's by using fhem sleep. -syntax when used as perl-function (eg. in at, notify,...)-KNX_scan() - scan all possible devices-KNX_scan('dev-A') - scan device-A only-KNX_scan('dev-A,dev-B,dev-C') - scan device-A, device-B, device-C-KNX_scan('room=Kueche') - scan all KNX-devices in room Kueche-KNX_scan('EG_.*') - scan all KNX-devices where device-names begin with EG_-syntax when used from FHEM-cmdline-KNX_scan - scan all possible devices-KNX_scan dev-A - scan device-A only-KNX_scan dev-A,dev-B,dev-C - scan device-A, device-B, device-C-KNX_scan room=Kueche - scan all KNX-devices in room Kueche-KNX_scan EG_.* - scan all KNX-devices where device-names begin with EG_-
defmod initialized_nf notify global:INITIALIZED sleep 10 quiet;; set KNX_date now;; set KNX_time now;; defmod initializedKNXIO_nf notify <KNXIO-deviceName>:INITIALIZED set KNX_date now;; set KNX_time now;; KNX_scan;;syntax when used as perl-function (eg. in at, notify,...)
+ KNX_scan() - scan all possible devices
+ KNX_scan('dev-A') - scan device-A only
+ KNX_scan('dev-A,dev-B,dev-C') - scan device-A, device-B, device-C
+ KNX_scan('room=Kueche') - scan all KNX-devices in room Kueche
+ KNX_scan('EG_.*') - scan all KNX-devices where device-names begin with EG_
+syntax when used from FHEM-cmdline
+ KNX_scan - scan all possible devices
+ KNX_scan dev-A - scan device-A only
+ KNX_scan dev-A,dev-B,dev-C - scan device-A, device-B, device-C
+ KNX_scan room=Kueche - scan all KNX-devices in room Kueche
+ KNX_scan EG_.* - scan all KNX-devices where device-names begin with EG_
+
+Do not use KNX_scan or any 'set or get <KNX-device> ...' in a global:INITIALIZED notify, the IO-device will not be
+ ready for communication at that time!
+ defmod initializedKNXIO_nf notify <KNXIO-deviceName>:INITIALIZED set KNX_date now;; set KNX_time now;; KNX_scan;;