First steps in FHEM: Unterschied zwischen den Versionen

Aus FHEMWiki
K (→‎Creating device - define: Rohmaterial geladen)
(→‎Creating device - define: next chapter translated)
Zeile 38: Zeile 38:


== Creating device - define  ==
== Creating device - define  ==
<!--
The main component type in FHEM is called a ''device''.Typical devices are e.g. remote controlled outlets, roller shutter motors, temperature sensors, solenoid valves etc.


Das Grundgerüst von FHEM sind "devices". Typische Devices sind beispielsweise Funksteckdosen, Rolladenmotoren, Temperaturmessgeräte, Magnetventile usw. Aber andere Dinge, die man auf den ersten Blick nicht als physisches Gerät bezeichnen würde, sind Device: So etwa ist die Benutzeroberfläche von FHEM selbst ein device ("FHEMWEB"), ebenso gibt es Devices ohne physische Geräte, die dazu benutzt werden können, um eine Variable zu speichern. Ein sehr einfaches Device, dummy genannt, legen wir jetzt an.
But there are other kinds of devices too, where at first view you wouldn't expect it: FHEM's user interface (''"FHEMWEB"'') is a device, there are devices without a physical equipment used to store a variable's value.  


Das dummy devices ist insofern ein besonderes Objekt, weil es nicht unbedingt ein korrespondierendes physisches Gerät (eine physische Lampe, ein Rolladen, ein Magnetventil) benötigt. So können Sie diese Schritte auch ohne ein Hardware-System durchführen bzw. kann hier eine allgemeine Einführung erfolgen, ohne auf die Unterschiede der einzelnen Hardwaresysteme einzugehen. Ein Dummy-Device sieht auf der FHEM-Oberfläche im Allgemeinen genau so aus, wie ein FHEM-Device zu einem physisch vorhandenen Gerät Ihres Hardwaresystems.
We will now create a very simple device, called ''dummy''.


Zunächst legen wir einen Schalter an. Dieser soll einen Lichtschalter an der Wand simulieren. Geben Sie dazu folgenden Befehl in das Kommandofeld ein:
A device of type ''dummy'' is a special object, inasmuch as it nonessential needs corresponding physical equipment (physical lamp, roller shutter, solenoid valve). So we can proceed in this guide without a real hardware system, or rather we don't need to concider differences between differrent hardware. A dummy device is generally represented on FHEM's user interface like a FHEM device with a physical equivalent.
 
Lets begin with a switch. It is designed to simulate a light switch on the wall. Please, enter command in command field:
  define mySwitch1 dummy
  define mySwitch1 dummy
"define" ist der FHEM-Befehl, "mySwitch1" der zukünftige Name des devices und "dummy" bezeichnet den Typ. Die Worte define und dummy gehören zur Befehlssyntax von FHEM und können nicht verändert werden, mySwitch1 ist (mehr oder weniger) frei wählbar. Nach drücken der {{Taste|Enter}}-Taste wird die Detail-Ansicht des neuen FHEM-Device ''mySwitch1'' angezeigt.
 
"define" is the needed FHEM command, "mySwitch1" the future name of our device, "dummy" describes its type. Words "define" and "dummy" are part of FHEM'S command syntax and are unalterable, "mySwitch1" is (more or less) arbitrary. After pressing button {{Taste|Enter}} detail view of our new FHEM device ''mySwitch1'' appears.


[[Datei:ErsteSchritteInFhem03.png|border]]
[[Datei:ErsteSchritteInFhem03.png|border]]


