fhem.pl ~/.fhem
attr global logfile /tmp/fhem.log attr global statefile /tmp/fhem.save attr global verbose 3 attr global port 7072 attr global modpath /usr/share/fhem define FHZ FHZ /dev/tts/USB0 define lamp FS20 8765 01For other configuration files see the examples subdirectory.
telnet localhost 7072
<NL>
(This newline switches into "prompt" mode)
<command>...
quit
fhem.pl 7072 "set lamp off"
set lamp1 on
set lamp1,lamp2,lamp3 on
set lamp[1-3] on
set lamp.* on
set lamp1-lamp3 on
set lamp1-lamp3,lamp3 on
set room=kitchen off
list disabled=
list TYPE=FS20
?
help
attr <devspec> <attrname> [<value>]
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
setdefaultattr [<attrname> [<value>]]
setdefaultattr room kitchen
setdefaultattr loglevel 4
define lamp1 FS20 1234 11
define lamp2 FS20 1234 12
define lamp3 FS20 1234 13
setdefaultattr
backup
define <name> <type> <type-specific>
deleteattr <devspec> [<attrname>]
deleteattr lamp follow-on-for-timer
deleteattr lamp
delete <devspec>
delete lamp
get <devspec> <type-specific>
get <device> ?
getstate <devspec>
getstate lamp
state:1
getstate fl
ack:0 actuator:2 day-temp:21.5 desired-temp:22.5 [...] measured-temp:22.9 [...]
include <filename>
inform {on|off|timer|raw} [regexp]
jsonlist [<devspec>|<typespec>|ROOMS]
fhem> jsonlist
{
"ResultSet": "full",
"Results": [
{
"list": "Global",
"devices": [
{
"DEF": "",
"NAME": "global",
"NR": "1",
"STATE": "",
"TYPE": "Global",
"currentlogfile": "/var/log/fhem/fhem-2011-12.log",
"logfile": "/var/log/fhem/fhem-%Y-%m.log",
"ATTR": {
"configfile": "/etc/fhem/fhem.conf",
"logfile": "/var/log/fhem/fhem-%Y-%m.log",
"modpath": "/usr/share/fhem",
"pidfilename": "/var/run/fhem.pid",
"port": "7072 global",
"room": "Server",
"statefile": "/var/cache/fhem/fhem.save",
"verbose": "4",
"version": "=VERS= from =DATE= ($Id: fhem.pl,v $)"
},
"READINGS": []
}
]
},
{
"list": "CM11",
"devices": [
{
"DEF": "/dev/cm11",
"DeviceName": "/dev/cm11",
"FD": "14",
"NAME": "CM11",
"NR": "19",
"PARTIAL": "null",
"STATE": "Initialized",
"TYPE": "CM11",
"ATTR": {
"model": "CM11"
},
"READINGS": []
}
]
},
{
[...placeholder for more entrys...]
},
],
"totalResultsReturned": 235
}
If specifying <devspec>
, then a detailed status for
<devspec>
will be displayed, e.g.:
fhem> jsonlist lamp1
{
"ResultSet": {
"Results": {
"ATTRIBUTES": {
"alias": "Lamp on Sideboard",
"model": "fs20st",
"room": "Livingroom"
},
"BTN": "01",
"CHANGED": "ARRAY",
"CHANGETIME": "ARRAY",
"CODE": {
"1": "0b0b 01",
"2": "0b0b 0f",
"3": "0b0b f0",
"4": "0b0b ff"
},
"DEF": "12341234 1112 lm 1144 fg 4411 gm 4444",
"IODev": "CUN868",
"NAME": "lamp1",
"NR": "155",
"READINGS": {
"state": {
"TIME": "2011-12-01 16:23:01",
"VAL": "on"
}
},
"STATE": "on",
"TYPE": "FS20",
"XMIT": "0b0b"
}
}
}
If specifying <typespec>
, then a list with the status for
the defined <typespec>
devices will be displayed, e.g.:
fhem> jsonlist HMS
{
"ResultSet": "devices#HMS",
"Results": [
{
"name": "KG.ga.WD.01",
"state": "Water Detect: off"
},
{
"name": "KG.hz.GD.01",
"state": "Gas Detect: off"
},
{
"name": "KG.k1.TF.01",
"state": "T: 16.6 H: 51.2 Bat: ok"
},
{
"name": "NN.xx.RM.xx",
"state": "smoke_detect: off"
}
],
"totalResultsReturned": 4
}
If specifying ROOMS
, then a list with the defined rooms
will be displayed, e.g.:
fhem> jsonlist ROOMS
{
"ResultSet": "rooms",
"Results": [
"Bathroom",
"Bedroom",
"Children",
"Diningroom",
"Garden",
"House",
"Livingroom",
"Office",
"hidden"
],
"totalResultsReturned": 15
}
updatefhem [<changed>|<filename>|<housekeeping> [<clean>] [<yes>]|<preserve> [<filename>]]
CULflash <CUL-Name> <CUL-Version>
CULflash CUL CUL_V3
CULflash none CUL_V3
list [devspec] [value]
fhem> list
Type list for detailed info.
Internal:
global (Internal)
FHZ:
FHZ (fhtbuf: 23)
FS20:
Btn4 (on-old-for-timer)
Roll1 (on)
Stehlampe (off)
FHT:
fl (measured-temp: 21.1 (Celsius))
KS300:
out1 (T: 2.9 H: 74 W: 2.2 R: 8.2 IR: no)
at:
at_rollup (Next: 07:00:00)
notify:
ntfy_btn4 (active)
FileLog:
avglog (active)
If specifying name
, then a detailed status for name
will be displayed, e.g.:
fhem> list fl
Internals:
CODE 5102
DEF 5102
NAME fl
NR 15
STATE measured-temp: 21.1 (Celsius)
TYPE FHT
IODev FHZ
Attributes:
room Heizung
Readings:
2006-11-02 09:45:56 actuator 19%
[...]
modify <name> <type-dependent-options>
define lampon at 19:00 set lamp on
modify lampon *19:00
modify lampon 19:00 set lamp on-for-timer 16
quit
quit
reload <module>
reload 99_PRIV
rename <oldname> <newname>
rename FHT_1234 fht.kitchen
rereadcfg
rereadcfg
save [<configfile>]
set <devspec> <type-specific>
set <name> ?
setstate <devspec> <value>
<name>
as shown in paranthesis in the
list command
to <value>
without sending any signals to the device
itself. This command is also used in the statefile.
See the Device specification section for details on
<devspec>.
shutdown [restart]
shutdown
shutdown restart
trigger <devspec> <state>
trigger btn3 on
sleep <sec>
sleep 0.5
define n3 notify btn3.* set lamp toggle;;sleep 0.5;;set lamp toggle
xmllist
fhem> xmllist <FHZINFO> <internal_LIST> <internal name="global" state="internal" sets="" attrs="room configfile logfile ..."> <INT key="DEF" value="<no definition>"/> <INT key="NR" value="0"/> <INT key="STATE" value="internal"/> [...]
"/etc/fhem.cfg /var/log/fhem/fhem.save /usr/share/fhem/contrib
/usr/share/fhem/FHEM /usr/share/fhem/foo /usr/share/fhem/foobar
/usr/share/fhem/www"
archivecmd / archivedir / nrarchive
attributes to the
global
device as you would do for a FileLog device.{ $currlogfile }
.
FHEM
. The path
does not contain the directory FHEM. Upon setting the
attribute, the directory will be scanned for filenames of the form
NN_<NAME>.pm, and make them available for device definition under
<NAME>. If the first device of type <NAME> is defined, the
module will be loaded, and its function with the name
<NAME>_Initialize will be called. Exception to this rule are
modules with NN=99, these are considered to be utility modules
containing only perl helper functions, they are loaded at startup (i.e.
modpath attribute definition time).
<number>
for incoming
connections. To offer at least a little bit of security, the server
will only listen for connections from the localhost per default. If
there is a second value "global" then the server will listen for
non-localhost connections too.
attr global portpassword secret
attr global portpassword {use FritzBoxUtils;;FB_checkPw("localhost","$password") }
define <name> Calendar ical url <URL> [<interval>]
http://
, not https://
, and the file at the given URL
must be in ICal format.https://
replaced by http://
.interval
is the time between subsequent updates
in seconds. It defaults to 3600 (1 hour).define MyCalendar Calendar ical url http://www.google.com/calendar/ical/john.doe%40example.com/private-foo4711/basic.ics define YourCalendar Calendar ical url http://www.google.com/calendar/ical/jane.doe%40example.com/private-bar0815/basic.ics 86400
set <name> update
interval
seconds later.get <name> full|text <reading>|<uid>
get <name> find <regexp>
A calendar event is identified by its UID. The UID is taken from the source calendar. All non-alphanumerical characters are stripped off the UID to make your life easier.
A calendar event can be in one of the following states:
new | The calendar event was first seen at the most recent update. Either this was your first retrieval of the calendar or you newly added the calendar event to the source calendar. |
known | The calendar event was already there before the most recent update. |
updated | The calendar event was already there before the most recent update but it has changed since it was last retrieved. |
deleted | The calendar event was there before the most recent update but is no longer. You removed it from the source calendar. The calendar event will be removed from all lists at the next update. |
A calendar event can be in one of the following modes:
upcoming | Neither the alarm time nor the start time of the calendar event is reached. |
alarm | The alarm time has passed but the start time of the calendar event is not yet reached. |
start | The start time has passed but the end time of the calendar event is not yet reached. |
end | The end time of the calendar event has passed. |
A calendar device has several readings. Each reading is a semicolon-separated list of UIDs of calendar events that satisfy certain conditions:
all | all events |
modeAlarm | events in alarm mode |
modeAlarmOrStart | events in alarm or start mode |
modeAlarmed | events that have just transitioned from upcoming to alarm mode |
modeChanged | events that have just changed their mode somehow |
modeEnd | events in end mode |
modeEnded | events that have just transitioned from start to end mode |
modeStart | events in start mode |
modeStarted | events that have just transitioned to start mode |
modeUpcoming | events in upcoming mode |
stateChanged | events that have just changed their state somehow |
stateDeleted | events in state deleted |
stateNew | events in state new |
stateUpdated | events in state updated |
Usage scenarios
get MyCalendar full all
2767324dsfretfvds7dsfn3e4dsa234r234sdfds6bh874googlecom known alarm 31.05.2012 17:00:00 07.06.2012 16:30:00-07.06.2012 18:00:00 Erna for coffee
992hydf4;44awer5466lhfdsrgl7tin6b6mckf8glmhui4googlecom known upcoming 08.06.2012 00:00:00-09.06.2012 00:00:00 Vacation
text 20 60 { fhem("get MyCalendar text modeAlarmOrStart") }
07.06.12 16:30 Erna for coffee
08.06.12 00:00 Vacation
get MyCalendar find .*Erna.*
2767324dsfretfvds7dsfn3e4dsa234r234sdfds6bh874googlecom
define ErnaComes notify MyCalendar:modeStarted.*2767324dsfretfvds7dsfn3e4dsa234r234sdfds6bh874googlecom.* set MyLight on
define LogErna notify MyCalendar:modeAlarmed.*2767324dsfretfvds7dsfn3e4dsa234r234sdfds6bh874googlecom.* { Log 1, "ALARM name=%NAME event=%EVENT part1=%EVTPART0 part2=%EVTPART1" }
define <name> FHZ <serial-device>
define
<name> FHZ <serial-device> strangetty
set FHZ <variable> [<value>]
value
is one of:define fhz_timer at +*00:01:00 set FHZ time
set FHZ initfull
set FHZ reopen
initfull
issues the initialization sequence for the FHZ
device:get FHZ init2 get FHZ serial set FHZ initHMS set FHZ initFS20 set FHZ time set FHZ raw 04 01010100010000
reopen
closes and reopens the serial device port. This
implicitly initializes the FHZ and issues the
initfull
command sequence.stopHMS
probably is the inverse of initHMS
(I don't have authoritative info on what exactly it does).close
closes and frees the serial device port until you open
it again with open
, e.g. useful if you need to temporarily
unload the ftdi_sio kernel module to use the bit-bang mode.get FHZ <value>
value
is one of:list FHZ
fhtbuf
returns the free memory in this buffer (in hex),
an empty buffer in the FHZ1000 is 2c (42 bytes), in the FHZ1300 is 4a
(74 bytes). A message occupies 3 + 2x(number of FHT commands) bytes,
this is the second reason why sending multiple FHT commands with one
set is a good idea. The first reason is, that
these FHT commands are sent at once to the FHT.
define <name> FS20 <housecode> <button>
[fg <fgaddr>] [lm <lmaddr>] [gm FF]
<housecode>
is a 4 digit hex or 8 digit ELV4 number,
corresponding to the housecode address.<button>
is a 2 digit hex or 4 digit ELV4 number,
corresponding to a button of the transmitter.<fgaddr>
specifies the function group.
It is a 2 digit hex or 4 digit ELV address. The first digit of the hex
address must be F or the first 2 digits of the ELV4 address must be
44.<lmaddr>
specifies the local
master. It is a 2 digit hex or 4 digit ELV address. The last digit of the
hex address must be F or the last 2 digits of the ELV4 address must be
44.define lamp FS20 7777 00 fg F1 gm F
define roll1 FS20 7777 01
define otherlamp FS20 24242424 1111 fg 4412 gm 4444
define otherroll1 FS20 24242424 1114
set <name> <value> [<time>]
value
is one of:dim06% dim12% dim18% dim25% dim31% dim37% dim43% dim50% dim56% dim62% dim68% dim75% dim81% dim87% dim93% dim100% dimdown dimup dimupdown off off-for-timer on # dimmer: set to value before switching it off on-for-timer # see the note on-old-for-timer # set to previous (before switching it on) ramp-on-time # time to reach the desired dim value on dimmers ramp-off-time # time to reach the off state on dimmers reset sendstate timer toggle # between off and previous dim val on-till # Special, see the noteExamples:
set lamp on
set lamp1,lamp2,lamp3 on
set lamp1-lamp3 on
set lamp on-for-timer 12
time
argument ranges from 0.25sec to 4 hours and
16 minutes.
As the time is encoded in one byte there are only 112 distinct
values, the resolution gets coarse with larger values. The program
will report the used timeout if the specified one cannot be set
exactly. The resolution is 0.25 sec from 0 to 4 sec, 0.5 sec from 4
to 8 sec, 1 sec from 8 to 16 sec and so on. If you need better
precision for large values, use at which has a 1
sec resolution.
attr store eventMap on:open off:closed
attr store eventMap /on-for-timer 10:open/off:closed/
set store open
a-z 0-9
and -
(dash),
other characters should be ommited. Here is a list of "official"
devices:define <name> FHT <housecode>
<housecode>
is a four digit hex number,
corresponding to the address of the FHT80b device.
define wz FHT 3232
set <name> <valuetype> <value>
value
is one of:desired-temp day-temp night-temp report1 report2 refreshvalues mode holiday1 holiday2 # see mode holiday_short or holiday manu-temp # No clue what it does. year month day hour minute time date lowtemp-offset # Alarm-Temp.-Differenz windowopen-temp mon-from1 mon-to1 mon-from2 mon-to2 tue-from1 tue-to1 tue-from2 tue-to2 wed-from1 wed-to1 wed-from2 wed-to2 thu-from1 thu-to1 thu-from2 thu-to2 fri-from1 fri-to1 fri-from2 fri-to2 sat-from1 sat-to1 sat-from2 sat-to2 sun-from1 sun-to1 sun-from2 sun-to2Examples:
set wz desired-temp 22.5
set fl desired-temp 20.5 day-temp 19.0 night-temp 16.0
measured-temp actuator actuator1...actuator8
warnings
fhtbuf
entry in the
get
section.*-temp
values need a temperature
as argument, which will be rounded to 0.5 Celsius.mode
is one of auto, manual, holiday or
holiday_short.
set FHT1 mode holiday holiday1 24 holiday2 12 desired-temp 14
*-from1/*-from2/*-to1/*-to2
valuetypes need a time
spec as argument in the HH:MM format. They define the periods, where
the day-temp is valid. The minute (MM) will be rounded to 10, and
24:00 means off.
define fht_sync at +*3:30 set TYPE=FHT time
report1
with parameter 255 requests all settings for
monday till sunday to be sent. The argument is a bitfield, to request
unique values add up the following:
report2
with parameter 255 requests the following
settings to be reported: day-temp night-temp windowopen-temp
lowtemp-offset desired-temp measured-temp mode warnings.
The argument is (more or less) a bitfield, to request unique values
add up the following:
lowtemp-offset
needs a temperature as argument, valid
values must be between 1.0 and 5.0 Celsius.desired-temp - measured-temp >
lowtemp-offset
in a room for at least 1.5 hours after the last
desired-temp change. desired-temp,mode,report1,report2,
holiday1,holiday2,day-temp,night-temp, [all other commands]
retrycount
times if after 240 seconds
no confirmation message is received from the corresponding FHT
device.define <name> FHT <housecode> [IODev]
<housecode>
is a four digit hex number,
and must have the following relation to the housecode of the corresponding CUL
device:
<IODev>
must be specified if the last defined CUL device
is not the one to use. Usually this is done voa the IODev attribute, but as the address checked is performed
at the definition, we must use an exception here.
define wz FHT8V 3232
define <name> PID sensor[:reading:regexp] actor[:cmd:min:max] [p i d]
sensor[:reading:regexp]
specifies the sensor, which is an
already defined fhem device, e.g. a S300TH temperature sensor. The reading
and regexp fields are necessary only for unknown devices (currently CUL_WS and HMS devices are "known").
Reading specifies the READINGS field of the sensor, and the regexp extracts
the number from this field. E.g. for the complete definition for a CUL_WS
device is: s300th_dev:temperature:([\d\.]*)
actor[:cmd:min:max]
specifies the actor, which is an
already defined fhem device, e.g. an FHT8V valve. The cmd, min and max
fields are necessary only for unknown devices (currently FHT8V is "known"). cmd specifies the command name for the
actor, min the minimum value and max the maximum value. The complete
definition for an FHT8V device is:fht8v_dev:valve:0:100
define wz_pid PID wz_th wz_fht8v
define <name> CUL_FHTTK <devicecode>
<devicecode>
is a six digit hex number, given to the FHT80 TF during
production, i. e. it is not changeable. (Yes, it keeps this code after changing batteries
as well.)define TK_TEST CUL_FHTTK 965AB0
define <name> HMS <housecode>
<housecode>
is a four digit hex number,
corresponding to the address of the HMS device.
define temp HMS 1234
define <name> HMLAN <ip-address>[:port]
The CUL/CUR/CUN is a family of RF devices sold by busware.de.
With the opensource firmware (see this link) they are capable
to receive and send different 868MHz protocols (FS20/FHT/S300/EM/HMS).
It is even possible to use these devices as range extenders/routers, see the
CUL_RFR module for details.
Some protocols (FS20, FHT and KS300) are converted by this module so that the same logical device can be used, irrespective if the radio telegram is received by a CUL or an FHZ device. Other protocols (S300/EM) need their own modules. E.g. S300 devices are processed by the CUL_WS module if the signals are received by the CUL, similarly EMWZ/EMGZ/EMEM is handled by the CUL_EM module. It is possible to attach more than one device in order to get better reception, fhem will filter out duplicate messages. Note: this module may require the Device::SerialPort or Win32::SerialPort module if you attach the device via USB and the OS sets strange default parameters for serial devices. |
define <name> CUL <device> <FHTID>
fhtbuf
returns the free memory in this buffer (in hex),
an empty buffer in the CUL-V2 is 74 bytes, in CUL-V3/CUN 200 Bytes.
A message occupies 3 + 2x(number of FHT commands) bytes,
this is the second reason why sending multiple FHT commands with one
set is a good idea. The first reason is, that
these FHT commands are sent at once to the FHT.
2012-05-17 09:44:22.515 CUL CULHM RCV L:0B N:81 CMD:A258 SRC:...... DST:...... 0000 (TYPE=88,WAKEMEUP,BIDI,RPTEN)
define <name> CUL_WS <code> [corr1...corr4]
define <name> CUL_TX <code> [corr] [minsecs]
define <name> CUL_EM <code> [corr1 corr2
CostPerUnit BasicFeePerMonth]
define emwz 1 75 900 0.15 12.50and the Log looks like:
CUM_DAY: 6.849 CUM: 60123.4 COST: 1.02 CUM_MONTH: 212.319 CUM: 60123.4 COST: 44.34Tipp: You can configure your EMWZ device to show in the CUM column of the STATE reading the current reading of your meter. For this purpose: multiply the current reading (from the real device) with the corr1 value (RperKW), and substract the RAW CUM value from it. Now set the basis reading of your EMWZ device (named emwz) to this value.
define IR-Dev CUL_IR CUNO1Set
set IR-Dev irSend ButtonA001If defining an IR-Code directly the following Code-Syntax needs to be followed:
IRCode: <PP><AAAA><CCCC><FF>with P = Protocol; A = Address; C = Command; F = Flags
set IR-Dev irSend 0A07070F0F02
set IR-Dev irSend I0A07070F0F00
Button<learnprefix><learncount>When the CUL_IR device is set into learning mode it will generate a new button-attribute for each new IR-Code received.This is done according to the following syntax:
<Button-Attribute-Name> <IR-Code>Examples of learnt button-attributes with EMPTY <learnprefix> and <learncount> starting from 1:
Button001 I02029A000000 Button002 I02029A000001To make sure that something happens when this IR-code is received later on one has to modify the attribute and to add commands as attribute values. Examples:
Button001 I02029A000000 set WZ_Lamp on Button002 I02029A000001 set Switch onThe syntax for this is:
attr <device-name> <attribute-name> <IR-Code> <command>
<Group-Attribute-Name> <IR-Code>Examples of a group-attribute is:
Group001 I02029AWith this all IR-Codes starting with I02029A will match the Group001.
Button<learnprefix><learncount>If learnprefix is empty the button-attribute-name only contains the term "Button" and the actual number of learncount.
define <name> ESA2000 <code>
[base1 base2]
define <name> CUL_HM <6-digit-hex-code>
set hm1 raw ++A001F100001234560105000000001\ ++A001F10000123456010802010AF10B000C00\ ++A001F1000012345601080801\ ++A001F100001234560106
define <name> CUL_HOERMANNEM <10-digit-hex-code>
The CUL_RFR module is used to "attach" a second CUL to your base CUL, and
use it as a repeater / range extender. RFR is shorthand for RF_ROUTER.
Transmission of the data uses the CC1101 packet capabilities with GFSK
modulation at 250kBaud after pinging the base CUL at the usual 1kBaud. When
configured, the RFR device can be used like another CUL connected directly to
fhem.
Before you can use this feature in fhem, you have to enable/configure RF ROUTING in both CUL's:
|
define <name> CUL_RFR <own-id> <base-id>
set MyCUL raw ui0100
set MyCUL raw ui0201
define MyRFR CUL_RFR 02 01
define <name> EIB <main group> [<additional group> ..]
define lamp1 EIB 0/10/12
define lamp1 EIB 0/10/12 0/0/5
define lamp1 EIB 0A0C
set <name> <value> [<time> g<groupnr>]
define <name> EnOcean <ID>
define switch1 EnOcean ffc54500
set switch1 <value>
value
is one of A0,AI,B0,BI,C0,CI,D0,DI, combinations of
these and released, in fact we are trying to emulate a PTM100 type remote.
get <tcm> idbase
" command. You can use
up to 128 ID's starting with the base shown there. If you are using an
ID outside of the allowed range, you'll see an ERR_ID_RANGE message in the
fhem log.
set switch1 BI
set switch1 B0,CI
attr eventMap BI:on B0:off
set switch1 on
define <name> EM <em1010pc-device>
define em EM /dev/elv_em1010pc
set EM <value>
value
is either time or reset.get EM <value>
value
is either version or time.
define <name> EMWZ <device-number>
define emwz EMWZ 1
set EMWZdevice <param> <value>
get EMWZ status
define <name> EMGZ <device-number>
define emgz EMGZ 9
set EMGZdevice <param> <value>
get EMGZ status
define <name> EMEM <device-number>
define emem EMEM 5
get EMEM status
define <name> KM271 <serial-device-name>
define KM271 KM271 /dev/ttyS0
set KM271 <param> [<value> [<values>]]
set KM271 hk1_timer 1 mo 06:30 mo 08:20
define <name> KS300 <housecode> [ml/raincounter [wind-factor]]
<housecode>
is a four digit hex number,
corresponding to the address of the KS300 device, right now it is ignored.
The ml/raincounter defaults to 255 ml, but it must be specified if you wish
to set the wind factor, which defaults to 1.0.
define ks1 KS300 1234
define <name> LUXTRONIK2 <IP-address> [<poll-interval>]
define Heizung LUXTRONIK2 192.168.0.12 600
define <name> CM11 <serial-device>
define <name> FHZ <serial-device> strangetty
define x10if CM11 /dev/ttyUSB3
set <name> reopen
get <name> fwrev
error
if the serial connection to the device times out. Can be used for error
detection.
get <name> time
error
if the serial connection to the device times out. Can be used for error
detection.
define <name> WOL <MAC> <IP>
<unitcode>
define computer1 WOL 72:11:AC:4D:37:13 192.168.0.24
ether-wake
on FritzBoxes.set <name> <value>
value
is one of:refresh # checks whether the computer is currently running on # sends a magic packet to the defined MAC addressExamples:
set computer1 on
set computer1 refresh
define <name> X10 <model> <housecode>
<unitcode>
<model>
is one of
lm12
: lamp module, dimmablelm15
: lamp module, not dimmableam12
: appliance module, not dimmabletm12
: tranceiver module, not dimmable. Its
unitcode is 1.<housecode>
ranges from A to P.<unitcode>
ranges from 1 to 16.define lamp1 X10 lm12 N 10
define pump X10 am12 B 7
define lamp2 X10 lm15 N 11
set <name> <value> [<argument>]
value
is one of:dimdown # requires argument, see the note dimup # requires argument, see the note off on on-till # Special, see the note on-for-timer # Special, see the noteExamples:
set lamp1 dimup 10
set lamp1,lamp2 off
set pump off
set lamp2 on-till 19:59
set lamp2 on-for-timer 00:02:30
model
argument in its define
statement.
dimdown
and dimup
take a number in the
range from 0 to 22 as argument. It is assumed that argument 1 is
a 1% brightness change (microdim) and arguments 2 to 22 are
10%..100% brightness changes. The meaning of argument 0 is
unclear.dimdown
and dimup
codes are logged with
different meaning of the arguments depending on whether the commands
were sent from the PC or from a remote control or a wall switch.dimdown
and dimup
from on and off states may
have unexpected results. This seems to be a feature of the X10
devices.on-till
requires an absolute time in the "at" format
(HH:MM:SS, HH:MM) or { <perl code> }, where the perl code
returns a time specification).
If the current time is greater than the specified time, then the
command is ignored, else an "on" command is generated, and for the
given "till-time" an off command is scheduleld via the at command.
on-for-timer
requires a relative time in the "at" format
(HH:MM:SS, HH:MM) or { <perl code> }, where the perl code
returns a time specification).
begin prog = fhem button = pwr config = IrPower endand you press the pwr button the IrPower toggle event occures at fhem.
define IrPower01 notify IrPower set lamp toggleturns the lamp on and off. If you want a faster reaction to keypresses you have to change the defaultvalue of readytimeout from 5 seconds to e.g. 1 second in fhem.pl
define WS300Device WS300 <serial device>
define <devname> WS300 [0-9]
define WS300Device WS300 /dev/ttyUSB1 define ash2200.1 WS300 0 define ks300 WS300 8 define ws300 WS300 9
set WS300Device <interval(min.)> <height(m)> <rainvalume(ml)>
define <name> Weather <location> [<interval> [<language>]]
location
is any string that is recognized as a
location, either a town name or a zip code or latitude/longitude (in decimal notation,
multiplied by one million). Browse to the URL
http://www.google.de/ig/api?weather=location&hl=en
to see the raw output for your location.interval
is the time between subsequent updates
in seconds. It defaults to 3600 (1 hour).da
,
de
,
en
,
es
,
fi
,
fr
,
it
,
ja
,
ko
,
nl
,
no
,
pt-BR
,
ru
,
sv
,
zv-CN
,
zv-TW
.
It determines the natural language in which the forecast information appears.
It defaults to en
. If you want to set the language you also have to set the interval.define MyWeather Weather Frankfurt,HE define Forecast Weather Amsterdam,NL 1800 define weather Weather 30000,France 3600 fr define W Weather ,,,50500000,30500000 600 es
get <name> <reading>
city | name of town returned for location |
condition | current condition, one of Sunny, Clear, Partly Cloudy, Mostly Cloudy, Overcast, Chance of Rain |
current_date_time | last update of forecast on server |
fc?_condition | forecast condition |
fc?_day_of_week | day of week for day +? |
fc?_high_c | forecasted daily high in degrees centigrade |
fc?_icon | relative path for forecast icon, prefix with http://www.google.com to form a valid URL for display in web interfaces |
fc?_low_c | forecasted daily low in degrees centigrade |
humidity | current humidity in % |
icon | relative path for current icon |
postal_code | location sent to server |
temperature | current temperature in degrees centigrade |
temp_c | current temperature in degrees centigrade |
temp_f | current temperature in degrees Fahrenheit |
wind | wind speed in km/h |
wind_condition | wind direction and speed |
define <name> Twilight <latitude> <longitude> [<indoor_horizon> [<Weather_Position>]]
0 - total night, sun is at least -18 degree below horizon
1 - astronomical twilight, sun is between -12 and -18 degree below horizon
2 - nautical twilight, sun is between -6 and -12 degree below horizon
3 - civil twilight, sun is between 0 and -6 degree below horizon
4 - indoor twilight, sun is between the indoor_horizon and 0 degree below horizon (not used if indoor_horizon=0)
5 - weather twilight, sun is between indoor_horizon and a virtual weather horizon (the weather horizon depends on weather conditions (optional)
6 - maximum daylight
latitude
and longitude
are decimal numbers which give the position on earth for which the twilight states shall be calculated.define myTwilight Twilight 49.962529 10.324845 3 676757
get <name> <reading>
light | the current virtual daylight value |
nextEvent | the name of the next event |
nextEventTime | the time when the next event will probably happen (durint light phase 5 and 6 this is updated when weather conditions change |
sr_astro | time of astronomical sunrise |
sr_naut | time of nautical sunrise |
sr_civil | time of civil sunrise |
sr | time of sunrise |
sr_indoor | time of indoor sunrise |
sr_weather | time of weather sunrise |
ss_weather | time of weather sunset |
ss_indoor | time of indoor sunset |
ss | time of sunset |
ss_civil | time of civil sunset |
ss_nautic | time of nautic sunset |
ss_astro | time of astro sunset |
define <name> USF1000 <geometry>
<geometry>
determines the form of the tank and the
position of the sensor. The following geometries are currently
supported:cub <length> <width> <height> <offset>
cylv <diameter> <height> <offset>
cub
stands for a cuboid whose base is <length> × <width>.
cylv
stands for a vertical cylinder whose diameter is <diameter>.
<height> is the distance of the surface of the liquid from the ground
if the tank is full. <offset> is the distance of the sensor relative to
the surface of the liquid. All quantities are expressed in meters.define MyTank USF1000 cylv 2 1 0.3
: a cylindrical water tank with
2 meters diameter. The water stands 1 meter high if the tank is full. The
sensor is fixed 1,3 meters above ground.define <name> WEBCOUNT <ip-address> <port> <delay>
define pump WEBCOUNT 192.168.8.200 1 60
define <name> WEBIO <ip-address> <port> <delay>
define pumpspeed WEBIO 192.168.8.200 1 60
set <name> <value>
value
is one of:0.00 - 10.00Examples:
set pumpspeed 6.75
define <name> WEBIO_12DIGITAL <ip-address> <outputport> <delay>
define motor1 WEBIO_12DIGITAL 192.168.8.200 1 60
set <name> <value>
value
is one of:on offExamples:
set motor1 on
The POKEYS module is used to control the LAN POKEYS device (POKEYS56e) which supports
up to 56 digital input, analog inputs, counter inputs and digital outputs.
Each port/pin has to be configured before it can be used.
Define define <name> POKEYS <ip-address> <pin> <io-state> [<time in ms>] <ip-address> the IP address where the POKEYS device can be accessed<pin> the pin number which should be configured<io-state> the new io state of the pin Obsolete(=undef) DigIn DigOut AdcIn DigInCtRise DigInCtFall ExtDigOut GetBasic <time in ms> optional else 1000ms: cyclic update time for Input pin Example: define PoInfo POKEYS 192.168.178.34 0 GetBasic # creates a virtual pin for getting infos about the device with the get commanddefine Pin44in POKEYS 192.168.178.34 44 DigIn 200 # creates a digitial input port on pin 44 define Pin25out POKEYS 192.168.178.34 25 DigOut # creates a digial output port on pin 25 Set set <name> <state> [<time in ms>] <state> can be OFF ON OFF_PULSE ON_PULSE <time in ms> optional else 1000ms hold time for the ON_PULSE OFF_PULSE stateExample: set Pin25out ON # sets Pin25out to ON (0V) Get get <name> <type> only supported for pins of type GetBasic <type> can be Version DevName Serial User CPUload Example: get PoInfo Version # gets the version of the POKEYS device Attributes
VantagePro2
Define define <name> <ip-address> <port> <delay>
Defines a Davis VantagePro2 weatherstation attached on transparent ethernet/usb|serial server accessable by telnet. Examples: define AUSSEN.wetterstation VantagePro2 192.168.8.127 4999 60
fhem> list AUSSEN.wetterstation ALL3076
Define define <name> ALL3076 <ip-address>
Defines an Allnet 3076 device (Dimmable lightswitch) via its ip address or dns name Examples: define lamp1 ALL3076 192.168.1.200 Set set <name> <value>
where value is one of:dimdown dim10% dim20% dim30% dim40% dim50% dim60% dim70% dim80% dim90% dim100% dim[0-100]% dimup off on toggleExamples: set lamp1 on set lamp1 dim11% set lamp2 toggle Notes:
ALL4000T
Define define <name> ALL4000T <ip-address> <port> <delay>
Defines a temperature sensor connected on an Allnet 4000 device via its ip address and port. Use the delay argument to define the delay between polls. Examples: define AUSSEN.POOL.TEMP.vorlauf ALL4000T 192.168.68.20 t2 120 ALL4027
Define define <name> ALL4027 <ip-address> <port> <relay_nr> <delay>
Defines an Allnet 4027 device (Box with 8 relays) connected to an ALL4000 via its ip address. The status of the device is also pooled (delay interval), because someone else is able to change the state via the webinterface of the device. Examples: define lamp1 ALL4027 192.168.8.200 0 7 60 Set set <name> <value>
where value is one of:off on on-for-timer <Seconds> toggleExamples: set poolpump on Notes:
BS
The state contains the brightness in % (reading brightness ) and
the brightness in lux (reading lux ). The flags
reading is always zero. The meaning of these readings is explained in more
detail on the above mentioned wiki page.Define define <name> BS <sensor#> [<RExt>]
<sensor#> is the number of sensor in the brightness
sensor address system that runs from 1 to 9.<RExt> is the value of the resistor on your brightness
sensor in Ω (Ohm). The brightness reading in % is proportional to the resistance, the
lux reading is proportional to the resistance squared. The value is
optional. The default resistance is RExt= 50.000Ω.Example: define bs1 BS 1 40000 Set
Get
Attributes IT - InterTechno
Define define <name> IT <housecode> <on-code> <off-code>
[<dimup-code>] [<dimdown-code>]
The value of housecode is a 10-digit InterTechno Code, consisting of 0/1/F as it is defined as a tri-state protocol. These digits depend on your device you are using. Bit 11/12 are used for switching/dimming. As different manufacturers are using different bit-codes you can specifiy here the 2-digit code for off/on/dimup/dimdown in the same form: 0/1/F. Examples: define lamp IT 01FF010101 11 00 01 10 define roll1 IT 111111111F 11 00 01 10 define otherlamp IT 000000000F 11 10 00 00 define otherroll1 IT FFFFFFF00F 11 10
Set set <name> <value> [<time>]
where value is one of:dimdown dimup off on on-till # Special, see the noteExamples: set lamp on set lamp1,lamp2,lamp3 on set lamp1-lamp3 on set lamp off Notes:
Get
Attributes
Generated events:
SCIVTDefine define <name> SCIVT <SCD-device>
Define a SCD series solar controler device. Details see here. You probably need a Serial to USB controller like the PL2303. Defining an SCIVT device will schedule an internal task, which reads the status of the device every 5 minutes, and triggers notify/filelog commands. Note: Currently this device does not support a "set" function, only a single get function which reads the device status immediately. Example: define scd SCIVT /dev/ttyUSB2
Get get SCVIT data
Attributes RSS
Currently a media RSS feed delivering status pictures in JPEG format is supported. This media RSS feed can be used to feed a status display to a network-enabled photo frame.
You need to have the perl module RSS is an extension to FHEMWEB. You must install FHEMWEB to use RSS. Definedefine <name> RSS jpg <hostname> <filename> Defines the RSS feed. jpg is a fixed literal to allow for future
extensions. <hostname> is the hostname of the fhem server as
seen from the consumer of the RSS feed. <filename> is the
name of the file that contains the layout definition.Examples: define FrameRSS RSS jpg host.example.org /etc/fhem/layout define MyRSS RSS jpg 192.168.1.222 /var/fhem/conf/layout.txt set <name> rereadcfg
Rereads the layout definition from the file. Useful to enable changes in the layout on-the-fly. Usage information
RSS appears in the FHEMWEB
side menu. If you click it you get a list of all defined RSS feeds. The URL of any such is
RSS feed is http://hostname:port/fhem/rss/name.rss with hostname and
name from the RSS feed's definition and the port
(usually 8083) and literal /fhem from the underlying FHEMWEB
definition.Example: http://host.example.org:8083/fhem/rss/FrameRSS.rss
The media RSS feed points to a dynamically generated JPEG picture. The URL of the JPEG picture
belonging to the RSS feed is Example: http://host.example.org:8083/fhem/rss/FrameRSS.jpg
To render the JPEG picture the current, or, if You can directly access the URL of the JPEG picture in your browser. Reload the page to see how it works. The media RSS feed advertises to refresh after 1 minute (ttl). Some photo frames ignore it and use their preset refresh rate. Go for a photo frame with an adjustable refresh rate (e.g every 5 seconds) if you have the choice! This is how the fhem config part might look like:
Everything after a # is treated as a comment and ignored. You can fold long lines by putting a \ at the end. Layout control commands
ECMD
A physical ECMD device can host any number of logical ECMD devices. Logical devices are defined as ECMDDevices in fhem. ADC 0 to 3 and I/O port 0 to 3 of the above mentioned board are examples of such logical devices. ADC 0 to 3 all belong to the same device class ADC (analog/digital converter). I/O port 0 to 3 belong to the device class I/O port. By means of extension boards you can make your physical device drive as many logical devices as you can imagine, e.g. IR receivers, LC displays, RF receivers/transmitters, 1-wire devices, etc.
Defining one fhem module for any device class would create an unmanageable
number of modules. Thus, an abstraction layer is used. You create a device class
on the fly and assign it to a logical ECMD device. The
class definition
names the parameters of the logical device, e.g. a placeholder for the number
of the ADC or port, as well as the get and set capabilities. Worked examples
are to be found in the documentation of the ECMDDevice device.
define <name> ECMD telnet <IPAddress:Port> or define <name> ECMD serial <SerialDevice>[<@BaudRate>]
Defines a physical ECMD device. The keywords telnet or
serial are fixed.Examples: define AVRNETIO ECMD telnet 192.168.0.91:2701 define AVRNETIO ECMD serial /dev/ttyS0 define AVRNETIO ECMD serial /sev/ttyUSB0@38400 set <name> classdef <classname> <filename>
Creates a new device class <classname> for logical devices.
The class definition is in the file <filename> . You must
create the device class before you create a logical device that adheres to
that definition.
Example: define AVRNETIO classdef /etc/fhem/ADC.classdef set <name> reopen
Closes and reopens the device. Could be handy if connection is lost and cannot be reestablished automatically. get <name> raw <command>
Sends the command <command> to the physical ECMD device
<name> and reads the response.
Attributes Class definition
The following commands are recognized in the device class definition: Neither apply the rules outlined in the documentation of perl specials for the <perl command> in the postprocessor definitions nor can it contain macros.
This is to avoid undesired side effects from e.g. doubling of semicolons.The perl command acts on $_ . The result of the perl command is the
final result of the get or set command.
ECMDDeviceDefine define <name> ECMDDevice <classname> [<parameter1> [<parameter2> [<parameter3> ... ]]]
Defines a logical ECMD device. The number of given parameters must match those given in the class definition of the device class <classname> .
Examples: define myADC ECMDDevice ADC define myRelais1 ECMDDevice relais 8 set <name> <commandname> [<parameter1> [<parameter2> [<parameter3> ... ]]]
The number of given parameters must match those given for the set command <commandname> definition in
the class definition.If set <commandname> is invoked the perl special in curly brackets from the command definition
is evaluated and the result is sent to the physical ECMD device.
Example: set myRelais1 on get <name> <commandname> [<parameter1> [<parameter2> [<parameter3> ... ]]]
The number of given parameters must match those given for the get command <commandname> definition in
the class definition.If get <commandname> is invoked the perl special in curly brackets from the command definition
is evaluated and the result is sent to the physical ECMD device. The response from the physical ECMD device is returned
and the state of the logical ECMD device is updated accordingly.
Example: get myADC value 3 Example 1
The class definition file /etc/fhem/ADC.classdef looks as follows:
get value cmd {"adc get %channel"}
In the fhem configuration file or on the fhem command line we do the following:
define AVRNETIO ECMD telnet 192.168.0.91:2701 # define the physical device
The get command is evaluated as follows: get value has one named parameter
channel . In the example the literal 1 is given and thus %channel
is replaced by 1 to yield "adc get 1" after macro substitution. Perl
evaluates this to a literal string which is send as a plain ethersex command to the AVR-NET-IO. The
board returns something like 024 for the current value of analog/digital converter number 1.
The class definition file /etc/fhem/relais.classdef looks as follows:
params pinmask
In the fhem configuration file or on the fhem command line we do the following:
define AVRNETIO ECMD telnet 192.168.0.91:2701 # define the physical device
The set command is evaluated as follows: %pinmask
is replaced by 8 to yield
"io set ddr 2 ff\nioset port 2 08\nwait 1000\nio set port 2 00" after macro substitution. Perl
evaluates this to a literal string which is send as a plain ethersex command to the AVR-NET-IO line by line.
For any of the four plain ethersex commands, the AVR-NET-IO returns the string OK . They are
concatenated and separated by semicolons. The postprocessor takes the result from $_ ,
substitutes it by the string success if it is OK;OK;OK;OK , and then either
returns the string ok or the string error .
M232Define define <name> M232 <m232-device>
Define a M232 device. You can attach as many M232 devices as you like. A M232 device provides 6 analog inputs (voltage 0..5V with 10 bit resolution) and 8 bidirectional digital ports. The eighth digital port can be used as a 16 bit counter (maximum frequency 3kHz). The M232 device needs to be connected to a 25pin sub-d RS232 serial port. A USB-to-serial converter works fine if no serial port is available. Examples: define m232 M232 /dev/ttyUSB2 set <name> stop
Stops the counter. set <name> start
Resets the counter to zero and starts it. set <name> octet
Sets the state of all digital ports at once, value is 0..255. set <name> io0..io7 0|1
Turns digital port 0..7 off or on. get <name> [an0..an5]
Gets the reading of analog input 0..5 in volts. get <name> [io0..io7]
Gets the state of digital ports 0..7, result is 0 or 1. get <name> octet
Gets the state of all digital ports at once, result is 0..255. get <name> counter
Gets the number of ticks of the counter since the last reset. The counter wraps around from 65,535 to 0 and then stops. See M232Counter for how we care about this. M232Counter
define <name> M232Counter [unit [factor [deltaunit [deltafactor]]]]
Define at most one M232Counter for a M232 device. Defining a M232Counter will schedule an internal task, which periodically reads the status of the counter, and triggers notify/filelog commands. unit is the unit
name, factor is used to calculate the reading of the counter
from the number of ticks. deltaunit is the unit name of the counter
differential per second, deltafactor is used to calculate the
counter differential per second from the number of ticks per second.Default values: Note: the parameters in square brackets are optional. If you wish to specify an optional parameter, all preceding parameters must be specified as well. Examples: define counter M232Counter turns define counter M232Counter kWh 0.0008 kW 2.88
(one tick equals 1/1250th kWh)Do not forget to start the counter (with set .. start for
M232) or to start the counter and set the reading to a specified value
(with set ... value for M232Counter).To avoid issues with the tick count reaching the end point, the device's internal counter is automatically reset to 0 when the tick count is 64,000 or above and the reading basis is adjusted accordingly. set <name> value <value>
Sets the reading of the counter to the given value. The counter is reset and started and the offset is adjusted to value/unit. set <name> interval <interval>
Sets the status polling interval in seconds to the given value. The default is 60 seconds. get <name> status
Gets the reading of the counter multiplied by the factor from the define statement. Wraparounds of the counter are accounted for
by an offset (see reading basis in the output of the
list statement for the device).
M232VoltageDefine define <name> M232Voltage [an0..an5] [unit [factor]]
Define as many M232Voltages as you like for a M232 device. Defining a M232Voltage will schedule an internal task, which reads the status of the analog input every minute, and triggers notify/filelog commands. unit is the unit name, factor is used to
calibrate the reading of the analog input.Note: the unit defaults to the string "volts", but it must be specified if you wish to set the factor, which defaults to 1.0. Example: define volt M232Voltage an0 define brightness M232Voltage an5 lx 200.0
Get get <name> status
xxLG7000Define define <name> xxLG7000 <serial-device>
Defines a serial link to a TV set of LG's xxLG70yy (e. g. 47LG7000) series and similar TV sets from LG. As of January 2010, the following TV sets should be compatible: These TV sets feature a serial connector which can officially be used to control the TV set (see your Onwer's Manual, there's an Appendix labelled "External Control Device setup", referening to cabling and command set). The xxLG7000 module is the FHEM module to actually utilize this. (BTW, those TVs run Linux internally ;)) To exercise control over your TV set, use the LGTV module and bind it ("attr <LGTV-name> IODev <xxLG7000-name>") to xxLG7000. Examples: define myLG7k xxLG7000 /dev/ttyUSB1
LGTV
define <name> LGTV
This module is expected to work with xxLG7000 as it's IODev. With LGTV and a compatible hardware module (currently, there's only xxLG7000), you are able to power your TV set on and off, query it's power state, select the input (AV, RGB, Composites, analogue TV, DVB-T, HDMI) or mute/unmute the volume. Defining a LGTV device will schedule an internal task, which periodically reads the status of the TV set (power state; if power is on, query the selected input) and triggers notify/filelog commands. Example: define 47LG7000 LGTV attr 47LG7000 IODev myLG7k
set <name> <what> <value>
Currently, the following commands are defined; not all may be available on a given TV set. An error messages should be recorded if e. g. the input in question is not usable. power on power off input AV1 input AV2 input AV3 input AV3 input Component input RGB input HDMI1 input HDMI2 input HDMI3 input HDMI4 input DVBT input PAL audio mute audio normalGet get <name> <what>
Currently, the following commands are defined; not all may be available on a given TV set. An error messages should be recorded if e. g. the input in question is not usable. power input audioAttributes Implementator's note
OREGON
Define define <name> OREGON <deviceid> <deviceid> is the device identifier of the Oregon sensor. It consists of the sensors name and a one byte hex string (00-ff) that identifies the sensor. The define statement with the deviceid is generated automatically by autocreate. The following sensor names are used: BTHR918, BTHR918N, PCR800 RGR918, RTGR328N, THN132N, THGR228N, THGR328N, THGR918, THR128, THWR288A, THGR810, UV138, UVN800, WGR918, WGR800, WTGR800_A, WTGR800_T. The one byte hex string is generated by the Oregon sensor when is it powered on. The value seems to be randomly generated. This has the advantage that you may use more than one Oregon sensor of the same type even if it has no switch to set a sensor id. For exampple the author uses three BTHR918 sensors at the same time. All have different deviceids. The drawback is that the deviceid changes after changing batteries. Example: define Kaminzimmer OREGON BTHR918N_ab
Set
Get
Attributes OWFS
Note: You need the owperl module from http://owfs.org/. Define define <name> OWFS <owserver-ip:port> <model> [<id>]
Define a 1-wire device to communicate with an OWFS-Server. <owserver-ip:port>
<model>
DS1420, DS9097 (for passive Adapter)
<id>
If the owserver-ip:port is called none , then
no device will be opened, so you can experiment without hardware attached.Example: #define an active Adapter: #define a passive Adapter:
Get get <name> <value>
where value is one of (not supported by passive Devices e.g. DS9097):get DS9490R type DS9490R type => DS1420 get DS9490R address DS9490R address => 8193302D0000002B
OWTEMP
Note: Please define an OWFS device first. Define define <name> OWTEMP <id> [<interval>] [<alarminterval>]
Define a 1-wire Digital Thermometer device. <id>
Set <id> to none for demo mode.
<interval>
<alarminterval>
Currently supported type: DS18S20 .Example: define KG.hz.TF.01 OWTEMP 14B598010800 300 60 set <name> <value>
where value is one of:Get get <name> <value>
where value is one of:get KG.hz.TF.01 type KG.hz.TF.01 type => DS18S20 get KG.hz.TF.01 temperature KG.hz.TF.01 temperature => 38.2500 (Celsius)
RFXCOM
RFXMETER
Define define <name> RFXMETER <deviceid> [<scalefactor>] [<unitname>] <deviceid> is the device identifier of the RFXMeter sensor and is a one byte hexstring (00-ff). <scalefactor> is an optional scaling factor. It is multiplied to the value that is received from the RFXmeter sensor. <unitname> is an optional string that describes the value units. It is added to the Reading generated to describe the values. Example: define RFXWater RFXMETER 00 0.5 ltr
define RFXPower RFXMETER 01 0.001 kwh
define RFXGas RFXMETER 02 0.01 cu_m
Set
Get
Attributes RFXX10REC
Define define <name> RFXX10REC <type> <deviceid> <devicelog> [<deviceid> <devicelog>] <type>
X10 security devices: <deviceid>
<devicelog>
<deviceid2>
<devicelog2>
<deviceid2> .
Example: define livingroom_window RFXX10REC ds10a 72cd Window
define motion_sensor1 RFXX10REC ms10a 55c6 motion
define smoke_sensor1 RFXX10REC sd90 54d3 Smoke 54d3 Smoketest
define motion_sensor2 RFXX10REC ms14a A1 motion A2 light
Set
Get
Attributes WS2000
Define define <name> WS2000 <device_to_connect>
Define a WS2000 series raw receiver device sold by ELV. Details see here. Unlike 86_FS10.pm it will handle the complete device communication itself and doesnt require an external program. For this reason you can now use this also on windows. This Device will be usually connect to a serial port, but you can also define a raw network redirector like lantronix XPORT(TM). Note: Currently this device does not support a "set" function Attributes: Example: define WS2000 WS2000 /dev/ttyS0 define WS2000 WS2000 xport:10001 attr WS2000 rain 366 : use factor 366 ml/count for rain sensor S2000R
Get get <name> list
Gets the last reading of all received sensord get <name> [TH0..TH7, T0..T7, I0..I7, R0..R7, W0..W7, L0..L7, P0..P7,LAST,RAW] get the last reading for the name sensor, LAST : Last received Sensor
RAW : original Data from interface
WS3600Define define <name> WS3600 </path/to/fetch3600>
Define a WS3600 series weather station (Europe Supplies, technotrade, etc; refer to Wetterstationen.info (german) for details on this model); the station is queried by means of an external program, fetch3600. It talks to the attached weather station (several WS do supply an RS323 interface but seem to use some kind of "morse code" on the RTS, CTS wires instead of using propper serial communication (RX, TX); it's no use to recode that crap into FHEM when there is a stable package of tools to talk to the station available: open3600) and delivers the current readings line by line as reading-value-pairs. These are read in and translated into more readable names for FHEM by the module WS3600.pm. As the WS3600 is rather similar to the WS2300 and open3600 basically is a modified offspring of open2300, by exchanging the /path/to/fetch3600 with /path/to/fetch2300 this module should be able to handle the WS2300 was well. Currently, it is expected that the WS is attached to the local computer and fetch3600 is run locally. Basically the executable called needs to supply on stdout an output similar to what fetch3600 returns; how to implement a "networked setup" is left as an excercise to the reader. For the records, this is an output of fetch3600: Date 14-Nov-2009 Time 10:50:22 Ti 22.8 Timin 20.8 Timax 27.9 TTimin 10:27 DTimin 15-10-2009 TTimax 23:31 DTimax 20-08-2009 To 14.2 Tomin -0.4 Tomax 35.6 TTomin 07:03 DTomin 15-10-2009 TTomax 16:52 DTomax 20-08-2009 DP 9.2 DPmin -2.2 DPmax 20.3 TDPmin 07:03 DDPmin 15-10-2009 TDPmax 11:58 DDPmax 20-08-2009 RHi 48 RHimin 32 RHimax 57 TRHimin 17:03 DRHimin 21-10-2009 TRHimax 22:24 DRHimax 07-10-2009 RHo 72 RHomin 27 RHomax 96 TRHomin 16:41 DRHomin 20-08-2009 TRHomax 06:28 DRHomax 02-11-2009 WS 0.0 DIRtext WSW DIR0 247.5 DIR1 247.5 DIR2 247.5 DIR3 247.5 DIR4 247.5 DIR5 247.5 WC 14.2 WCmin -0.4 WCmax 35.6 TWCmin 07:03 DWCmin 15-10-2009 TWCmax 16:52 DWCmax 20-08-2009 WSmin 0.0 WSmax 25.6 TWSmin 10:44 DWSmin 14-11-2009 TWSmax 19:08 DWSmax 24-09-2009 R1h 0.00 R1hmax 24.34 TR1hmax 22:34 DR1hmax 07-10-2009 R24h 0.00 R24hmax 55.42 TR24hmax 07:11 DR24hmax 08-10-2009 R1w 29.00 R1wmax 95.83 TR1wmax 00:00 DR1wmax 12-10-2009 R1m 117.58 R1mmax 117.58 TR1mmax 00:00 DR1mmax 01-11-2009 Rtot 3028.70 TRtot 03:29 DRtot 18-09-2005 RP 992.200 AP 995.900 RPmin 970.300 RPmax 1020.000 TRPmin 05:25 DRPmin 04-11-2009 TRPmax 09:19 DRPmax 11-09-2009 Tendency Falling Forecast CloudyThere is no expectation on the readings received from the fetch3600 binary; so, in essence, if you have a similar setup (unsupported, attached weather station and a means to get it's reading into an output similar to above's), you should be able to use WS3600.pm with a custom written script to interface FHEM with your station as well. WS3600.pm only recognizes the above readings (and translates these into, e. g., Temp-inside for Ti for use within FHEM), other
lines are silently dropped on the floor.fetch3600 is available as binary for the Windows OS as well, but I haven't tested operation under that OS, use it at your own risk and you mileage may vary ... Note: Currently this device does not support a "set" function nor anything to "get". The later would be possible to implement if neccessary, though. Implementation of WS3600.pm tries to be nice, that is it reads from the pipe only non-blocking (== if there is data), so it should be safe even to use it via ssh or a netcat-pipe over the Internet, but this, as well, has not been tested yet. Attributes:
Example: define my3600 W36000 /usr/local/bin/fetch360 Set
Get
Attributes
SISPM
Define define <name> SISPM </path/to/sispmctl>
When using multiple SIS PMs on one host, sispmctl up to and including V 2.7 has a bug:
plug-2:# sispmctl -v -s -d 1 -g all -d 2 -g all SiS PM Control for Linux 2.7 (C) 2004, 2005, 2006, 2007, 2008 by Mondrian Nuessle, (C) 2005, 2006 by Andreas Neuper. This program is free software. [...] Gembird #0 is USB device 013.This device is a 4-socket SiS-PM. [...] Gembird #1 is USB device 015.This device is a 4-socket SiS-PM. [...] Accessing Gembird #1 USB device 015 Status of outlet 1: on Status of outlet 2: on Status of outlet 3: on Status of outlet 4: on Error performing requested action Libusb error string: error sending control message: Invalid argument Terminating *** glibc detected *** sispmctl: double free or corruption (fasttop): 0x000251e0 *** [...]Well, the fix is simple and will be sent upstream, but in case it's not incorporated at the time you need it, here it is; it's easy to apply even by hand ;-) --- src/main.c-old 2010-01-19 16:56:15.000000000 +0100 +++ src/main.c 2010-01-19 16:54:56.000000000 +0100 @@ -441,7 +441,7 @@ } break; case 'd': // replace previous (first is default) device by selected one - if(udev!=NULL) usb_close (udev); + if(udev!=NULL) { usb_close (udev); udev=NULL; } devnum = atoi(optarg); if(devnum>=count) devnum=count-1; break; Defines a path to the program "sispmctl", which is used to control (locally attached) "Silver Shield Power Manager" devices. Usually these are connected to the local computer via USB, more than one "sispm" device per computer is supported. (Please note that, due to neglections in their USB driver, AVM's Fritz!Box 7170 (and derivates, like Deutsche Telekom's Speedport W901V) is not able to talk to these devices ... The Fritz!Box 72xx and 73xx should be fine.) The communication between FHEM and the Power Manager device is done by using the open source sispmctl program. Thus, for the time being, THIS functionality is only available running FHEM on Linux (or any other platform where you can get the sispmctl program compiled and running). On the bright side: by interfacing via commandline, it is possible to define multiple SISPM devices, e. g. with a wrapper that does execute sispmctl on a remote (Linux) system. And: sispmctl runs happily on Marvells SheevaPlug ;) Please note: if you're not running FHEM as root, you most likely have to make sispmctl setuid root ( chmod 4755 /path/to/sispmctl ) or fiddle with
udev so that the devices of the Power Manager are owned by the user running FHEM.
After defining a SISPM device, a first test is done, identifying attached PMs. If this
succeeds, an internal task is scheduled to read the status every 30 seconds. (Reason
being that someone else could have switched sockets externally to FHEM.)
To actually control any power sockets, you need to define a SIS_PMS
device ;) If autocreate is enabled, those should be autocreated for your convenience as
soon as the first scan took place (30 seconds after the define).
Implementation of SISPM.pm tries to be nice, that is it reads from the pipe only
non-blocking (== if there is data), so it should be safe even to use it via ssh or
a netcat-pipe over the Internet, but this, as well, has not been tested extensively yet.
Attributes: Example: define PMS_Terrarium SISPM /usr/bin/sispmctl
Get
Attributes SIS_PMS
Define define <name> SIS_PMS <serial> <socket>
To securely distinguish multiple attached Power Manager devices, the serial number of those is used. You get these with "sispmctl -s" - or just let autocreate define the sockets attached for you. Examples: define lamp SIS_PMS 01:02:03:04:05 1 define otherlamp SIS_PMS 01:02:03:04:05 3 define tv SIS_PMS 01:01:38:44:55 1
Set set <name> <value> [<time>]
where value is one of:off on toggle on-till # Special, see the note off-till # Special, see the noteExamples: set lamp on set lamp1,lamp2,lamp3 on set lamp1-lamp3 on set hql_lamp on-till 18:45 Notes:
Get
Attributes
NetIO230B
fhem-module for NetIO 230B Power Distribution Unit (see: NetIO 230B (koukaam.se)) Note: this module needs the HTTP::Request and LWP::UserAgent perl modules.Please also note: the PDU must use firmware 3.1 or later and set to unencrypted mode. Define Defines a switching device, where sockets can be switched User name and password are optional. When no user name or password is passed, the module looks for a configfile at '/var/log/fhem/netio.conf'. If no config file is found, it uses 'admin/admin' as user/pass, since this is the default configuration for the device.
Alternatively you can pass a path to a configfile instead of
the user/pass combo. (e.g. /var/tmp/tmp.conf)
Configfile-Format:
%config= (
(All settings optional) Examples: Get get <name> state
returns the state of the socket(s) Example: get coffeemaker_and_light => on or off set <name> <value>
where value is one of:on offExamples: set coffeemaker_and_light on TellStick
Define define <name> TellStick </path/to/tdtool>
Defines a path to the program "tdtool", which is used to control a (locally attached)
"Telldus TellStick [Duo]" USB device. A TellStick controls a wide range of 433 MHz
devices, like the widely available switchable power outlets from InterTechno. To keep things simple, FHEM interfaces with the telldus-core suite (available for Linux, Windows, Mac OSX) via the supplied tool, "tdtool". This FHEM module will initially use "tdtool --list" to receive a list of configured devices, then let autocreate (if enabled) create them as SIS_PMS devices. Please make sure that the user running FHEM under ("fhem" in a standard setup on Linux) has the r/w-right to access the stick's device ("/dev/tellstick" in telldus-core version 2.0) — if the state of your devices do not change when modified im FHEM, access rights problems are the most probable cause ( chmod o+rw /dev/tellstick should fix that; you may want to automate it
via udev or adding the fhem user to the proper group ;))This module has only been tested with the 2.0 branch of teldus-core because of a known bug in 2.1, preventing version 2.1 working properly with some TellSticks and/or "tdtool" application; FTR, the "Batch: 8" version a was granted usage of for writing this module was impacted by it ... To actually control any power sockets, you need to define a SIS_PMS device — TellStick.pm uses SIS_PMS devices ("socket" is te:ll:st:ck:01, "socketnr" is the ID of the device in "tdtool"), as as of now only on/off switching is supported and this was the easiest implementation path. SIS_PMS is supported by andFHEM, the Android frontend, so this make some sense. (Furthermore, I don't own dimmable devices and they are actually not really cheap; >15 EUR/socket compared to the 15 EUR for 5 switch-only, non-self learning socket adapters from Intertechno at your local home improvement store.) Example: define TStick TellStick /usr/bin/tdtool define Deckenfluter SIS_PMS te:ll:st:ck:01 2 Set
Get
Attributes IPWEDefine define <name> IPWE <hostname> [<delay>]
Define a IPWE network attached weather data receiver device sold by ELV. Details see here. It's intended to receive the same sensors as WS300 (8 T/H-Sensors and one kombi sensor), but can be accessed via http and telnet. For unknown reason, my try to use the telnet interface was not working neither with raw sockets nor with Net::Telnet module. Therefore i choosed here the "easy" way to simple readout the http page and extract all data from the offered table. For this reason this module doesnt contain any option to configure this device. Note: You should give your sensors a name within the web interface, once they a received the first time. To extract a single sensor simply match for this name or sensor id Attributes: Example: define ipwe IPWE ipwe1 120 attr ipwe delay 600 : 10min between readouts
Get get <name> status
Gets actual data from device for sensors with data get <name> <sensorname>
will grep output from device for this sensorname ITACH_RELAY
Define define <name> ITACH_RELAY <ip-address> <port>
Defines an Global Cache iTach Relay device (Box with 3 relays) via its ip address. Examples: define motor1 ITACH_RELAY 192.168.8.200 1 Set set <name> <value>
where value is one of:off on toggleExamples: set motor1 on Notes: USBWX
This module was tested with ELV S300TH, ELV ASH2200, ELV KS300, Conrad S555TH and Conrad KS555. Readings and STATE of temperature/humidity sensors are compatible with the CUL_WS module. For KS300/KS555 sensors STATE is compatible with the KS300 module. The module is integrated into autocreate to generate the appropriate filelogs and weblinks automatically. Note: this module requires the Device::SerialPort or Win32::SerialPort module if the devices is connected via USB or a serial port. Define define <name> USBWX <serial device>
Defines USB-WDE1 attached via usb. define <name> USBWX <code> [corr1...corr4] <code> is the code which must be set on the sensor. Valid values are 1 through 8. 9 is used as the sensor id of the ks300 sensor. corr1..corr4 are up to 4 numerical correction factors, which will be added to the respective value to calibrate the device. Note: rain-values will be multiplied and not added to the correction factor. Example: define USBWDE1 USBWX /dev/ttyUSB0 define USBWX_1 USBWX 1 define USBWX_livingroom USBWX 2 define USBWX_ks300 USBWX 9Set
Get
Attributes TCM
As the TCM120 and the TCM310 speak completely different protocols, this module implements 2 drivers in one. It is the "physical" part for the EnOcean module. Define define <name> TCM [120|310] <device> First you have to specify the type of the EnOcean Transceiver Chip , i.e either 120 for the TCM120 or 310 for the TCM310. device can take the same parameters (@baudrate, @directio,
TCP/IP, none) like the CUL, but you probably have
to specify the baudrate: the TCM120 should be opened with 9600 Baud, the
TCM310 with 57600 baud.
Example:
define BscBor TCM 120 /dev/ttyACM0@9600 Set TRX
TRX_SECURITY
Define define <name> TRX_SECURITY <type> <deviceid> <devicelog> [<deviceid> <devicelog>] <type>
<deviceid>
<devicelog>
<deviceid2>
<devicelog2>
<deviceid2> .
Example: define livingroom_window TRX_SECURITY ds10a 72cd Window
define motion_sensor1 TRX_SECURITY ms10a 55c6 motion
define smoke_sensor1 TRX_SECURITY sd90 54d3 Smoke 54d3 Smoketest
Set
Get
Attributes TRX_LIGHT
You need to define an RFXtrx433 transceiver receiver first. See TRX. Define define <name> TRX_LIGHT <type> <deviceid> <devicelog> [<deviceid> <devicelog>] <type>
X10 lighting devices: <deviceid>
A lighting device normally has a house code A..P followed by a unitcode 1..16 (example "B1"). For AC, HomeEasy EU and ANSLUT it is a 10 Character-Hex-String for the deviceid, consisting of - unid-id: 8-Char-Hex: 00000001 to 03FFFFFF - unit-code: 2-Char-Hex: 01 to 10 <devicelog>
<deviceid2>
<devicelog2>
<deviceid2> .
Example: define motion_sensor2 TRX_LIGHT MS14A A1 motion A2 light
define Steckdose TRX_LIGHT ARC G2 light
define light TRX_LIGHT AC 0101010101 light
Set set <name> <value> [<levelnum>]
where value is one of:off on dim # only for X10, KOPPLA bright # only for X10, KOPPLA all_off # only for X10, ARC, EMW200, AC, HOMEEASY, ANSLUT all_on # only for X10, ARC, EMW200, AC, HOMEEASY, ANSLUT chime # only for ARC level <levelnum> # only AC, HOMEEASY, ANSLUT: set level to <levelnum> (range: 0=0% to 15=100%)Example: set Steckdose on
Get
Attributes TRX_WEATHER
Define define <name> OREGON <deviceid> <deviceid> is the device identifier of the Oregon sensor. It consists of the sensors name and (only if the attribute longids is set of the RFXtrx433) an a one byte hex string (00-ff) that identifies the sensor. If an sensor uses an switch to set an additional is then this is also added. The define statement with the deviceid is generated automatically by autocreate. The following sensor names are used: "THR128" (for THR128/138, THC138), "THGR132N" (for THC238/268,THN132,THWR288,THRN122,THN122,AW129/131), "THWR800", "RTHN318", "TX3_T" (for LaCrosse TX3, TX4, TX17), "THGR228N" (for THGN122/123, THGN132, THGR122/228/238/268), "THGR810", "RTGR328", "THGR328", "WTGR800_T" (for temperature of WTGR800), "THGR918" (for THGR918, THGRN228, THGN500), "TFATS34C" (for TFA TS34C), "BTHR918", "BTHR918N (for BTHR918N, BTHR968), "RGR918" (for RGR126/682/918), "PCR800", "TFA_RAIN" (for TFA rain sensor), "WTGR800_A" (for wind sensor of WTGR800), "WGR800" (for wind sensor of WGR800), "WGR918" (for wind sensor of STR918 and WGR918), "TFA_WIND" (for TFA wind sensor) Example: define Tempsensor TRX_WEATHER TX3_T define Tempsensor3 TRX_WEATHER THR128_3 define Windsensor TRX_WEATHER WGR918_A define Regensensor TRX_WEATHER RGR918 Set
Get
Attributes TUL
define <name> TUL <device> <physical address> TUL usb stick / TPUART serial devices:
You can also specify a baudrate if the device name contains the @ character, e.g.: /dev/ttyACM0@19200 Note: For TUL usb stick the baudrate 19200 is needed and this is the default when no baudrate is given. Example: define tul TUL tul:/dev/ttyACM0 1.1.249
Example: define tul TUL eibd:localhost 1.1.249
If the device is called none, then no device will be opened, so you can experiment without hardware attached. The physical address is used as the source address of telegrams sent to EIB network. Set weblink
define <name> weblink [link|fileplot|image|iframe|htmlCode]
<argument>
This is a placeholder used with webpgm2 to be able to integrate links into it, and to be able to put more than one gnuplot/SVG picture on one page. It has no set or get methods. Examples: define homepage weblink link http://www.fhem.de define webcam_picture weblink image http://w.x.y.z/current.jpg define interactive_webcam weblink iframe http://w.x.y.z/webcam.cgi define hr weblink htmlCode <hr> define w_Frlink weblink htmlCode { WeatherAsHtml("w_Frankfurt") } define MyPlot weblink fileplot <logdevice>:<gnuplot-file>:<logfile> Notes:
Get
Attributes FHEM2FHEM
Define define <name> FHEM2FHEM <host:portnr> [LOG:regexp|RAW:devicename] {portpassword}
Connect to the remote fhem on host. portnr is the global port attribute of the remote fhem. The next parameter specifies the connection type: Examples: define ds1 FHEM2FHEM 192.168.0.1:7072 LOG:.* define ds2 FHEM2FHEM 192.168.0.1:7072 RAW:CUL Set
Get
Attributes FHEMWEB
Define define <name> FHEMWEB <tcp-portnr> [global]
Enable the webfrontend on port <tcp-portnr>. If global is specified, then requests from all interfaces (not only localhost / 127.0.0.1) are serviced. To enable listening on IPV6 see the comments here. Feature: http://host:port/fhem/icons/<devicename> will return the icon associated with the current status of <devicename>. Set
Get
Attributes FLOORPLAN
Step-by-step setup guides are available in english and german. Define define <name> FLOORPLAN
Hint: Store fp_<name>.png in your modpath folder (FHEM) to use it as background picture. Example:
define Groundfloor FLOORPLAN Set Get Attributes attr Groundfloor fp_default 1 attr Groundfloor fp_noMenu 1 attr Groundfloor commandfield 1 at
Define define <name> at <timespec> <command> <timespec> format: [+][*{N}]<timedet>
+ indicates that the specification is
relative(i.e. it will be added to the current time).The optional * indicates that the command should be
executed repeatedly.The optional {N} after the * indicates,that the command
should be repeated N-times only.<timedet> is either HH:MM, HH:MM:SS or {perlfunc()}, where perlfunc must return a HH:MM or HH:MM:SS date. Examples: # absolute ones: define a1 at 17:00:00 set lamp on # fhem command define a2 at 17:00:00 { Log 1, "Teatime" } # Perl command define a3 at 17:00:00 "/bin/echo "Teatime" > /dev/console" # shell command define a4 at *17:00:00 set lamp on # every day # relative ones define a5 at +00:00:10 set lamp on # switch on in 10 seconds define a6 at +00:00:02 set lamp on-for-timer 1 # Blink once in 2 seconds define a7 at +*{3}00:00:02 set lamp on-for-timer 1 # Blink 3 times # Blink 3 times if the piri sends a command define n1 notify piri:on.* define a8 at +*{3}00:00:02 set lamp on-for-timer 1 # Switch the lamp on from sunset to 11 PM define a9 at +*{sunset_rel()} set lamp on define a10 at *23:00:00 set lamp off # More elegant version, works for sunset > 23:00 too define a11 at +*{sunset_rel()} set lamp on-till 23:00 # Only do this on weekend define a12 at +*{sunset_rel()} { fhem("set lamp on-till 23:00") if($we) } # Switch lamp1 and lamp2 on from 7:00 till 10 minutes after sunrise define a13 at *07:00 set lamp1,lamp2 on-till {sunrise(+600)} # Switch the lamp off 2 minutes after sunrise each day define a14 at +{sunrise(+120)} set lamp on # Switch lamp1 on at sunset, not before 18:00 and not after 21:00 define a15 at *{sunset(0,"18:00","21:00")} set lamp1 onNotes: Set
Get
Attributes autocreate
Define define <name> autocreate
Note 1: devices will be created with a unique name, which contains the type and a unique id for this type. When renaming the device, the automatically created filelog and weblink devices will also be renamed. Note 2: you can disable the automatic creation by setting the disable attribute, in this case only the rename hook is active, and you can use the createlog command to add FileLog and weblink to an already defined device. Example: define autocreate autocreate attr autocreate autosave attr autocreate device_room %TYPE attr autocreate filelog test2/log/%NAME-%Y.log attr autocreate weblink attr autocreate weblink_room PlotsSet
Get
Attributes createlog
This command is part of the autocreate module. usb
usb scan Note that switching a CUL to HomeMatic mode is still has to be done manually. On Linux it will also check with the lsusb command, if unflashed CULs are attached. If this is the case, it will call CULflash with the appropriate parameters (or display the CULflash command if scan is specified). Only one device to flash is displayed at a time. This command is part of the autocreate module. average
Define define <name> average <regexp>
If it matches, and the event is of the form "eventname number", then this module computes the daily and monthly average, and generates an event of the form
The current average and the cumulated values are stored in the device readings. Example: # Compute the average for the temperature events of the ws1 device define avg_temp_ws1 average ws1:temperature.* # Compute the average for each temperature event define avg_temp_ws1 average .*:temperature.* # Compute the average for all temperature and humidity events # Events: # ws1 temperature: 22.3 # ws1 humidity: 67.4 define avg_temp_ws1 average .*:(temperature|humidity).* # Hunt only for the humidity: take the value from the first # parenthesis ($1 in perl regexp) if it is a number # Event: ws1 T: 52.3 H: 67.4 define avg_temp_ws1 average ws1:.*H:.([-\d\.]+)Set
Get
Attributes Generated events: dewpoint
define <name> dewpoint dewpoint <devicename-regex> [<temp_name> <hum_name> <new_name>]
If <temp_name> is T then use temperature from state T: H:, add <new_name> to the state. Example: # Compute the dewpoint for the temperature/humidity # events of the temp1 device and generate reading dewpoint. define dew_temp1 dewpoint dewpoint temp1 define dew_temp1 dewpoint dewpoint temp1 temperature humidity dewpoint # Compute the dewpoint for the temperature/humidity # events of all devices offering temperature and humidity # and generate reading dewpoint. define dew_all dewpoint dewpoint .* define dew_all dewpoint dewpoint .* temperature humidity dewpoint # Compute the dewpoint for the temperature/humidity # events of the device Aussen_1 offering temperature and humidity # and insert is into STATE. define dew_state dewpoint dewpoint Aussen_1 T H D # Compute the dewpoint for the temperature/humidity # events of all devices offering temperature and humidity # and insert the result into the STATE. # Example STATE: "T: 10 H: 62.5" will change to # "T: 10 H: 62.5 D: 3.2" define dew_state dewpoint dewpoint .* T H D define <name> dewpoint fan <devicename-regex> <devicename-outside> <min-temp>
Example: # Generate event "fan: on" when dewpoint of Aussen_1 is first # time lower than Keller_Raum1 and outside temperature is >= 0 # and change it to "fan: off" is this condition changes. define dew_fan1 dewpoint fan Keller_Raum1 Aussen_1 0 define <name> dewpoint alarm <devicename-regex> <devicename-reference> <diff-temp>
Example: # Using a wall temperature sensor (wallsensor) and a temp/hum sensor # (roomsensor) to alarm if the temperature of the wall is lower than # the dewpoint of the air. In this case the water of the air will # condense on the wall because the wall is cold. define dew_alarm1 dewpoint alarm roomsensor wallsensor 0 # If you do not have a temperature sensor in/on the wall, you may also # compare the rooms dewpoint to the temperature of the same or another # inside sensor. Alarm is temperature is 5 degrees colder than the # inside dewpointinside. define dev_alarm2 dewpoint alarm roomsensor roomsensor 5Set
Get
Attributes holiday
define <name> holiday
Define a set of holidays. The module will try to open the file <name>.holiday in the modpath/FHEM directory. If entries in the holiday file match the current day, then the STATE of this holiday instance displayed in the list command will be set to the corresponding values, else the state is set to the text none. Most probably you'll want to query this value in some perl script: see Value() in the perl section or the global attribute holiday2we. The file will be reread once every night, to compute the value for the current day, and by each get command (see below). Holiday file definition: The file may contain comments (beginning with #) or empty lines. Significant lines begin with a number (type) and contain some space separated words, depending on the type. The different types are: Set
Get get <name> <MM-DD> get <name> yesterday get <name> today get <name> tomorrow Return the holiday name of the specified date or the text none. Attributes
notifyDefine define <name> notify <pattern> <command>
Execute a command when received an event for the definition <pattern> . If
<command> is enclosed in {}, then it is a perl expression, if it is
enclosed in "", then it is a shell command, else it is a "plain" fhem.pl
command (chain). See the trigger command for
testing it.
Examples:
define b3lampV1 notify btn3 set lamp % define b3lampV2 notify btn3 { fhem "set lamp %" } define b3lampV3 notify btn3 "/usr/local/bin/setlamp "%"" define b3lampV3 notify btn3 set lamp1 %;;set lamp2 % define wzMessLg notify wz:measured.* "/usr/local/bin/logfht @ "%"" define LogUndef notify global:UNDEFINED.* "send-me-mail.sh "%"" Notes: Set
Get
Attributes sequenceDefine define <name> sequence <re1> <timeout1> <re2> [<timeout2> <re3> ...]
A sequence is used to allow to trigger events for a certain combination of button presses on a remote. E.g. to switch on a lamp when pressing the Btn1:on, then Btn2:off and at last Btn1:on one after the other you could define the following:
define lampseq sequence Btn1:on 0.5 Btn2:off 0.5 Btn1:on
Set
Get
Attributes structureDefine define <name> structure <struct_type> <dev1> <dev2> ...
The structure device is used to organize/structure a devices in order to set groups of them at once (e.g. switching everything off in a house). The list of attached devices can be modified through the addstruct / delstruct commands. Each attached device will get the attribute <struct_type>=<name> when it is added to the list, and the attribute will be deleted if the device is deleted from the structure. Exception to this are the attributes room and alias. The structure devices can also be added to a structure, e.g. you can have a building consisting of levels which consists of rooms of devices. Example: Set
Get
Attributes watchdogDefine define <name> watchdog <regexp1> <timespec> <regexp2> <command> Start an arbitrary fhem.pl command if after <timespec> receiving an event matching <regexp1> no event matching <regexp2> is received. The syntax for <regexp1> and <regexp2> is the same as the regexp for notify. <timespec> is HH:MM[:SS] <command> is a usual fhem command like used int the at or notify Examples: # Talk to the FHT80 if we do not receive any message for 15 Minutes define w watchdog FHT80 00:15:00 SAME set FHT80 time # Shout if the HMS100-FIT is not alive define w watchdog HMS100-FIT 01:00:00 SAME "alarm-fit.sh" # Send mail if the window is left open define w watchdog contact1:open 00:15 contact1:closed "mail_me close window1" attr w regexp1WontReactivateNotes: Set
Get
Attributes DbLogDefine define <name> DbLog <configfilename> <regexp>
Log events to a database. The database connection is defined in <configfilename> (see sample configuration file
db.conf ). The configuration is stored in a separate file
to avoid storing the password in the main configuration file and to have it
visible in the output of the list command.
You must have 93_DbLog.pm in the FHEM subdirectory
to make this work. Additionally, the modules DBI and
DBD::<dbtype> need to be installed (use
cpan -i <module> if your distribution does not have it).
<regexp> is the same as in FileLog.
Sample code to create a MySQL database is in fhemdb_create.sql .
The database contains two tables: current and
history . The latter contains all events whereas the former only
contains the last event for any given reading and device.
The columns have the following meaning:
yes is translated to 1 .
The current values can be retrieved by means of the perl script fhemdb_get.pl . Its output is adapted to what a
Cacti data input method expects.
Call fhemdb_get.pl without parameters to see the usage
information.
Examples: # log everything to database define logdb DbLog /etc/fhem/db.conf .*:.*
Get
Attributes
FileLogYYYY:MM:DD_HH:MM:SS <device> <event>The regexp will be checked against the (complete!) device name or against the (complete!) devicename:event combination. <filename> may contain %-wildcards of the
POSIX strftime function of the underlying OS (see your strftime manual).
Common used wildcards are:
%L by the value of the global logdir attribute.Before using %V for ISO 8601 week numbers check if it is
correctly supported by your system (%V may not be replaced, replaced by an
empty string or by an incorrect ISO-8601 week number, especially
at the beginning of the year)
If you use %V you will also have to use %G
instead of %Y for the year!Examples: define lamplog FileLog %L/lamp.log lamp define wzlog FileLog /var/tmp/wz-%Y-%U.log
wz:(measured-temp|actuator).* With ISO 8601 week numbers, if supported: define wzlog FileLog /var/tmp/wz-%G-%V.log
wz:(measured-temp|actuator).* Set set <name> reopen Used to reopen a FileLog after making some manual changes to the logfile. Get get <name> <infile> <outfile> <from>
<to> <column_spec>
Read data from the logfile, used by frontends to plot data without direct access to the file. Example: get outlog out-2008.log - 2008-01-01 2008-01-08 4:IR:int: 9:IR:: Attributes dummy
Define define <name> dummy
Example: define myvar dummy set myvar 7 Set set <name> <value> Set any value. Get
Attributes SUNRISE_EL
sunrise, sunset, sunrise_rel, sunset_rel sunrise_abs, sunset_abs isdayperl functions, to be used in at or FS20 on-till commands. First you should set the longitude and latitude global attributes to the exact longitude and latitude values (see e.g. maps.google.com for the exact values, which should be in the form of a floating point value). The default value is Frankfurt am Main, Germany. The default altitude ($altit in SUNRISE_EL.pm) defines the sunrise/sunset for Civil twilight (i.e. one can no longer read outside without artificial illumination), which differs from sunrise/sunset times found on different websites. See perldoc "DateTime::Event::Sunrise" for alternatives. sunrise()/sunset() returns the absolute time of the next sunrise/sunset, adding 24 hours if the next event is tomorrow, to use it in the timespec of an at device or for the on-till command for FS20 devices. sunrise_rel()/sunset_rel() returns the relative time to the next sunrise/sunset. sunrise_abs()/sunset_abs() return the absolute time of the corresponding event today (no 24 hours added). All functions take up to three arguments: isday() can be used in some notify or at commands to check if the sun is up or down. Define
Set
Get
Attributes Note: these are global attributes, e.g.
attr global longitude 8.686 FHEMRENDERER
Define define <name> FHEMRENDERER [global]
This defines a new "device", that is of type FHEMRENDERER. The option 'global' can be used if needed for sorting reasons. Otherwise this option has no real meaning for FHEMRENDERER. As a side-effect of defining this "device" the following attributes will be set for this "device": plotmode gnuplot plotsize 800,200 refresh 00:10:00 room Unsorted status off tmpfile /tmp/ multiprocess off NOTE: The Logfile will report (with LogLevel 2) that the FHEMRENDERER has been defined. Set set <name> <value> Set either on or off. This switches the timer-based rendering on/off. The attribute 'status' will be modified accordingly. NOTE: only WebLink based graphics will be rendered. Get get <name> <[[file-name] device type logfile [pos=zoom=XX&off=YY]]> The get function supports different sets of arguments: Arguments: NONE: all WebLink based FilePlots will be rerendered The resulting filename will be ' THREE: device type logfile In this case only one specific graphic will be rendered: A graphic will be rendered for 'device', where device is a FileLog, based on the type 'type' based on the given 'logfile' The resulting filename will be 'attr-tmpfile logfile.png' FOUR: file-name device type logfile In this case only one specific graphic will be rendered: A graphic will be rendered for 'device', where device is a FileLog, based on the type 'type' based on the given 'logfile' The resulting filename will be 'attr-tmpfile file-name.png' FIVE: file-name device type logfile pos=zoom=XX&off=YYY In this case only one specific graphic will be rendered assuming that plotmode is 'gnuplot-scroll': A graphic will be rendered for 'device', where device is a FileLog, based on the type 'type' based on the given 'logfile' The 'zoom' will be either qday/day/week/month/year (same as used in FHEMWEB). The offset 'off' is either 0 (then the second part can be omitted), or -1/-2.... to jump back in time. The resulting filename will be 'attr-tmpfile file-name.png' NOTE: If you want to use zoom AND offset then you have to concatenate via '&' !! NOTE: combinations are possible in limited ranges: meaning: you can add the 'pos=zoom=XX&off=YY' to any of the first three sets. This may e.g. result in rendering all WebLinks with a specific zoom or offset (if you just pass the 'pos=zoom=xx&off=yy' parameter); Any rendered image (one or all WebLinks) will be stored in 'attr-tmpfile' followed by a 'filename.png'. The filename will be either derived (from weblink-name or logfile-name) or, for single files, can be assigend. Attributes PachLog
Note: this module needs the HTTP::Request and LWP::UserAgent perl modules. Define define <name> PachLog <Pachube-API-Key> <Pachube-API-Key>: The Pachube-API-Key however is what you need in your code to authenticate your application's access the Pachube service. Don't share this with anyone: it's just like any other password. www.pachube.com Set Add a new Device for Logging to www.pachube.com set <NAME> ADD <FHEM-DEVICENAME> FEED-NR:ID:READING:ID:READING Example: KS300-Weather-Data READINGS: temperature humidity wind rain 1. Generate Input-Feed on www.pachube.com => Yout get your FEED-NR: 1234 2. Add Datastreams to the Feed:
set <NAME> ADD <My-KS300> 1234:0temperature:1:humidity:2:wind:3:rain Delete a Device form Logging to www.pachube.com set <NAME> DEL <FHEM-DEVICENAME> Get
Attributes dumpdefdumpdef <options>
Data::Dumper for FHEM-Devices/Hashes Dumps the content of <options> to FHEMWEB Options:
Example: dumpdef TEST CALLER => main: /opt/fhz/FHEM/01_FHEMWEB.pm LINE: 194 SUB: main::FW_AnswerCall SUB-NAME: main::Commanddumpdef DUMP-DEVICE: TEST $VAR1 = { 'IODev' => {}, 'NAME' => 'TEST', 'NR' => 64, 'STATE' => '???', 'TYPE' => 'dummy' }; DUMP-DEVICE-ATTR $VAR1 = { 'room' => 'DEF_DUMMY,GRP.TEST' }; Perl specialsIf you want to automate some tasks via fhem, then you'll probably use at or notify. For more complex tasks you'll use either a shell-script or a perl "oneliner" as the at/notify argument. This chapter gives some tips in using the perl oneliners.gnuplot file syntaxThe .gplot files are also used by the FHEMWEB/SVG module when the plotmode attribute is set to SVG. In this case only a subset of the .gnuplot attributes are used, and some lines have special meanings: the difference will be explained in this chapter. See also this fhemwiki entry on creating logs.Following is a minimal .gplot definition (valid only for plotmode SVG): set terminal size <SIZE> #FileLog 4::: plot title 'Temperature' with linesThe .gnuplot file consists of 3 parts: |