Das ist ein Hilfsmodul, um existierende Readings umformatieren zu koennen. Der Commandref Eintrag:
Define
- define <name> readingsChange <device> <readingName> <toReplace> <replaceWith>"
Change the content of a reading if it changes, with the perl string substitute mechanism. Note: As some modules rely on the known format of some readings, changing such readings may cause these modules to stop working.
<device>, <readingName> and <toReplace> are regular expressions, and are not allowed to contain whitespace. If replaceWith is enclosed in {}, then the content will be executed as a perl expression for each match.
Examples:
- # shorten the reading power 0.5 W previous: 0 delta_time: 300
# to just power 0.5 W
define pShort readingsChange pm power (.*W).* $1
# format each decimal number in the power reading to 2 decimal places
define p2dec readingsChange pm power (\d+\.\d+) {sprintf("%02.f", $1)}
SetGetAttributes
- disable
- disabledForIntervals
Entweder funktioniert es nicht wie gedacht oder ich komme damit nicht klar!
Habe fast 1:1 übernommen aber das Reading bleibt das Gleiche.
Internals:
CFGFN
DEF ku_SD6 power (.*W).* $1
NAME pShort
NOTIFYDEV ku_SD6
NR 1134
NTFY_ORDER 00-pShort
STATE active
TYPE readingsChange
Readings:
2017-01-10 19:53:17 state active
Readings:
2016-10-29 19:40:08 SEND_DATA failed:00
2016-10-29 19:40:05 assocGroup_1 Max 5 Nodes ZWaveBridge
2016-10-29 19:40:07 assocGroup_2 Max 5 Nodes
2016-10-29 19:40:08 assocGroup_3 Max 5 Nodes
2016-10-29 19:40:05 assocGroups 3
2016-10-29 19:39:57 configButtonOnOff Enable
2016-10-29 19:39:58 configConfigureMaximumOverLoadCurrent 150
2016-10-29 19:39:58 configConfigurePlugTimeSwitchFunction Disable
2016-10-29 19:39:59 configLedDisplay Enable
2016-10-29 19:39:59 configMeterReportInterval 300
2016-10-29 19:39:59 configRememberRelayONOFFStatus Enable
2016-10-29 19:40:00 configSendMeterReport Enable
2017-01-10 20:00:21 current 0.1 A previous: 0.09 delta_time: 31 s
2017-01-10 20:00:18 energy 1.36 kWh previous: 1.36 delta_time: 31 s
2016-10-29 19:31:20 model Neo CoolCam Power plug 12A
2016-10-29 19:31:20 modelConfig shenzen_neo/nas-wr01z.xml
2016-10-29 19:31:20 modelId 0258-0003-1087
2017-01-10 20:00:19 power 14.99 W previous: 13.55 delta_time: 31 s
2017-01-01 14:51:50 state on
2017-01-01 14:36:07 timeToAck 3.898
2017-01-01 14:36:07 transmit OK
2017-01-10 20:00:20 voltage 246.35 V previous: 246.36 delta_time: 31 s
Kann bei <device> devspec angegeben werden oder tatsächlich nur der Device Name?
Wollte das für energy, current und voltage auch umsetzen, funktioniert leider auch nicht.
Danke.
Gruß
Dan