First steps in FHEM: Unterschied zwischen den Versionen

Aus FHEMWiki
K (→‎Creating rooms: Rohmaterial)
(→‎Creating rooms: next part translated)
Zeile 70: Zeile 70:


== Creating rooms ==
== Creating rooms ==
<!--
Im nächsten Schritt wollen wir Geräte ordnen und geeignet zusammenfassen. Beispielsweise könnten Sie es für sinnvoll erachten, die Geräte, die sich physisch (tatsächlich) in einem Raum befinden, auch in FHEM entsprechend anzuordnen. In einem "Schlafzimmer" sollen dann also entsprechende devices "Rolladen", "Zeitschalter" und "Radios" zu finden sein. Sie können aber auch andere Zuordnungen vornehmen; man könnte etwa alle Messinstrumente wie Thermometer, Stromzähler und Feuchtigkeitsfühler in einem (eventuell nur logisch und nicht physisch existierenden) Raum "Messinstrumente" erfassen. Der Name eines Raumes ist dabei beliebig.


Um dies zu tun, müssen Sie allen devices, die zum Raum gehören sollen, ein "Attribut" (siehe oben) hinzufügen. Dieses Attribut heißt room und muss als Wert den Namen des Raumes bekommen. Versuchen wir dies für unseren dummy. Hierzu verwenden Sie folgenden Befehl (abschließen der Eingabe mit {{Taste|Enter}}):
Let's do a step forward and arrange our devices in rooms. You may consider reasonable to put together devices physically (really) located in one room into a FHEM room. So you can find in "''bedroom''" appropriate devices like "''shutter''", "''time switch''" and "''radio set''". You may decide other assignments: put all measuring devices like thermometers, electric meters and hygrometers in one (possibly only virtually and not physically existing) room "''measuring devices''". Name of a room is arbitrary.
 
To achieve this you have to add to all devices your room should contain an "Attribute" (see above). Name of the attribute is "room" and it should get as its value the room name. Let's try it with our room ''dummy''. Use command
  attr mySwitch1 room Training
  attr mySwitch1 room Training
and finish input with {{Taste|Enter}}).


Durch diesen Befehl wird dem Device ''mySwitch1'' das Attribut ''room'' mit dem Wert ''Training'' hinzugefügt. Wieder gehören attr, mySwitch1 und room zur Befehlssyntax von FHEM und können nicht verändert werden, Training ist frei wählbar.  
With this command you have added to device ''mySwitch1'' Attribute ''room'' with value ''Training''. Again, ''attr'', ''mySwitch1'' (while referencing to an existing object's name) and ''room'' are part of FHEM's command syntax and are unalterable, ''Training'' is arbitrary.


''mySwitch1'' gehört jetzt zum room ''Training''. Durch diese Zuordnung ist dieser Raum in der Navigationsleiste links zur Liste der Räume hinzugefügt worden. Klicken Sie einmal auf den Raum ''Training''.
Now ''mySwitch1'' belongs to room ''Training''. Due to this assignment room appears in navigation bar on the left hand side in room's block. Try to click at room ''Training''.


[[Datei:ErsteSchritteInFhem04.png]]
[[Datei:ErsteSchritteInFhem04.png]]


Es werden nun alle Geräte angezeigt, die diesem Raum zugeordnet wurden. Bisher haben wir hier nur ein Gerät: ''mySwitch1'', unseren dummy.  
FHEM will show all devices belonging to this room. Until now we have only one device: ''mySwitch1'' - our dummy.
Neben dem Device-Namen wird immer der Status des Device angezeigt, hier noch ''???''.
 
Wenn Sie auf den Namen ''mySwitch1'' klicken, gelangen Sie wieder in dessen Detailansicht.
Beside device name always device status is on display, we still get ''???''. Clicking at name ''mySwitch1'' you will return to its detailed view.


Unser dummy wird in einem Block mit der Typbezeichnung ''dummy'' dargestellt. Diese Typbezeichnung können Sie ebenfalls ändern, wenn Sie ein weiteres Attribut "group" hinzufügen und einen (ebenfalls frei wählbaren) Namen vergeben: Gruppen sortieren devices innerhalb eines Raumes.  
Our dummy is shown in a block with (type) label ''dummy''. You may change label as well introducing a further attribute "''group''" and assigning to it (arbitrary as well) name: groups order devices inside a room.


Anmerkung: Wenn Sie einen Raum löschen wollen, so tun Sie dies, indem Sie sämtliche devices aus dem Raum entfernen. Für unser Beispiel des Raums ''Training'' bedeutet es, dass in allen devices das Attribut room entfernt wird. Der Raum ''Training'' verschwindet dann von alleine.
''Note'':<br />If you want to delete a room, you may do so removing all devices from this room. In our example of room ''Training'' you have to delete in all devices of room ''Training'' attribute room. Room ''Training'' will dispear by itself.
-->


== Creating switching commands ==
== Creating switching commands ==

Version vom 15. Juni 2017, 16:12 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: 15.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 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.

Now we will 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

Let's do a step forward and arrange our devices in rooms. You may consider reasonable to put together devices physically (really) located in one room into a FHEM room. So you can find in "bedroom" appropriate devices like "shutter", "time switch" and "radio set". You may decide other assignments: put all measuring devices like thermometers, electric meters and hygrometers in one (possibly only virtually and not physically existing) room "measuring devices". Name of a room is arbitrary.

To achieve this you have to add to all devices your room should contain an "Attribute" (see above). Name of the attribute is "room" and it should get as its value the room name. Let's try it with our room dummy. Use command

attr mySwitch1 room Training

and finish input with Enter).

With this command you have added to device mySwitch1 Attribute room with value Training. Again, attr, mySwitch1 (while referencing to an existing object's name) and room are part of FHEM's command syntax and are unalterable, Training is arbitrary.

Now mySwitch1 belongs to room Training. Due to this assignment room appears in navigation bar on the left hand side in room's block. Try to click at room Training.

ErsteSchritteInFhem04.png

FHEM will show all devices belonging to this room. Until now we have only one device: mySwitch1 - our dummy.

Beside device name always device status is on display, we still get ???. Clicking at name mySwitch1 you will return to its detailed view.

Our dummy is shown in a block with (type) label dummy. You may change label as well introducing a further attribute "group" and assigning to it (arbitrary as well) name: groups order devices inside a room.

Note:
If you want to delete a room, you may do so removing all devices from this room. In our example of room Training you have to delete in all devices of room Training attribute room. Room Training will dispear by itself.

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?