====== fhem ====== {{ ::heimautomatisierung-mit-fhem.pdf |}} [[fhem/CUL]] [[https://fhem.de]] Wiki: [[https://wiki.fhem.de/wiki]] PDF: [[https://fhem.de/Heimautomatisierung-mit-fhem.pdf]] [[http://www.meintechblog.de/2016/05/fhem-server-auf-dem-raspberry-pi-in-weniger-als-einer-stunde-einrichten/|Installation in <1 Stunde]] [[https://wiki.fhem.de/wiki/Trick_der_Woche|Trick der Woche]] ===== Sound ===== Sound spielen von der FHEM-Commandline: {\system (`mplayer /opt/fhem/sound/dogs/1.mp3`)} ===== Logdatei anlegen ===== define FileLog_[name] FileLog ./log/[name]R-%Y.log [GERAET] attr FileLog_[name] logtype text Dass Gerät kann man auch nachher genau bestimmen. Oben: set FileLog[blablabla] addREgexpPart [Dropdown] .* ===== E-Mail versenden ===== [[https://wiki.fhem.de/wiki/E-Mail_senden]] notify, wenn Klingel: Klingel_Haustuer:Longpress:.dingdong { system("/usr/bin/wget 'http://192.168.122.172:8080/zm/cgi-bin/nph-zms?mode=single&monitor=1&scale=100&user=fhem&pass=passwort' -q --output-document=/tmp/kamera.jpg") ;; DebianMail("not\@the.net","$NAME $EVENT","Bei $NAME ist etwas geschehen: $EVENT","/tmp/kamera.jpg");;fhem("set nt.Klingel inactive;set HUEDevice16 blink 3;sleep 10;set nt.Klingel active;") } ===== WhatsApp ===== **Yowsup** [[http://wiki.fhem.de/wiki/Yowsup]] Krieg ich nicht zum Laufen (wohl, weil WhatsApp das Protokoll ständig ändert und wg. Verschlüsselung etc.) ===== CFG ===== /opt/fhem/fhem.cfg attr global userattr cmdIcon devStateIcon devStateStyle icon sortby webCmd widgetOverride attr global autoload_undefined_devices 1 attr global logfile ./log/fhem-%Y-%m.log attr global modpath . attr global motd SecurityCheck:\ \ WEB,WEBphone,WEBtablet has no associated allowed device with basicAuth.\ telnetPort has no associated allowed device with password/globalpassword.\ \ Restart FHEM for a new check if the problem is fixed,\ or set the global attribute motd to none to supress this message.\ attr global statefile ./log/fhem.save attr global updateInBackground 1 attr global verbose 3 define telnetPort telnet 7072 global define WEB FHEMWEB 8083 global define WEBphone FHEMWEB 8084 global attr WEBphone stylesheetPrefix smallscreen define WEBtablet FHEMWEB 8085 global attr WEBtablet stylesheetPrefix touchpad # Fake FileLog entry, to access the fhem log from FHEMWEB define Logfile FileLog ./log/fhem-%Y-%m.log fakelog define autocreate autocreate attr autocreate filelog ./log/%NAME-%Y.log define eventTypes eventTypes ./log/eventTypes.txt # Disable this to avoid looking for new USB devices on startup define initialUsbCheck notify global:INITIALIZED usb create define HUEGroup0 HUEDevice group 0 IODev=HueBridgeWz attr HUEGroup0 IODev HueBridgeWz attr HUEGroup0 alias Lightset 0 attr HUEGroup0 color-icons 2 attr HUEGroup0 delayedUpdate 1 attr HUEGroup0 devStateIcon {(HUEDevice_devStateIcon($name),"toggle")} attr HUEGroup0 group HUEGroup attr HUEGroup0 room HUEDevice define lightify LIGHTIFY 192.168.122.86 attr lightify pollDevices 1 attr lightify room SZ_Gerald define LIGHTIFY555B0B0000261884 HUEDevice 555B0B0000261884 IODev=lightify attr LIGHTIFY555B0B0000261884 IODev lightify attr LIGHTIFY555B0B0000261884 alias Lightly Plug 1 attr LIGHTIFY555B0B0000261884 color-icons 2 attr LIGHTIFY555B0B0000261884 devStateIcon {(HUEDevice_devStateIcon($name),"toggle")} attr LIGHTIFY555B0B0000261884 room SZ_Gerald,LIGHTIFY attr LIGHTIFY555B0B0000261884 subType extcolordimmer attr LIGHTIFY555B0B0000261884 webCmd rgb:rgb ff0000:rgb DEFF26:rgb 0000ff:ct 490:ct 380:ct 270:ct 160:toggle:on:off define LIGHTIFYGroup0 HUEDevice group 0 IODev=lightify attr LIGHTIFYGroup0 IODev lightify attr LIGHTIFYGroup0 alias Gruppe alles attr LIGHTIFYGroup0 color-icons 2 attr LIGHTIFYGroup0 delayedUpdate 1 attr LIGHTIFYGroup0 devStateIcon {(HUEDevice_devStateIcon($name),"toggle")} attr LIGHTIFYGroup0 room LIGHTIFY attr LIGHTIFYGroup0 subType switch define LIGHTIFYGroup1 HUEDevice group 1 IODev=lightify attr LIGHTIFYGroup1 IODev lightify attr LIGHTIFYGroup1 alias Keller attr LIGHTIFYGroup1 color-icons 2 attr LIGHTIFYGroup1 delayedUpdate 1 attr LIGHTIFYGroup1 devStateIcon {(HUEDevice_devStateIcon($name),"toggle")} attr LIGHTIFYGroup1 room LIGHTIFY define hueBridge1 HUEBridge 192.168.122.65 attr hueBridge1 icon hue_filled_bridge_v2 attr hueBridge1 key nETEaULcjxW7sgydtgIwp4NZSSmm5YC-aPEAgoIv attr hueBridge1 room Wohnzimmer define hueBridge1_HUEDevice5 HUEDevice 5 IODev=hueBridge1 attr hueBridge1_HUEDevice5 IODev hueBridge1 attr hueBridge1_HUEDevice5 alias Tisch 1 attr hueBridge1_HUEDevice5 color-icons 2 attr hueBridge1_HUEDevice5 devStateIcon {(HUEDevice_devStateIcon($name),"toggle")} attr hueBridge1_HUEDevice5 icon hue_filled_white_and_color_e27_b22 attr hueBridge1_HUEDevice5 model LTW001 attr hueBridge1_HUEDevice5 room Esstisch,HUEDevice attr hueBridge1_HUEDevice5 subType ctdimmer attr hueBridge1_HUEDevice5 webCmd ct:ct 490:ct 380:ct 270:ct 160:toggle:on:off define hueBridge1_HUEDevice1 HUEDevice 1 IODev=hueBridge1 attr hueBridge1_HUEDevice1 IODev hueBridge1 attr hueBridge1_HUEDevice1 alias Decke attr hueBridge1_HUEDevice1 color-icons 2 attr hueBridge1_HUEDevice1 devStateIcon {(HUEDevice_devStateIcon($name),"toggle")} attr hueBridge1_HUEDevice1 icon hue_filled_white_and_color_e27_b22 attr hueBridge1_HUEDevice1 model LWB004 attr hueBridge1_HUEDevice1 room HUEDevice,Wohnzimmer attr hueBridge1_HUEDevice1 subType dimmer attr hueBridge1_HUEDevice1 webCmd pct:toggle:on:off define hueBridge1_HUEDevice6 HUEDevice 6 IODev=hueBridge1 attr hueBridge1_HUEDevice6 IODev hueBridge1 attr hueBridge1_HUEDevice6 alias Tisch 2 attr hueBridge1_HUEDevice6 color-icons 2 attr hueBridge1_HUEDevice6 devStateIcon {(HUEDevice_devStateIcon($name),"toggle")} attr hueBridge1_HUEDevice6 icon hue_filled_white_and_color_e27_b22 attr hueBridge1_HUEDevice6 model LTW001 attr hueBridge1_HUEDevice6 room Esstisch,HUEDevice attr hueBridge1_HUEDevice6 subType ctdimmer attr hueBridge1_HUEDevice6 webCmd ct:ct 490:ct 380:ct 270:ct 160:toggle:on:off define hueBridge1_HUEDevice2 HUEDevice 2 IODev=hueBridge1 attr hueBridge1_HUEDevice2 IODev hueBridge1 attr hueBridge1_HUEDevice2 alias Kugel attr hueBridge1_HUEDevice2 color-icons 2 attr hueBridge1_HUEDevice2 devStateIcon {(HUEDevice_devStateIcon($name),"toggle")} attr hueBridge1_HUEDevice2 icon hue_filled_white_and_color_e27_b22 attr hueBridge1_HUEDevice2 model LWB004 attr hueBridge1_HUEDevice2 room HUEDevice,Wohnzimmer attr hueBridge1_HUEDevice2 subType dimmer attr hueBridge1_HUEDevice2 webCmd pct:toggle:on:off define hueBridge1_HUEDevice4 HUEDevice 4 IODev=hueBridge1 attr hueBridge1_HUEDevice4 IODev hueBridge1 attr hueBridge1_HUEDevice4 alias Turm attr hueBridge1_HUEDevice4 color-icons 2 attr hueBridge1_HUEDevice4 devStateIcon {(HUEDevice_devStateIcon($name),"toggle")} attr hueBridge1_HUEDevice4 model Plug 01 attr hueBridge1_HUEDevice4 room HUEDevice attr hueBridge1_HUEDevice4 subType switch attr hueBridge1_HUEDevice4 webCmd toggle:on:off define hueBridge1_HUEGroup2 HUEDevice group 2 IODev=hueBridge1 attr hueBridge1_HUEGroup2 IODev hueBridge1 attr hueBridge1_HUEGroup2 alias Erdgeschoss attr hueBridge1_HUEGroup2 color-icons 2 attr hueBridge1_HUEGroup2 delayedUpdate 1 attr hueBridge1_HUEGroup2 devStateIcon {(HUEDevice_devStateIcon($name),"toggle")} attr hueBridge1_HUEGroup2 group HUEGroup attr hueBridge1_HUEGroup2 icon hue_room_living attr hueBridge1_HUEGroup2 room Esstisch,HUEDevice,Wohnzimmer define hueBridge1_HUEGroup3 HUEDevice group 3 IODev=hueBridge1 attr hueBridge1_HUEGroup3 IODev hueBridge1 attr hueBridge1_HUEGroup3 alias Esstisch attr hueBridge1_HUEGroup3 color-icons 2 attr hueBridge1_HUEGroup3 delayedUpdate 1 attr hueBridge1_HUEGroup3 devStateIcon {(HUEDevice_devStateIcon($name),"toggle")} attr hueBridge1_HUEGroup3 group HUEGroup attr hueBridge1_HUEGroup3 icon scene_dinner attr hueBridge1_HUEGroup3 room Esstisch,HUEDevice define hueBridge1_HUEGroup1 HUEDevice group 1 IODev=hueBridge1 attr hueBridge1_HUEGroup1 IODev hueBridge1 attr hueBridge1_HUEGroup1 alias Turmlampe attr hueBridge1_HUEGroup1 color-icons 2 attr hueBridge1_HUEGroup1 delayedUpdate 1 attr hueBridge1_HUEGroup1 devStateIcon {(HUEDevice_devStateIcon($name),"toggle")} attr hueBridge1_HUEGroup1 group HUEGroup attr hueBridge1_HUEGroup1 icon ampel_aus attr hueBridge1_HUEGroup1 room HUEDevice,Wohnzimmer define hueBridge1_HUEGroup0 HUEDevice group 0 IODev=hueBridge1 attr hueBridge1_HUEGroup0 IODev hueBridge1 attr hueBridge1_HUEGroup0 alias Lightset 0 attr hueBridge1_HUEGroup0 color-icons 2 attr hueBridge1_HUEGroup0 delayedUpdate 1 attr hueBridge1_HUEGroup0 devStateIcon {(HUEDevice_devStateIcon($name),"toggle")} attr hueBridge1_HUEGroup0 group HUEGroup attr hueBridge1_HUEGroup0 room HUEDevice define Wetter netatmo ACCOUNT crypt:0657435b785155481d595046 crypt:2957415f5d4516060501 58f380d2f75853c01c8c17d3 QBwKArPvkb73fjhMkv3MU6tcuTzd2 attr Wetter room Aussen,netatmo define netatmo_D70_ee_50_20_ed_86 netatmo 70:ee:50:20:ed:86 attr netatmo_D70_ee_50_20_ed_86 IODev Wetter attr netatmo_D70_ee_50_20_ed_86 alias Indoor attr netatmo_D70_ee_50_20_ed_86 devStateIcon .*:no-icon attr netatmo_D70_ee_50_20_ed_86 icon temp_inside attr netatmo_D70_ee_50_20_ed_86 room Aussen,SZ_Gerald,netatmo attr netatmo_D70_ee_50_20_ed_86 stateFormat T: temperature H: humidity define netatmo_M02_00_00_20_b4_d4 netatmo MODULE 70:ee:50:20:ed:86 02:00:00:20:b4:d4 attr netatmo_M02_00_00_20_b4_d4 IODev Wetter attr netatmo_M02_00_00_20_b4_d4 alias Gepi_aussen attr netatmo_M02_00_00_20_b4_d4 devStateIcon .*:no-icon attr netatmo_M02_00_00_20_b4_d4 icon temp_outside attr netatmo_M02_00_00_20_b4_d4 room Aussen,netatmo attr netatmo_M02_00_00_20_b4_d4 stateFormat T: temperature H: humidity define netatmo_M05_00_00_03_08_66 netatmo MODULE 70:ee:50:20:ed:86 05:00:00:03:08:66 attr netatmo_M05_00_00_03_08_66 IODev Wetter attr netatmo_M05_00_00_03_08_66 alias Gepi_Regen attr netatmo_M05_00_00_03_08_66 devStateIcon .*:no-icon .*:weather_rain attr netatmo_M05_00_00_03_08_66 icon weather_rain_gauge attr netatmo_M05_00_00_03_08_66 room Aussen,netatmo define HUEDevice8 HUEDevice 8 IODev=hueBridge1 attr HUEDevice8 IODev hueBridge1 attr HUEDevice8 alias Regallicht attr HUEDevice8 color-icons 2 attr HUEDevice8 devStateIcon {(HUEDevice_devStateIcon($name),"toggle")} attr HUEDevice8 icon hue_filled_lightstrip attr HUEDevice8 model LST001 attr HUEDevice8 room HUEDevice attr HUEDevice8 subType colordimmer attr HUEDevice8 webCmd hue:rgb:rgb ff0000:rgb 98FF23:rgb 0000ff:toggle:on:off define HUEDevice7 HUEDevice 7 IODev=hueBridge1 attr HUEDevice7 IODev hueBridge1 attr HUEDevice7 alias Küchenlicht attr HUEDevice7 color-icons 2 attr HUEDevice7 devStateIcon {(HUEDevice_devStateIcon($name),"toggle")} attr HUEDevice7 icon hue_filled_white_and_color_e27_b22 attr HUEDevice7 model LWB010 attr HUEDevice7 room HUEDevice attr HUEDevice7 subType dimmer attr HUEDevice7 webCmd pct:toggle:on:off define HUEGroup4 HUEDevice group 4 IODev=hueBridge1 attr HUEGroup4 IODev hueBridge1 attr HUEGroup4 alias Küche attr HUEGroup4 color-icons 2 attr HUEGroup4 delayedUpdate 1 attr HUEGroup4 devStateIcon {(HUEDevice_devStateIcon($name),"toggle")} attr HUEGroup4 group HUEGroup attr HUEGroup4 icon hue_room_kitchen attr HUEGroup4 room HUEDevice define CUL1 CUL /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0@38400 1234 attr CUL1 icon cul_cul attr CUL1 rfmode MAX define kschalter IT F000F0000F FF F0 attr kschalter IODev CUL1 attr kschalter model itswitch attr kschalter room Keller define keffekte IT F00000000F FF F0 attr keffekte IODev CUL1 attr keffekte model itswitch attr keffekte room Keller define rollo IT 000000000F FF F0 attr rollo IODev CUL1 attr rollo devStateIcon hoch:fts_shutter_10@yellow runter:fts_shutter_100@green attr rollo eventMap on:runter off:hoch attr rollo model itswitch attr rollo room SZ_Gerald define licht IT 0000F0000F FF F0 attr licht IODev CUL1 attr licht model itswitch attr licht room SZ_Gerald define FritzBox_main FRITZBOX 192.168.122.1 attr FritzBox_main allowTR064Command 1 attr FritzBox_main icon it_router define FritzBox_intern FRITZBOX 192.168.122.2 attr FritzBox_intern allowTR064Command 1 attr FritzBox_intern icon it_router define TV_55 LGTV_WebOS 192.168.122.52 attr TV_55 devStateIcon on:10px-kreis-gruen:off off:10px-kreis-rot:on attr TV_55 room Keller define fast_runter dummy attr fast_runter room SZ_Gerald attr fast_runter webCmd on:off define rollo_fast_runter notify CUL1:.*|fast_runter:on set CUL1 ITClock ====== fhem-Befehl in der Bash aufrufen ====== [[http://s6z.de/cms/index.php/homeautomation/fhem/34-fhem-befehle-auf-der-shell-ausfuehren]] Nach dem Umstieg auf Raspberry Pi habe ich festgestellt, dass der Aufruf perl fhem.pl "" ohne Probleme funktioniert. Eine Passtowrtangabe ist bei lokalen Aufrufen nicht nötig, wenn das Password in fhem.cfg mit globalpassword (anstatt password) angegeben wird. ... define tPort telnet 7072 global attr tPort globalpassword ... ====== DoorPi & FHEM ====== [[https://wiki.fhem.de/wiki/DoorPi_und_FHEM]] [[https://www.doorpi.org/forum/|DoorPi]] ist eine Software, die die Türklingel ergänzen soll. Ziel des Projektes DoorPi ist die Steuerung einer Türsprechanlage mittels einem Einplatiniencomputer wie dem Raspberry Pi und dem Kommunikationsprotokoll VoIP. DoorPi ist ein Event-Action basierendes System. Es gibt Komponenten, die Events auslösen, und Komponenten, die aufgrund dieser Events reagieren. Dazu sollen Ereignisse (Events) wie “Drücken einer Türklingel” oder “RFID Chip xyz vorgehalten” die Auslöser von Aktionen (Actions) wie “Anruf bei Telefon xyz”, “E-Mail an xxx” oder “Öffne Tür” sein. ====== Telegram ====== DefaultPeer muss ohne führendes @ angegeben werden Mit der API kann keine Verbindung mit dem T-Server aufgenommen werden, weil die SSL-Version veraltet ist0