HowTo: FHEM - structure, modules & things worth knowing

After I installed FHEM for the first time and the configuration page was actually accessible, the euphoria was great. After I clicked around for a bit, this euphoria was quickly replaced by helplessness. FHEM is a powerful and very well maintained tool for connecting various home automation devices. Unfortunately there's just one thing it's not: intuitive.

In my opinion, this is the only disadvantage of FHEM or open source projects in general: you have to invest time and deal with the project. Unfortunately, it's often not something that can be put together or clicked together in one evening using plug and play.

That's why I've decided to summarize and explain the most important basics about FHEM in this article.

Ideally, you will be able to set up a functional and secure FHEM configuration without having to spend days slogging through forum posts and wiki pages.

I will first write a bit about the structure and configuration of FHEM and then present a few useful (and sometimes important) configuration snippets.


Safety instructions

I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/

Affiliate links/advertising links

The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂 


Requirements

Before you start with this article you should have prepared the RaspberryPi so that it is accessible via the network and controllable via SSH.

The following three articles describe what needs to be done to prepare the RaspberryPi:
RaspberryPi – setup for nerdiys!
RaspberryPi – The first configuration!
RaspberryPi – Control the RaspberryPi via SSH
FHEM – Installation on the RaspberryPi

Tools needed:
-no-

Materials needed:

In the following list you will find all the parts you need to implement this article.


Overview of the FHEM web interface

The following images are intended to give you a brief overview of the various functions of the FHEM web interface.

1. The command line:
Here you can enter commands, for example to create or configure new modules

2. “Save config” basically does exactly what it says. All changes Ihir makes to your FHEM instance are saved in a large configuration file. However, this only happens after you have clicked the “Save config” button. Unsaved changes are indicated by a red question mark next to “Save config”. Unsaved changes will be lost when you restart the FHEM server.

3. , 4. and 5. “MAX”, “unsorted” and “Everything” are “rooms” that you can create to group your configured sensors and actuators. For example, you can create a “living room” room and combine all the devices that are important for controlling the living room. Only the “unsorted” and “Everything” rooms are created automatically and are always present. All configured modules that are not yet linked to any other room are listed in the “unsorted” room. All configured modules are listed in the “Everything” room, regardless of whether they are already linked to another room.

6. “Logfile” shows you the entries in the log file

7. “Commandref” shows you the local command library. Here you will find all available commands and some more detailed information about them.

8. “Remote doc” is similar to “Commandred” except that it redirects you to the current version of the available commands on the FHEM website.

9. “Edit Files” allows you to edit the various style and configuration files of FHEM. You have a lot of options here, but you can also ruin a lot. That's why you should always work carefully here and it's best to work with a previous backup.

10. Under “Select Style” you can change the appearance of your FHEM instance.

11. The “Event Monitor” allows you to display current live events. For example, events such as received switching commands are displayed.

View of the “MAX” room: This room contains all devices of the MAX module for the MAX! radiator thermostats. Some rooms (like this one) are created automatically as soon as a corresponding device in this module is configured.
View of the “Unsorted” room: This room contains all configured modules that are not yet in another room – i.e. not yet sorted.
View of the “Everything” room: All configured modules are listed in this room. So if you are looking for a specific configured module: you will definitely find it here.
View of the log file: Various past activities are displayed here. In this example you can see that multiple attempts to connect to a specific server failed. Every piece of information is logged with a time stamp. This is particularly helpful for troubleshooting.
View of the “Commandref”: Here you will find all available commands of the installed modules.
View of “Edit files”: Here you can find all FHEM files. You can also view and edit them here. However, you should be particularly careful with the configuration files. An incorrect setting can cause FHEM to no longer start properly.
“Select Style” view: Here you can edit the appearance of the FHEM surface. Ready-made styles are also offered under “Styles”. Just try them out. You can't break (almost) anything here.
View of the event monitor: Various activities are shown live here. In this example you can see that the connection to the configured MQTT server is active. This and other conditions/events are monitored and displayed here regularly.

Modules

The great thing about FHEM is that its functions can be expanded and refined using all sorts of modules. It is precisely this property that makes it so powerful, as it allows new sensors or actuators to be integrated into FHEM.

You can find a great overview of the structure of FHEM at https://wiki.fhem.de/wiki/System%C3%BCbersicht


Starting and stopping

To be able to start and stop Putty via the console, the following commands are helpful.

Starting FHEM:

sudo /etc/init.d/fhem start

or

systemctl start fhem.service
In the latter case, you may be asked under which user this action should be carried out. Here you normally select the user “pi” i.e. number 1 and confirm this by entering the respective user password.

Stopping FHEM:

sudo /etc/init.d/fhem stop

or

systemctl stop fhem.service
In the latter case, you may be asked under which user this action should be carried out. Here you normally select the user “pi” i.e. number 1 and confirm this by entering the respective user password.

View current status of FHEM

To display the current system messages from your FHEM instance, simply use the following command.

sudo /etc/init.d/fhemstatus

or

systemctl status fhem.service
The last two lines are interesting here. These show you that FHEM has been started and is now running. If FHEM does not start, you will most likely see an error message that can help you troubleshoot.

Further information

https://wiki.fhem.de/wiki/System%C3%BCbersicht


Have fun with the project

I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂

PS Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂

Buy Me a Coffee at ko-fi.com       

Kommentar hinterlassen

Your email address will not be published. Erforderliche Felder sind mit * markiert

This site uses Akismet to reduce spam. Learn how your comment data is processed.