EnOcean USB300 and Python Via EnOcean Serial Protocol 3

There doesn’t seem to much out there in the hobby world with EnOcean. I find this interesting because EnOcean is pretty simple to use and has the unique advantage of energy harvesting devices anywhere. EnOcean sells a USB stick, the USB300 that speaks the EnOcean Serial Protocol 3 ( ESP3 (PDF)). I implemented part of this protocol, the ability to receive radio telegrams and transmit any ESP3 packet. In reality you probably only need to deal with a the small subset of ESP that is for sending and receiving radio telegrams. This would be the type 1 radio packets.

This python program doesn’t do much, but it lays the foundation for more and removes the burden of calculating check-sums. After starting you need to select the correct com port to use. If the connection is OK you will get back some details of the device, firmware version, chip ID etc. The main loop simply waits for 4bBS and RPS(four byte sensor and repeated switch) telegrams to be received from other EnOcean devices. It will print the data and source ID as well. The EnOcean Equipment Profiles EEP 2.5 (PDF)specifies how data looks coming in from different types of devices.ESP3_python Hopefully this helps you get started with ESP3 and adding EnOcean devices to your project.

The picture shows the program starting and some button presses and releases of a PTM210 wireless energy harvesting switch.

source code here: simple_serial_basicย note the send ESP3 packet method is implemented as well.


Have fun…..


Filed under EnOcean, stuff I've made, tips and hacks

20 Responses to EnOcean USB300 and Python Via EnOcean Serial Protocol 3

  1. Prasad

    Does EnOcean have a full duplex communication capability….

  2. edelmanb

    Yes it does, ESP3 is full duplex. Like any wireless system in a single channel it is not full duplex on the wireless link.

  3. Bryan a big thanks for this got it receiving on Raspberry PI. Trying to work out the packet data for sendESP3Packet. I want to send 4 different switched telegrams. Assume I have to pass org type F6 & data 70 or 0 etc can’t see a way of increasing an the baseID+n to get the next channel id.

    Thanks in advance

    • edelmanb

      Hi Lawrence,

      If you want to set the sender id with a base id you need to make sure you are in the valid range of baseid + 0x7f, set the optional data length correctly, and then transmit the base id you wish to use. I don’t think I implemented the optional data portion of the ESP3 packet type 1. You also need to make sure the CRC includes the optional data.

      What is your project?

    • tom

      I have a 3ooU usb that I am trying to get working on the pi, but the code hands on get version. How did you get it running?


      • edelmanb

        Hi Tom,

        I think you mean to say the code hangs on get version.

        Are you using python 2.7.xx and have the serial lib installed?
        Are you selecting the correct com port? (it does not auto detect, see the screen shot for an example)

  4. edelmanb

    Hi Lawrence,

    I just checked and you will have to modify sendESP3Packet(packetType, packetData) to take an optional data argument.

  5. Bryan sorry for the delay my project is controlling a set of display lights in a car show room. I got it working fine for for transmitting using chip id then moved on to using base id which by some fluke I got working. I tried this on 2nd USB300 no go! I’m wondering if I need to set Base id as outline hear http://www.enocean.com/en/knowledge-base-doku/enoceansystemspecification:issue:what_is_a_base_id/?purge=1

    Looking at your code I can’t see how the base id ever got set so am confused :).

    Thanks again Lawrence

    • edelmanb

      “The Base ID is specified during programming in the configuration area. It is picked pseudo-randomized as a modulo function of the Chip id. ”

      The base id can be set in python via an ESP3 command or you can read the base id, another ESP3 command, then use that to transmit. So, do CO_RD_BASEID (I think that’s what it is) Say this returns 0xFFFFFF80. Now you can transmit with 0xFFFFFF80, oxFFFFFF81, oxFFFFFF82 ect. You set this in the radio type packet, optional field for tx address.

      You need to read the base id each time a new usb stick is used because every enocean device will not come with the same stock base id.

      To go a bit further, at start up, read the base id and if it is not something you want you can use the CO_WR_BASEID command to set the base id.

      Would love to see a video of what you made! All the best….

  6. edelmanb

    Also, read base id is already implemented! just call commandReadBaseId()!

  7. Bryan thanks gave up on using chip id but setting baseid has worked like a dream. And found commandReadBaseId().

    I’ve not use python before so ended up porting most your good work to node.js. I will put a wee blog post together. Thanks couldn’t of done this without your good work.


    • Dimitrij

      i’m also trying out the described code. Receiving is just fine. But now i’m trying to send to an actor with no success. Did you manage doing it with python?


  8. pradeepkumark

    I can able to receive a telegram by python code . But i dont know how to send a telegram to control the actuator or receiver… Please help me…
    packet type=0x01
    no optional data
    i can get the chip id …

    • edelmanb

      You need to know the EEPs supported by the actuator and you then need to emulate that EEP. You probably also need to first link to the device with a learn telegram. See the EEP document on EnOcean’s website.

  9. alex

    Hi there,

    i’m a little stuck with this thing ๐Ÿ™‚ I can’t figure out how to use it correctly to send a telegram. I think i have to use sendESP3Packet()
    with something like
    sendESP3Packe(0x01, [0xA5,0x5A,0x6B,0x05,0x10,0x00,0x00,0x00,0xFF,0x86,0x97,0x80,0x01])
    Where the part in [] is the telegram to send. Is this the correct usage? … I’m not really successfull with that :). Doesn’t look like it’s sending anything.

    I would be grateful if someone can push me into the right direction.


  10. Patrick

    i need to change my Baseid because i have broken my USB-300 (on my RPI2).
    I bought a new usb key, but i dont know how to change the new baseid to restore the old one (i know my old chipset id and my old baseid).
    if i can’t do it, it will be a big problem for me (i dont want making again all linking process, because accessing to my equipments are not very aisy)..
    And, if i know PHP, i never use before python, so if someone can show me what command i can add to this script to change the baseid.
    I have read that to do that i have a limited number of try (only 10 times), so i’m affraid to do some mistake and brik my new key…

  11. rappnator

    can u tell me, how to change the baseID of en EnoceanPI ? I know, ur script is for USB300. But i am searching for an solution to change the BaseID at an Raspberry PI with EnoceanPI module.

  12. Obaidallah Elhassan

    Can I transmit a telegram to a specific destination?

Leave a Reply

Your email address will not be published. Required fields are marked *