Programming sending commands
My first experience with sending EnOcean messages was not very successful. But read on I did succeed in the end!
I had a working setup with a light bulb connected to a dimmer and a remote switch. See the other pages for details on these devices. I had setup the dimmer to react on the remote, and all was well.
The device behaves nicely. I must say the functionality is pretty good too. Press and release to turn lamp on, press other side of rocker and release to turn lamp off. It is not instant but it works well.
And if you press and hold On button the light goes on and goes brighter until finally full brightness where it stops. When the rocker button is released the brighter function stops.
Also when I press Off and On again the lamp goes back to set brightness. There are many more functions, like double click On and lamp goes directly to full brightness without changing dim memory. So next time when turning on it will go to the set brightness level.
I must say Eltako well done.
When I had the receiver program running on the TCM 120 I could see all the messages pass by from the remote. One thing immediately surprised me, there is no acknowledge from the dimming device even though it has constant power.
What do I want to achieve in this setup? I want my computer to be able to monitor and receive EnOcean messages. And of course I want to send the same type of messages that the remote sends with the same result and hopefully more. For example, I want to set the brightness on one lamp or a group of lamps to a set percentage, say 60%. And my experience on other interfacing projects is that the most reliable way to send commands is to ask afterwards what the state of a lamp is. So I want to query a device. And the best thing would be to query the network, who is in the neighborhood and what functionality do you have? And how do I remotely program a device…
Must remind you, this is only the short wish list!
I tried to find a function in the documentation which described setting a dimmer to a certain level. After reading for hours I was not able to find anything. I was rather disappointed to decided I had nothing to loose and I sent an email to EnOcean and Eltako.
Within a few hours I got a very nice email back from a sales person at EnOcean, I must say I was impressed. She of course was unable to answer my questions but forwarded my emails to an Application Engineer. He provided me with better information, but did disappoint in the answer “functionality available in next release or next Quarter”. I did notice, these emails were in June, the documentation on the public website is more elaborate. Thank you Christian!
Unfortunately I never heard from Eltako. They do not answer emails.
For a few months I left the subject of EnOcean at rest. And now I am starting with the subject again. read on…
Send first message
As I explained, I want to send a message to a dimmer and turn on a lamp.
What better way to get things done is to copy someone else. There is unfortunately no information in the internet, the documentation provides no examples so we have to reverse engineer and copy my small remote.
What does it send on button On press:
A5 5A 0B 05 10 00 00 00 00 15 A5 BB 30 C5
And on release:
A5 5A 0B 05 00 00 00 00 00 15 A5 BB 20 A5
And the On press message splits up according to the documentation into:
A5 5A: Sync bytes. not of interest
0B: Header with no name. with H_SEQ = 0 meaning RRT (Receive Radio Telegram) and Length = 0x0B meaning 11 bytes after this Header byte.
And then the ORG byte: 05
And then 4 bytes Data: 10 00 00 00
And 4 bytes ID: 00 15 A5 BB
a status byte: 30
and a checksum: C5.
Ok seems clear. The ORG tells me that the remote sends and RPS telegram. And what does RPS stand for? I have no clue do you? Just like the names 1BS and 4BS….
So I built a small program to emulate this button. I made a 14 byte buffer put the same data in and I sent it to the TCM 120.
Unfortunately no luck. I did get some bytes back.. bummer. I tried different angles but no luck, I was stuck.
I was however still thinking about my receiver program. I thought I could make the program much better using some c# polymorphism. What if I had a generic base class representing a telegram, and as soon as I put data from the TCM 120 in the class it would know who and what he was and would adapt accordingly. I could then format the data by using the EEP definitions from the EnOcean profile documentation. That was a good thought. I quickly started implementing new classes.
Halfway through the coding I stumbled upon some problems. The first one being: how to I know what EEP a device has. I am getting the feeling that it is not possible to determine this from the individual telegrams. I might have to add a database where I can map deviceid’s to EEP’s. And the second problem I found was that the TCM 120 documentation was describing other messages than RPS, 1BS and 4BS. I was reading about Command messages and Response messages. I understand these are specific TCM 120 messages and not generic EnOcean messages, but how am I to know what message the TCM 120 is sending me. I decided to implement these messages in the same class as the generic EnOcean messages.
Whilst coding the Command messages I was reading stuff I liked. I could reset the device. There was ways of getting version numbers and even Error messages. Better !!!
When I was finished I couldn’t wait to try some command messages on the TCM 120. So I started with the RESET message. I sent it and diretly trouble. I got some data back. Hey that seems like an error message. Yes it is saying checksum incorrect. Oeps forget to set newly calculated checksum, quickly added the code and tried again. I sent it and bingo I got information messages back!!
Wow that worked well, but what are those funny characters. There is no mention in de documentation that information messages en with [cr] we need to strip those off. And why is the first line a few spaces and more than one [cr].. The person that implemented the first line of the reset message must explain to me sometime why you would send a few spaces and [cr] …. strange.
Finally I was getting somewhere. I was really happy with the generic message engine, it was giving me information I did not have before.
And now back to my lighting. Lets send the message again.
Hey ERR_TX_IDRANGE error, lets look for that in the documentation. Rather a disappointment, I cannot send a message with an ID from another device. I guess I need to use the TCM 120 device ID. At least there is a way to look that up. Ok I updated the ID and tried again. But the lamp did not answer. But of course I need to program the new ID into the dimmer. I set it to LRN and sent the message again. The LED turned off meaning message received, set the lamp back on normal operation and tried again. Bingo Lamp is now ON!
So lessons learned:
Some Code for Sending
I must say the Monodevelop version for Mac OS X is getting to be a very usable product. And I feel so at home in the c# .Net framework. Mono is also a joy to use on a Mac. I tried Ubuntu Linux for a while. It now seems like an ok product but I keep getting into trouble everytime I try. And I was one of the first to try Linux on 386 hardware when I read the usenet posting from Tanenbaum to Linus, a must read for everyone. I remember spending many late nights trying to get linux to work. For me OS X is the power of Unix and all the tools and the usability of windows in the most beautiful hardware package by Apple.
Just some random thought spawning from a Monodevelop screenshot…
Progress for Dimmer
Getting the light to dim is more complex than I thought.From the enocean documentation there is mention of the 4BS message with the central command function (38). The components that I am using might however not support this message. Or I do not know how to program the component to react to these messages.
I placed some questions on the enocean forum.
There was an interesting answer. another user mentioned that PEHA makes dimmers that can process the central command message. Looking at the PEHA websites and documentation I could not find any information on this subject.
I did however see that the latest product catalog from PEHA for 2010 had mention of a new homecontrol software called myhomecontrol. They have usb dongles to interface with the pc and software to control components. I found a pdf document describing supported devices, this document is very interesting to me because it shows which manufacturers produce switches which can be dimmed. They mention OMNIO and PEHA, perfect just the answer I need. They even mention OMNIO uses a proprietary STM telegram (which unfortunately show the yet immaturity of the technology) and they mention that PEHA uses the central command function.
Okay, off to find a supplier for the components… More to follow, out with Eltako and in with PEHA !!!
FYI: PEHA 451 FU-BEP DAB (ceiling mount) and 451 FU-EP DAB ST (Plug type)
(I did send both companies (Eltako and PEHA) emails to provide me with the information which components have dimming functionality, wonder if they get back to me at all…)
I am impressed, PEHA got back to me pretty quickly. Their devices should support central commands for dimming. The Ceiling mount is confirmed, I am awaiting confirmation on other devices.
On my first search for finding a supplier I was shocked when I found the list price for the ceiling mount, just around 200 Euro’s. Now that is a ripoff for components not costing more than 20 euro’s… Is this what it costs te be using bleeding edge tech?
Hi,
I also searched a few weeks to get Information around sending EnOcean telegrams. But there aren’t. I received the telegrams I got from the Gateway USB300 and when I try to send a telegram to an actuator to Switch on a lamp, nothing happens. I think I made some mistakes. I think these are around the Base ID respectively Sender ID. How can I get a valid Sender ID and how I have to send the Sender ID to the actuator, that it identifies a valid EnOcean device. I desperately need your help!
Thanks a lot for your efforts.