element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs Summary of FHEM with EnOcean & PSEUDO Devices.
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: malakai
  • Date Created: 1 Jul 2014 4:18 AM Date Created
  • Views 830 views
  • Likes 1 like
  • Comments 0 comments
  • fhem
  • raspberry-pi
  • iot
  • enocean_pi
  • automation
Related
Recommended

Summary of FHEM with EnOcean & PSEUDO Devices.

malakai
malakai
1 Jul 2014

This will be a summarized tutorial on how to use Fhem. The only kit I have at the moment is the EnOcean Pi and Sensor Pack 902mHz (US) see the following link for part details and pricing:

The specified item was not found.


Note: I would like to thank those that created the blog posts I will be using to navigate this summarized how to with Fhem.

You will see the original sources quoted below. I couldn't have gotten this far without their help.

I have created this document for clarity and ease of navigation only.

Please visit the links throughout and referenced below to see what else they have done with Fhem.

 

For a detailed getting started guide with Fhem and EnOcean see my review:


Raspberry Pi and EnOcean Internet of Things Pack - Review http://www.element14.com/community/roadTestReviews/1795



With that completed you now have the framework to move forward with Fhem.


Why Pseudo devices? Defined below is setting up Local Weather. But the other uses for such things would be to define buttons, switches, etc. With the use of Pseudo devices you can take the values of say the EnOcean rocker switch which outputs values such as A1, A0, B1, B0. Create a Pseudo device linked to the switch and return values such as Off | On or Open | Closed. This makes for much more user friendly monitoring. I will try to add how to do this later but for now this will walk you through creating a Pseudo device to monitor Weather Conditions.


A) 3 ways to interface with Fhem

B) Example add MyWeather to Fhem

C) Adding an EnOcean STM33x Temperature Sensor graph

 

 

