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
Forget Me Not Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Forget Me Not Design Challenge
  • More
  • Cancel
Forget Me Not Design Challenge
Blog [FMN#03] : Decoding Enocean Protocol with Enocean Py
  • Blog
  • Forum
  • Documents
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: vish
  • Date Created: 20 Aug 2014 5:27 PM Date Created
  • Views 2154 views
  • Likes 1 like
  • Comments 4 comments
  • forget_me_not
  • python
  • enocean_serial_protocol
  • enocean
  • iot_home_intelligent
  • enoceanpi
  • enocean_equipment_profiles
  • enocean_pi
  • forget_me_not_challenge_2014
  • enocean_sensor_kit
Related
Recommended

[FMN#03] : Decoding Enocean Protocol with Enocean Py

vish
vish
20 Aug 2014

In last post, I explained how I was able to connect Enocean Pi to a laptop and configure it with openHAB. It worked pretty well, but I had a hard time decoding IDs of enocean devices to configure in openHAB. I managed to get hexdumps of the serial communication happening with a serial monitor and spend some time with Enocean Serial Protocol document and Enocean Equipment Profile document to finally figure out how to extract device IDs from the hex dump.

As a part of my course curriculum, now I've started learning Python and then thought of writing a small python script to help me in coding ESP3 packets. It will be a great exercise for me to test my python learning. I started out with Google and Stackoverflow last weekend. What more fun can be there than coding some protocol decoder??


Enter Enocean Py

After 5 days from starting, I have a working prototype of my own ESP3 decoder - Enocean Py. Enocean Py is a small python script which will help you in decoding ESP3 packets and validate them. It also allows you to send some commands and decode the response.

This is a screen shot of Enocean Py's working :

 

image


Enocean Py also includes a simple API to send, receive, decode and display the packet details. Currently the following features are supported.

1. Send raw commands to Enocean gateway

2. Receive raw ESP3 data packets from Enocean Gateway

3. Decode received ESP3 packet, one at a time.

4. Display the packet details for RESPONSE type packets.


The following features will be implemented soon

1. Decoding RADIO packets

2. Support for left out RESPONSE packets for CO_COMMAND

3. Decode multiple packets from a single buffer.


Hopefully by next weekend, I can come up with a working version of Enocean Py. For those who can wait till then, you can get early snapshot of Enocean Py from https://github.com/v-i-s-h/Enocean-Py . It has a main function in the script which will demonstrate the basic usage of API.

How to use :

1. Clone the git repository to your local folder

2. Open the script in any text editor and change 'ttyPort' to the port in which Enocean Gateway is connected.

3. Save the script

4. run 'python eopy.py'

5. eopy will display basic info about your enocean gateway and start listening to radio telegrams.

5. Press Ctrl+C to stop the execution

If you are getting junk values on first execution, stop and restart the script. This is due to unread data in serial buffer( see below for details )


Known issues :

1. If a data stream with more than one packet is fetched, only first packet is decoded.

2. On starting( and after sending each  command ), data read from the serial port may contain more than one packet -- additional packets are from the enocean sensors communicating to gateway. Flushing serial port is the solution for this, but I'm not able to figure out how.


Feel free to use, modify, improve and share the code I hosted.  Also let me know your comments. image


Cheers,

vish


<< Prev | Table of Contents | Next >>

  • Sign in to reply
  • vish
    vish over 11 years ago in reply to Former Member

    Yup Bryan....in my main function I'm sending a few commands to the gateway and decoding the response.

    But the additional packets I'm getting while reading from gateway are the transmissions from EO sensors.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • vish
    vish over 11 years ago in reply to DAB

    Thanks DAB.

    Python is so simple to learn....I'll say everybody should learn python image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 11 years ago

    You might note that when you send a command you will always get a serial response acking the command. See the Packet Type 2, Response Packet in the ESP3 description.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 11 years ago

    Nice update.

     

    I really need to learn python one of these days.

     

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
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