Hallo zusammen,
ich arbeite gerade an der ebusd-Integration.
Hierbei passe ich noch die Readings von einzelnen Elementen an.
Die Werte kommen aus dem Modul ebusd - je nachdem, wie ich die Rückgabewerte benenne, erscheinen diese dann in FHEM.
Nun habe ich aber einige umbenannt - und die alten Namen scheinen für immer bei den Readings stehen zu bleiben.
Wie bekomme ich diese dort wieder weg?
Diese Readings erscheinen, die durchgestrichenen sollen nicht mehr erscheinen:
Readings
Brenner Status Brenner Aus 2014-12-27 20:18:05
Brenner Status Brenner Aus 2014-12-27 20:22:41
RL.T 29.50 °C 2014-12-27 20:22:41
Status 16 2014-12-27 20:18:05
VL.T 29.00 °C 2014-12-27 20:22:41
Vorlauf VL.T 29.00 °C, RL.T 29.50 °C, Brenner Aus 2014-12-27 20:22:41
Wert3_unbekannt 16 2014-12-27 20:22:41
Wert4_unbekannt 2 2014-12-27 20:22:41
reading 29.00 30.00 0.00 2014-12-27 20:18:05
state Vorlauf VL.T 29.00 °C, RL.T 29.50 °C, Brenner Aus 2014-12-27 20:22:41
Dieser Code erzeugt meine Readings.
# Vorlauf
get Vorlauf cmd {"read MS StatusHC\n"}
get Vorlauf expect ".*"
get Vorlauf postproc { my ($VLval,$RLval,$POSITION3val,$POSITION4val,$BRENNERval,$zval);\
my $hash = $defs{"%NAME"};\
if( ($_ eq "")||($_ eq "no data stored") ){\
$VLval = "err";\
$RLval = "err";\
$POSITION3val = "err";\
$BRENNERval = "err";\
$POSITION4val = "err";\
}else{\
my @values=split(';',$_);\
if( $values[0] < 15 ){\
$VLval = "err";\
$RLval = "err";\
$POSITION3val = "err";\
$BRENNERval = "err";\
$POSITION4val = "err";\
} else { \
$VLval = sprintf("%5.2f °C",$values[0]);\
$RLval = sprintf("%5.2f °C",$values[1]);\
$POSITION3val = $values[2];\
if( $values[4] == 0 ){\
$BRENNERval = "Brenner Aus";\
}elsif( $values[4] == 1 ){\
$BRENNERval = "Brenner An (Heizbetrieb)";\
}elsif( $values[4] == 2 ){\
$BRENNERval = "Brenner An (Warmwasser)";\
}else{\
$BRENNERval = "unknown";\
}\
$POSITION4val = $values[3];\
$zval = sprintf("VL.T %5.2f °C, RL.T %5.2f °C, %s",\
$values[0],$values[1],$BRENNERval);\
}\
}\
readingsSingleUpdate($hash, "VL.T", $VLval, 1);\
readingsSingleUpdate($hash, "RL.T", $RLval, 1);\
readingsSingleUpdate($hash, "Brenner Status", $BRENNERval, 1); \
readingsSingleUpdate($hash, "Wert3_unbekannt", $POSITION3val, 1);\
readingsSingleUpdate($hash, "Wert4_unbekannt", $POSITION4val, 1);\
$zval; }
Viele Grüße,
Heiko
Die Commandref sagt dazu:
fhem.pl reference
Version: EN DE
Contents
Introduction
Fhem command types
Device specification
Attributes
Fhem commands
apptime attr backup CULflash cmdalias configdb copy createlog define delete deleteattr deletereading displayattr fheminfo get getstate ?,help IF include inform JsonList JsonList2 list modify notice quit reload rename restore rereadcfg save set setdefaultattr setreading setstate shutdown sleep trigger update usb version xmllist
Devices
global
ALL3076 ALL4000T ALL4027 Alarm BS CM11 CO20 CUL CUL_EM CUL_FHTTK CUL_HM CUL_HOERMANN CUL_IR CUL_MAX CUL_RFR CUL_TX CUL_WS ComfoAir EC3000 ECMD ECMDDevice EGPM EGPM2LAN EIB EM EMEM EMGZ EMT7110 EMWZ ENECSYSGW ENECSYSINV ENIGMA2 ESA2000 EnOcean FBAHA FBDECT FHT FHT8V FHZ FRAMEBUFFER FRITZBOX FRM FRM_AD FRM_I2C FRM_IN FRM_LCD FRM_OUT FRM_PWM FRM_RGB FRM_ROTENC FRM_SERVO FRM_STEPPER FReplacer FS20 GDS GEOFANCY GUEST HEATRONIC HMLAN HMS HMinfo HTTPMOD HUEBridge HUEDevice I2C_BMP180 I2C_DS1307 I2C_EEPROM I2C_LCD I2C_MCP23008 I2C_MCP23017 I2C_MCP342x I2C_PCA9532 I2C_PCF8574 I2C_SHT21 I2C_TSL2561 IPCAM IPWE IT Itach_IR Itach_IRDevice Itach_Relay JSONMETER Jabber JeeLink KM271 KOSTALPIKO KS300 LGTV LINDY_HDMI_SWITCH LIRC LUXTRONIK2 LaCrosse Level M232 M232Counter M232Voltage MAX MAXLAN MPD MQTT MQTT_BRIDGE MQTT_DEVICE MSG MSGFile MSGMail MYSENSORS MYSENSORS_DEVICE MilightBridge MilightDevice NUT NetIO230B Netzer NetzerI2C ONKYO_AVR OPENWEATHER OREGON OWAD OWCOUNT OWDevice OWFS OWID OWLCD OWMULTI OWSWITCH OWServer OWTEMP OWTHERM OWX OWX_ASYNC PCA301 PHTV PID20 PIFACE PIONEERAVR PIONEERAVRZONE POKEYS PROPLANTA PushNotifier Pushover RESIDENTS RFXCOM RFXMETER RFXX10REC ROOMMATE RPII2C RPI_GPIO Revolt SCIVT SHC SHCdev SISPM SIS_PMS SMARTMON SML SOMFY SONOS SONOSPLAYER STACKABLE_CC STV SWAP SWAP_0000002200000003 SWAP_0000002200000008 SYSMON TCM TEK603 THZ TRX TRX_ELSE TRX_LIGHT TRX_SECURITY TRX_WEATHER TUL TellStick Text2Speech UNIRoll USBWX USF1000 VCONTROL VIERA VantagePro2 WEBCOUNT WEBIO WEBIO_12DIGITAL WMBUS WS2000 WS300 WS3600 WWO Weather X10 XBMC XmlList YAMAHA_AVR YAMAHA_BD ZWDongle ZWave cloneDummy harmony netatmo panStamp pilight withings xxLG7000
Helper modules
at autocreate average Calendar configDB CustomReadings DOIF Dashboard DbLog dewpoint dummy eventTypes FHEM2FHEM FHEMWEB FB_CALLMONITOR FileLog FLOORPLAN HCS HTTPSRV Heating_Control holiday HourCounter LightScene logProxy mailcheck notify PRESENCE PachLog RSS RandomTimer rain readingsGroup readingsHistory readingsProxy remotecontrol SUNRISE_EL SYSSTAT sequence speedtest statistics structure SVG telnet Twilight THRESHOLD Utils WeekdayTimer watchdog weblink weco WOL
Perl specials
gnuplot file syntax
Introduction
Fhem is mainly used for home automation, but it is suitable for other tasks too, where notification, timers and logging plays an important role.
It supports different hardware devices to interface with certain protocols (e.g. FHZ1000PC to interface FS20 and HMS, CM11 to access X10), and logical devices like FS20 or FHT to digest the messages for a certain device type using this protocol.
Fhem is modular. The different devices are represented through modules which implement certain functions (e.g. define, get, set). Even seemingly integral parts of fhem like triggers (notify) and timers (at) are implemented this way, giving the possibility to replace/extend this functionality.
Fhem is controlled through readable / ascii commands, which are specified in files (e.g. the configuration file), or issued over a TCP/IP connection, either directly in a telnet session, with a fhem.pl in client mode or from one of the web frontends.
When starting the server you have to specify a configuration file:
perl fhem.pl fhem.cfg
A minimal configuration file looks like:
attr global logfile log/fhem.log
attr global modpath .
attr global statefile log/fhem.save
attr global verbose 3
define telnetPort telnet 7072 global
define WEB FHEMWEB 8083 global
Note: the last two lines are optional and assume you wish to use the builtin telnet and WEB interface.
The web interface can be reached at
http://<fhemhost>:8083
TCP/IP communication with fhem can either happen in a "session" (via telnet) or single client command (via fhem.pl). Example:
telnet <fhemhost> 7072
<NL> (This newline switches into "prompt" mode)
<command>...
quit
or
fhem.pl <fhemhost>:7072 "<fhem-command>" "..."
Fhem command types
There are three types of commands: "fhem" commands (described in this document), shell commands (they must be enclosed in double quotes ") and perl expressions (enclosed in curly brackets {}). shell commands or perl expressions are needed for complex at or notify arguments, but can also issued as a "normal" command.
E.g. the following three commands all do the same when issued from a telnet prompt:
set lamp off
"fhem.pl 7072 "set lamp off""
{fhem("set lamp off")}
Shell commands will be executed in the background, perl expressions and fhem commands will be executed in the main "thread". In order to make perl expressions easier to write, some special functions and variables are available. See the section Perl special for a description. To trigger fhem commands from a shell script (this is the "other way round"), use the client form of fhem.pl (described above).
Multiple fhem commands are separated by semicolon (;). In order to use semicolon in perl code or shell programs, they have to be escaped by the double semicolon (;;). See the Notes section of the notify chapter on command parameters and escape rules.
E.g. the following first command switches Lamp1 off at 07:00 and Lamp2 immediately (at the point of definition), the second one switches both lamps off at 07:00.
define lampoff at 07:00 set Lamp1 off; set Lamp2 off
define lampoff at 07:00 set Lamp1 off;; set Lamp2 off
For every further indirection you need to double the semicolons:, e.g. to switch on every day 2 devices at 7:00 for 10 minutes you have to write:
define onAt at 07:00 set Lamp1 on;;set Lamp2 on;; define offAt at +00:10 set Lamp1 off;;;;set Lamp2 off Don't dispair, the previous example can also be written as
define onAt at 07:00 set Lamp1,Lamp2 on-for-timer 600
Commands can be either typed in plain, or read from a file (e.g. the configuration file at startup). The commands are either executed directly, or later if they are arguments to the at and notify fhem commands.
A line ending with \ will be concatenated with the next one, so long lines (e.g. multiple perl commands) can be split in multiple lines. Some web fronteds (e.g. webpgm2) make editing of multiline commands transparent for you (i.e. there is no need for \) .
Device specification (devspec)
The commands attr, deleteattr, displayattr, delete, get, list, set, setreading, setstate, trigger can take a more complex device specification as argument, which will be expanded to a list of devices. A device specification (short devspec) can be:
a single device name. This is the most common case.
a list of devices, separated by comma (,)
a regular expression
a NAME=VALUE pair, where NAME can be an Internal value like TYPE, a Reading-Name or an attribute. VALUE is a regexp. To negate the comparison, use NAME!=VALUE
if the spec is followed by the expression :FILTER=NAME=VALUE, then the values found in the first round are filtered by the second expression.
Examples:
set lamp1 on
set lamp1,lamp2,lamp3 on
set lamp.* on
set room=kitchen off
set room=kitchen:FILTER=STATE=on off
set room=kitchen:FILTER=STATE!=off off
list disabled=
list TYPE=FS20 STATE
Notes:
the spec may not contain space characters.
if there is a device which exactly corresponds to the spec, then no special processing is done.
first the spec is separated by comma, then the regular expression and filter operations are executed.
the returned list can contain the same device more than once, so "set lamp3,lamp3 on" switches lamp3 twice.
for more complex structuring demands see the structure device.
Attributes
All devices have attributes. These can be set by means of the attr command, displayed with the displayattr command, and deleted by the deleteattr command.
There are global attributes that are used by all devices and local attributes that apply to individual device classes only.
Some devices (like FHEMWEB) automatically define new global attributes on the first definition of a device of such type.
You can use the command
attr global userattr <attributelist>
for the global device to declare new global attributes and
attr <devicespec> userattr <attributelist>
for individual devices according to devspec to declare new local attributes. <attributelist> is a space-separated list which contains the names of the additional attributes. See the documentation of the attr command for examples.
Be careful not to overwrite additional global attributes previously defined by yourself or a device. Use the attr global userattr <attributelist> as early in your configuration as possible.
Device specific attributes
Device specific attributes are documented in the corresponding device section.
Global attributes used by all devices
verbose
Set the verbosity level. Possible values:
0 - server start/stop
1 - error messages or unknown packets
2 - major events/alarms.
3 - commands sent out will be logged.
4 - you'll see whats received by the different devices.
5 - debugging.
The value for the global device is a default for other devices without own verbose attribute set.
comment
Add an arbitrary comment.
alias
Used by FHEMWEB to display a device with another name e.g. when using special characters/spaces not accepted by device definition.
room
Filter/group devices. Recognized by web-pgm2 and web-pgm3. A device can appear in more than one room, in this case the rooms have to be specified comma-separated.
Devices in the room hidden will not appear in the web output, or set the FHEMWEB attribute to selectively disable rooms for certain FHEMWEB instances.
group
Group devices. Recognized by web-pgm2 (module FHEMWEB), it makes devices in the same group appear in the same box). This is used to further group devices together. A device can appear in more than one group, in this case the groups have to be specified comma-separated.
If this attribute is not set then the device type is used as the grouping attribute.
showtime
Used in the webfrontend pgm2 to show the time of last activity instead of the state in the summary view. Useful e.g. for FS20 PIRI devices.
eventMap
Replace event names and set arguments. The value of this attribute consists of a list of space separated values, each value is a colon separated pair. The first part specifies the "old" value, the second the new/desired value. If the first character is slash(/) or comma(,) then split not by space but by this character, enabling to embed spaces. Examples:
attr store eventMap on:open off:closed
attr store eventMap /on-for-timer 10:open/off:closed/
set store open
readingFnAttributes
The following global attributes are honored by the modules that make use of the standardized readings updating mechanism in fhem.pl. Check the module's attribute list if you want to know if a device supports these attributes.
stateFormat
Modifies the STATE of the device, shown by the list command or in the room overview in FHEMWEB. If not set, its value is taken from the state reading. If set, then every word in the argument is replaced by the value of the reading if such a reading for the current device exists. If the value of this attribute is enclused in {}, then it is evaluated. This attribute is evaluated each time a reading is updated.
event-on-update-reading
If not set, every update of any reading creates an event, which e.g. is handled by notify or FileLog. The attribute takes a comma-separated list of readings. You may use regular expressions in that list. If set, only updates of the listed readings create events.
event-on-change-reading
The attribute takes a comma-separated list of readings. You may use regular expressions in that list. If set, only changes of the listed readings create events. In other words, if a reading listed here is updated with the new value identical to the old value, no event is created. If an optional [:threshold] is given after a reading name events are only generated if the change is >= threshold.
The precedence of event-on-update-reading and event-on-change-reading is as follows:
If both attributes are not set, any update of any reading of the device creates an event.
If any of the attributes is set, no events occur for updates or changes of readings not listed in any of the attributes.
If a reading is listed in event-on-update-reading, an update of the reading creates an event no matter whether the reading is also listed in event-on-change-reading.
event-min-interval
This attribute takes a comma-separated list of reading:minInterval pairs. You may use regular expressions for reading. Events will only be generated, if at least minInterval seconds elapsed since the last reading of the matched type.
userReadings
A comma-separated list of definitions of user-defined readings. Each definition has the form:
<reading>[:<trigger>] [<modifier>] { <perl code> } After a single or bulk readings update, the user-defined readings are set by evaluating the perl code { <perl code> } for all definitions and setting the value of the respective user-defined reading <reading> to the result. If <trigger> is given, then all processing for this specific user reading is only done if one of the just updated "reading: value" combinations matches <trigger>, which is treated as a regexp.
Examples:
attr myEnergyMeter userReadings energy { ReadingsVal("myEnergyMeter","counters.A",0)/1250.0;; }
attr myMultiMeter userReadings energy1:counters.A { ReadingsVal("myMultiMeter","counters.A",0)/1250.0;; }, energy2:counters.B { ReadingsVal("myMultiMeter","counters.B",0)/1250.0;; } <modifier> can take one of these values:
none: the same as it would not have been given at all.
difference: the reading is set to the difference between the current and the previously evaluated value.
differential: the reading is set to the difference between the current and the previously evaluated value divided by the time in seconds between the current and the previous evaluation. Granularity of time is one second. No value is calculated if the time past is below one second. Useful to calculate rates.
integral: reverse function of differential. The result is incremented by the product of the time difference between the last two readings and the avarage of the last two readings.
result += (time - timeold) * (oldval + value) / 2
offset: if the current evaluated value is smaler than the previously evaluated value the reading is incremented by the previous value. the reading can then be used as an offset correct for a counter that is reset for example due to a power loss.
monotonic: if the difference between the current and the previously evaluated value is positive the reading is incremented by this difference. this allows to derive a monotonic growing counter from an original counter even if the original will be rest by a power loss
Example:
attr myPowerMeter userReadings power differential { ReadingsVal("myPowerMeter","counters.A",0)/1250.0;; } Notes:
user readings with modifiers difference and differential store the calculated values internally. The user reading is set earliest at the second evaluation. Beware of stale values when changing definitions!
the name of the defined Readings consists of alphanumeric characters with underscore (_) and the minus (-) sign.
Common attributes
The following local attributes are used by a wider range of devices:
IODev
Set the IO or physical device which should be used for sending signals for this "logical" device. An example for the physical device is an FHZ or a CUL. Note: Upon startup FHEM assigns each logical device (FS20/HMS/KS300/etc) the last physical device which can receive data for this type of device. The attribute IODev needs to be used only if you attached more than one physical device capable of receiving signals for this logical device.
?, help
?
help
Get a list of all commands and short description for each one
attr
attr <devspec> <attrname> [<value>]
Set an attribute for a device defined by define. You can define your own attributes too to use them in other applications. Use "attr <name> ?" to get a list of possible attributes. See the Device specification section for details on <devspec>. After setting the attribute, the global event "ATTR" will be generated.
Examples:
attr global verbose 3
attr lamp room kitchen
attr lamp group lights
attr lamp loglevel 6
attr weatherstation event-on-update-reading wind,temperature,humidity
attr weatherstation event-on-change-reading israining
attr weatherstation event-on-change-reading israining,state
attr heating stateFormat Temp:measured-temp, Valve:actuator
Notes:
See deleteattr to delete attributes.
setdefaultattr
setdefaultattr [<attrname> [<value>]]
Add a default attribute. Each device defined from now on will receive this attribute.
If no attrname is specified, then the default attribute list will be deleted.
Example to set the attribute "room kitchen" and "loglevel 4" to each of the lamps:
setdefaultattr room kitchen
setdefaultattr loglevel 4
define lamp1 FS20 1234 11
define lamp2 FS20 1234 12
define lamp3 FS20 1234 13
setdefaultattr
Notes:
There is no way to delete a single default-attribute from the list
define
define <name> <type> <type-specific>
Define a device. You need devices if you want to manipulate them (e.g. set on/off), and the logfile is also more readable if it contains e.g. "lamp off" instead of "Device 5673, Button 00, Code 00 (off)".
Use "define <name> ?" to get a list of possible types.
After definition, the global event "DEFINED" will be generated, see the notify section for details.
Each device takes different additional arguments at definition, see the corresponding device section for details.
delete
delete <devspec>
Delete something created with the define command. See the Device specification section for details on <devspec>.
After deletion, the global event "DELETED" will be generated, see the notify section for details.
Examples:
delete lamp
deleteattr
deleteattr <devspec> [<attrname>]
Delete either a single attribute (see the attr command) or all attributes for a device (if no <attrname> is defined). See the Device specification section for details on <devspec>.
After deleting the attribute, the global event "DELETEATTR" will be generated.
Examples:
deleteattr lamp follow-on-for-timer
deleteattr lamp
deletereading
deletereading <devspec> <readingname>
Delete the reading <readingname> for a device. <readingname> is a perl regular expression that must match the whole name of the reading. Use with greatest care! FHEM might crash if you delete vital readings of a device. See the Device specification section for details on <devspec>.
Examples:
deletereading mySensor temp1
deletereading mySensor temp\d+
lg, Ici
Hallo,
gibt es bei dem Modul ein "set Gerät clear readings" ? Die "alten" Readings stehen und er Datei fhem.save. Die Datei wird beim Schließen von fhem geschrieben. Wenn Du hier händisch eingreifen willst, musst Du fhem stoppen und dann die Veränderungen vornehmen. Jenachem welche Wert Du hast, kannst Du fhem mal anhalten und die fhem.save umbenennen. Danach fhem mal starten, dann sollten die Readings alle weg sein, und nur die "neuen" Readings werden von selber wieder angelegt, wenn Daten kommen.
Oder wie im Beitrag drüber beschrieben "deletereading".
Gruß Christoph
Vielen Dank für eure megaschnellen Antworten.
deletereading Vorlauf.Hz Brenner reading
war die Lösung.
Heiko