{{Hinweis|Jedes Device hat genau einen "Typ". Dieser Typ legt gleichzeitig die Perl-Befehlsdatei (man spricht präziser vom "Modul") fest, in der bestimmte Routinen und Eigenschaften festgehalten sind. Ist etwa ein Device vom Typ dummy, so weiß FHEM, dass die Routinen und Eigenschaften im Modul 98_dummy.pm liegen. (Die Zahl 98 hatte früher eine Bedeutung, heute ist das nicht mehr der Fall, aus historischen Gründen wird sie aber immer noch verwendet.)}}
{{Hinweis|Each device is of exactly one "type". This type determines Perl program file (more precisly called: "module"), with certain routines and properties coded. Since our device is of type ''dummy'', FHEM can find routines and properties in module 98_dummy.pm. (Figure ''98'' formerly bore a meaning, now it doesn't no longer - for historical reason it is further used.)}}


Devices haben einen "Zustand", der sich im Zeitablauf ändert und den FHEM registriert. So ist beispielsweise ein Fenster offen, ein Rolladenpanzer geschlossen und eine Funksteckdose hat Spannung. Ein Zustand muss dabei nicht exakt eine Variable beinhalten (Fenster entweder "offen" oder "geschlossen"), ein Zustand kann auch durch mehrere Variablen beschrieben werden (der Zustand eines Raspberry-Systems, device-type sysmon, umfasst beispielsweise die CPU-Frequenz, die CPU-Temperatur, den load und vieles mehr).  
Devices have a "state", changing in time and recorded by FHEM. E.g., some window is open, a shutter is closed, an outlet is under voltage. A state not necessary consists of exactly one value (window: "open" or "closed"), state can be described by a bunch of values (state of a Raspberry system - device type ''sysmon'' - contains CPU frequency, CPU temperature, load and much more).


Dieser Zustand wird in FHEM durch insgesamt drei Größen erfasst. Diese Größen heißen Internals, Attribute und Readings. Es wäre jetzt zu früh, auf die Bedeutung der drei Begriffe im Detail einzugehen, aber folgende Anmerkungen sind für die nachfolgenden Schritte wichtig:
Device status in FHEM consists of overall three blocks of values, called ''Internals'', ''Attributes'' and ''Readings''. It's early days yet to discuss in-depth meaning of these terms, but some remarks are important for our next steps:
*''Internals'' enthalten ganz grundlegende Informationen zu dem device. Sie werden vom Nutzer in den seltensten Fällen direkt bearbeitet (meist nur bei der Einrichtung des devices).
* ''Internals'' store very basic informationen about a device. Only in rare cases users will edit directly internals (mostly during define step).
*''Attribute'' sollen das Verhalten des devices steuern. Sie können vom Anwender typischerweise verändert (oder erst angelegt) werden.  
* ''Attributs'' control device behavior. Typically they can be changed (or even defined) by users.
*''Readings'' besitzen im Gegensatz zu den beiden anderen Größen einen Zeitstempel. Hier werden üblicherweise Messwerte des Gerätes erfasst.  
* ''Readings'' have in contrast to the values of the other two blocks a timestamp. Usually they are measured values of your device.


Verwirrend für einen Anfänger kann sein, dass manchmal Internals wie auch Readings mit gleichem Namen (STATE und state) existieren können. Allerdings unterscheidet Perl zwischen Groß- und Kleinschreibung!
It may be confusing for beginners that there can be Internals and Readings of equal names (e.g. STATE and state). Though Perl distinguishes lower and upper case.


{{Hinweis|Der Block '''''Internals''''' zeigt immer die grundlegende Ausprägung eines FHEM-device an:
{{Hinweis|Block '''''Internals''''' always shows basic characteristics of a FHEM device:
*'''''NAME''''' ist der von Ihnen vergebene Name.
*'''''NAME:''''' device name assigned by the user
*'''''TYPE''''' ist der Typ des FHEM-device, hier dummy.
*'''''TYPE:''''' device type of FHEM device, here: ''dummy''
*'''''STATE''''' ist der in allen Übersichten angezeigte Status des Geräts. Da noch keine Zuordnung stattgefunden hat, ist dieser zunächst '''''???'''''.}}
*'''''STATE:''''' device state shown in all summaries. Since there was no assignment till now it is initially '''''???'''''.}}
-->


== Creating rooms ==
== Creating rooms ==

Version vom 13. Juni 2017, 14:58 Uhr


Clock - Under Construction.svg An dieser Seite wird momentan noch gearbeitet.




Hier entsteht die englische Fassung von Erste Schritte in FHEM...

  • Letzte Änderung der dt. Fassung: 17.05.2020
  • Letzte Änderung der engl. Fassung: 13.06.2017
  • Neuere Version ist: dt. Version


This a beginners course for those starting to work with FHEM. After you have installed FHEM on your server you may reproduce all steps without any additional smart home hardware.

This guide was primarily published by Ulrich Maass who permitted the use in FHEM wiki.

Note to editors: Everybody is called to improve orthography, grammar and style. Content changes and extentions should be discussed with the author (e. g. on associated discussion page).

First attempt

To start FHEM first time enter in your browsers address field:

http://<ip-address>:8083

e. g. http://192.168.1.1:8083.

So you get FHEM homepage:

ErsteSchritteInFhem01.png

  • At the head you can discover a white command line, where you may type in commands.
  • As a first menu entry you can see button Save config, that is intended to store configuration changes beyond a FHEM restart.
  • Beside this there are already rooms Unsorted and Everything, we will get to know later on.
  • More links are collected in a lower group, we will discuss later on too.

Advice Security Check indicates that there is no FHEM password. Ho to configure a password protection you can see at FHEM command reference commandref, where you by the way may find a description of all FHEM functions and modules. To suppress this message as a start enter in command line:

attr global motd none

and confirm this change pressing Enter-button.

ErsteSchritteInFhem02.png

Creating device - define

The main component type in FHEM is called a device.Typical devices are e.g. remote controlled outlets, roller shutter motors, temperature sensors, solenoid valves etc.

But there are other kinds of devices too, where at first view you wouldn't expect it: FHEM's user interface ("FHEMWEB") is a device, there are devices without a physical equipment used to store a variable's value.

We will now create a very simple device, called dummy.

A device of type dummy is a special object, inasmuch as it nonessential needs corresponding physical equipment (physical lamp, roller shutter, solenoid valve). So we can proceed in this guide without a real hardware system, or rather we don't need to concider differences between differrent hardware. A dummy device is generally represented on FHEM's user interface like a FHEM device with a physical equivalent.

Lets begin with a switch. It is designed to simulate a light switch on the wall. Please, enter command in command field:

define mySwitch1 dummy

"define" is the needed FHEM command, "mySwitch1" the future name of our device, "dummy" describes its type. Words "define" and "dummy" are part of FHEM'S command syntax and are unalterable, "mySwitch1" is (more or less) arbitrary. After pressing button Enter detail view of our new FHEM device mySwitch1 appears.

ErsteSchritteInFhem03.png


Info blue.png
Each device is of exactly one "type". This type determines Perl program file (more precisly called: "module"), with certain routines and properties coded. Since our device is of type dummy, FHEM can find routines and properties in module 98_dummy.pm. (Figure 98 formerly bore a meaning, now it doesn't no longer - for historical reason it is further used.)


Devices have a "state", changing in time and recorded by FHEM. E.g., some window is open, a shutter is closed, an outlet is under voltage. A state not necessary consists of exactly one value (window: "open" or "closed"), state can be described by a bunch of values (state of a Raspberry system - device type sysmon - contains CPU frequency, CPU temperature, load and much more).

Device status in FHEM consists of overall three blocks of values, called Internals, Attributes and Readings. It's early days yet to discuss in-depth meaning of these terms, but some remarks are important for our next steps:

  • Internals store very basic informationen about a device. Only in rare cases users will edit directly internals (mostly during define step).
  • Attributs control device behavior. Typically they can be changed (or even defined) by users.
  • Readings have in contrast to the values of the other two blocks a timestamp. Usually they are measured values of your device.

It may be confusing for beginners that there can be Internals and Readings of equal names (e.g. STATE and state). Though Perl distinguishes lower and upper case.


Info blue.png
Block Internals always shows basic characteristics of a FHEM device:
  • NAME: device name assigned by the user
  • TYPE: device type of FHEM device, here: dummy
  • STATE: device state shown in all summaries. Since there was no assignment till now it is initially ???.


Creating rooms

Creating switching commands

Event monitor

Operating devices - set

Event trigger - notify

Deleting or disabling devices – delete, disable

Save Config

Modifying existing – modify

Switching a couple of devices at once

Renaming devices

Scheduler - at

Event-driven timer start - notify und at

How do we go on?