A) 3 ways to interface with Fhem (Source: FHEM reference #Intro)

 

  1. HTTP (Web, Phone, & Tablets each have an interface based on ports)
    • From a web browser http://<fhemhost>:8083/fhem
    • From a phone http://<fhemhost>:8084/fhem
    • From a tablet http://<fhemhost>:8085/fhem
  2. TCP/IP over Telnet
    • telnet <fhemhost> 7072
  3. Via terminal session locally or over ssh with fhem.pl found in /opt/fhem
    • fhem.pl 127.0.0.1:7072 "<fhem-command>" "..."
    • ./fhem.pl 127.0.0.1 list #shows all defined configurations
  4. Commands Fhem Command Types
    • There are three types of commands: "fhem" commands (described in this document), shell commands (they must be enclosed in double quotes ") and perl expressions (enclosed in curly brackets {}). shell commands or perl expressions are needed for complex at or notify arguments, but can also issued as a "normal" command.
    • E.g. the following three commands all do the same when issued from a telnet prompt:

      • set lamp off

      • "fhem.pl 7072 "set lamp off""

      • {fhem("set lamp off")}



 

B) Example add MyWeather to Fhem (Source: www.ply.me.uk fhem and home automation also FHEM reference #Weather)

 

First visit Yahoo Weather to get your WOEID (Where On Earth IDentifier)

  • Click this link https://weather.yahoo.com/ type in your Zip / Postal Code and it will return a URL
  • For example Dublin Ireland = https://weather.yahoo.com/ireland/dublin/dublin-560743/
  • Note 560743 (This is the WOEID for Dublin Ireland) With your ID we are ready to continue

 

As defined in A) how you choose to enter a Weather Monitor into Fhem is your choice I'll focus on the Web Portal and cover the rest briefly as the commands are very similar.

 

At the top of every page in Fhem you'll see a Dialog Box this is used to enter command directly into Fhem such as add, define, & modify Devices (Physical or PSEUDO)

 

For MyWeather we need to define it. Enter the following into the Command Dialog Box

 

Header 1

image

Figure 1.1 Fhem Command Dialog

 

define myWeather Weather 560743 3600 en


To break this down we'll refer to the Fhem Command Reference Doc FHEM reference #Weather


 

define <name> Weather <location> [<interval> [<language>]]

 


Understanding Fhem Rooms:

 

Header 1

image

Figure 1.2 Fhem Room Links

 

As illustrated in Figure 1.2 Each link is a representation of a Room (Enocean, Unsorted, WeatherForcast, and Everything)

 

You may have to refresh to see the newly created WeatherForecast link but we'll continue to define our new Pseudo Device myWeather. Enter the following into the Command Dialog

 

 

attr myWeather room WeatherForecast

 

This is found in the Command Refrence Link FHEM reference #attr

 

attr <devspec> <attrname> [<value>]

 

 

This should be when the new WeatherForecast Link is found in the Navigation Menu

 

You can visit the device if the link takes time to populate by typing this URL into your browser: (Modify <fhemhost> with your IP)

 

http://<fhemhost>:8083/fhem?detail=myWeather_weblink

 

Device Attributes

 

If you visit http://<fhemhost>:8083/fhem?detail=myWeather Found at the bottom of the weblink or Room Navigation should see settings similar to this:

 

Header 1

image

Figure 1.3 Attributes

 

The FileLog should automatically be created if not the following command will create one.

 

 

define FileLog_myWeather FileLog ./log/myWeather-%Y-%m.log myWeather

 

You will also want to set the attr logtype to text and room to WeatherForecast too for now using the attr button

 

Navigate to this page http://<fhemhost>:8083/fhem?detail=FileLog_myWeather


And add the corresponding attribute seen in Figure 1.4


 

Header 1

image

Figure 1.4 FileLog Room



Click the attr button


 

Header 1

image

Figure 1.4a FileLog Room Attribute


The last step is to add some nice icon's within the WeatherForecast Room


Enter the following


 

define myWeather_weblink weblink htmlCode {WeatherAsHtml("myWeather")}

 


Navigate to http://<fhemhost>:8083/fhem?detail=myWeather_weblink

 

As in the step above add the attribute Room WeatherForecast

 

And you should now have a very nice layout as seen here.

 

Header 1

image

Figure 1.5 WeatherForecast Room

 

 

Click Save Config on the navigation window once you've got it all set up.


Tidy up the config file with comments.


Click Edit Files - fhem.cfg


Yours should have the following newly added myWeather


define myWeather Weather 12794143 3600 en

attr myWeather room WeatherForecast

define FileLog_myWeather FileLog ./log/myWeather-%Y-%m.log myWeather

attr FileLog_myWeather room WeatherForecast

attr FileLog_myWeather room Logs

define myWeather_weblink weblink htmlCode {WeatherAsHtml("myWeather")}

attr myWeather_weblink room WeatherForecast

 

To make this a little cleaner in the config file add the following comments

 

#####################################################################

####    Yahoo weather

#####################################################################

define myWeather Weather 12794143 3600 en

attr myWeather room WeatherForecast

 

####    Logfile all Weather Data —

define FileLog_myWeather FileLog ./log/myWeather-%Y-%m.log myWeather

attr FileLog_myWeather room WeatherForecast

attr FileLog_myWeather room Logs

 

####    Add weather icons —

define myWeather_weblink weblink htmlCode {WeatherAsHtml("myWeather")}

attr myWeather_weblink room WeatherForecast


Click save fhem.cfg button and you are all setup.

 

(Note you could have simply just pasted this into the config and saved all those steps but what's the fun in that)

 

You'll notice my define myWeather (WOEID) is set to 12794143 if you wish to change your location simply modify the WOEID with a new Geo Location and save the config. Fhem will automatically auto populate the rest based on this.

 

This can also be done on the detail page:

 

Header 1

image

Figure 1.6 myWeather settings

 

Lastly you can enter the commands through Telnet, Terminal session, or Text editor if either is more convenient for you.

 

The summarized commands are:

attr myWeather room WeatherForecast

define FileLog_myWeather FileLog ./log/myWeather-%Y-%m.log myWeather

define myWeather_weblink weblink htmlCode {WeatherAsHtml("myWeather")}

Note: This will not set the attr Room WeatherForecast for FileLor or the Icons (I am not positive on those commands) but again you can just ssh into the Pi and modify /opt/fhem/fhem.cfg with vim, nano, or any other text editor.



C) Adding an EnOcean STM33x Temperature Sensor graph


Now that you have the understanding of the commands I'll simplify this.


Edit the fhem.cfg file by navigating to


 

http://<fhemhost>:8083/fhem?cmd=style%20edit%20fhem.cfg

 


Scroll to the bottom and add the following weblink and click Save fhem.cfg


#####################################################################

####    EnOcean STM33x Temp Sensor Weblink

#####################################################################

define weblink_EnO_sensor_0183180E SVG FileLog_EnO_sensor_0183180E:temp4:CURRENT

attr weblink_EnO_sensor_0183180E label "Temperature-Enocean-Board"

attr weblink_EnO_sensor_0183180E room EnOcean

 

When you navigate to the EnOcean Room you get a nice temperature graph already to go.

 

Header 1

image

Figure 1.7 EnOcean Graph

 

 

Next to come using Notify, Watchdog and Perl Specials to react to events.

 

Resources:

myWeather (Source: www.ply.me.uk fhem and home automation)

Fhem Command Reference (Source: FHEM reference Commands)

EnOcean Module and Accessories Source: The specified item was not found.)

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube