|
|
# EnOcean IO Service
|
|
|
|
|
|
The EnOcean implementation in FREDOSAR is a service to handle incoming and outgoing messages from/to EnOcean Devices.
|
|
|
To do this a [EnOcean Pi](http://at.farnell.com/enocean/enocean-pi-868/mod-soc-gateway-trx-8051-mcu-868/dp/2322460?CMP=KNC-GAT-GEN-KWL-ENOCEAN&mckv=2734Iz1a_dc|pcrid|199139075407|&gclid=EAIaIQobChMIz7Kq_uOz1QIVogvTCh0o-wJmEAAYASAAEgLj1PD_BwE) is required for the Raspberry Pi.
|
|
|
To do this an [EnOcean Pi](http://at.farnell.com/enocean/enocean-pi-868/mod-soc-gateway-trx-8051-mcu-868/dp/2322460?CMP=KNC-GAT-GEN-KWL-ENOCEAN&mckv=2734Iz1a_dc|pcrid|199139075407|&gclid=EAIaIQobChMIz7Kq_uOz1QIVogvTCh0o-wJmEAAYASAAEgLj1PD_BwE) is required for the Raspberry Pi.
|
|
|
|
|
|
So this Service is fowarding incoming EnOcean messages to the MessagingService in FREDOSAR and can receive commands via the CommunicationService and sends them to the EnOcean device. This Service does not save the actual state of devices.
|
|
|
|
... | ... | @@ -12,9 +12,9 @@ So this Service is fowarding incoming EnOcean messages to the MessagingService i |
|
|
|
|
|
## Interface
|
|
|
|
|
|
### Incoming EnOcean Messages (from a EnOcean device)
|
|
|
The EnOcean Service receives messages from EnOcean devices. It accepts only devices that are registered in the Address Management (see [Device and Address Management](#device-and-address-management)). The Service also handles also Teach-In and Teach-Out messages.
|
|
|
If a device has an entry in the Address Management the Service mapps the data to Fredosar DTO's(Data Transfer Objects) and publishes the messages to the [MessagingService](https://ressel.fh-salzburg.ac.at/FREDOSAR/Framework/wikis/tutorial-core-service-messaging).
|
|
|
### Incoming EnOcean Messages (from an EnOcean device)
|
|
|
The EnOcean Service receives messages from EnOcean devices. It accepts only devices that are registered in the Address Management (see [Device and Address Management](#device-and-address-management)). The Service also handles Teach-In and Teach-Out messages.
|
|
|
If a device has an entry in the Address Management the Service maps the data to Fredosar DTO's(Data Transfer Objects) and publishes the messages to the [MessagingService](https://ressel.fh-salzburg.ac.at/FREDOSAR/Framework/wikis/tutorial-core-service-messaging).
|
|
|
The **topic** of the messages are:`in.homeatomation.enocean.[FredosarDevice].[FredosarID]`
|
|
|
* FredosarDevice: is the type of the device and is a constant from org.fredosar.core.types
|
|
|
* FredosarID: is the ID of the device as it is in the Address Management
|
... | ... | @@ -25,7 +25,7 @@ For more information see [Device and Address Management](#evice-and-address-mana |
|
|
Not all devices send data. Some are only receiving commands for details of the devices see [Implemented Devices/Packets](#implemented-devicespackets).
|
|
|
|
|
|
|
|
|
### Outgoing EnOcean Messages (to a EnOcean device)
|
|
|
### Outgoing EnOcean Messages (to an EnOcean device)
|
|
|
The EnOcean Service can send messages/controls to EnOcean devices (only if the device supports). The device must be registered in the Address Management (see [Device and Address Management](#device)). There are 2 possible ways to send controls to a device via the EnOcean Service:
|
|
|
* [CommunicationService](https://ressel.fh-salzburg.ac.at/FREDOSAR/Framework/wikis/tutorial-core-service-communication) with the PID **org.fredosar.service.io.enocean**.
|
|
|
* [MessagingService](https://ressel.fh-salzburg.ac.at/FREDOSAR/Framework/wikis/tutorial-core-service-messaging) with the topic **out.homeautomation.enocean**
|
... | ... | @@ -35,12 +35,12 @@ The EnOcean service can receive `List<FredosarType>` or `FredosarType` to contro |
|
|
|
|
|
|
|
|
## Device and Address Management
|
|
|
Every EnOcean device has to have an entry in the Address Management of FREDOSAR. Access the Address Management via the Web Interface of FREDOSAR.
|
|
|
Every EnOcean device must have an entry in the Address Management of FREDOSAR. Access the Address Management via the Web Interface of FREDOSAR.
|
|
|
|
|
|
A entry for a device has:
|
|
|
* Identifier: An unique ID in FREDOSAR to identify the device (FREDOSAR ID)(e.g.: switch1, socket1)
|
|
|
An entry for a device has:
|
|
|
* Identifier: A unique ID in FREDOSAR to identify the device (FREDOSAR ID)(e.g.: switch1, socket1)
|
|
|
* Technology: For the EnOcean Service `org.fredosar.service.io.enocean`
|
|
|
* Receiver Information: Consists out of 2 information's. The EnOcean device ID and the EEP packet description. The syntax is `0x[EnOcean ID in hex].[EEP]`:
|
|
|
* Receiver Information: Consists out of 2 informations. The EnOcean device ID and the EEP packet description. The syntax is `0x[EnOcean ID in hex].[EEP]`:
|
|
|
* EnOcean ID: Is the unique ID of the EnOcean device. The EnOcean ID is displayed in the terminal when the device sends a message and is not in the Address Management.
|
|
|
* EEP: Describes the data packet that is sent of the device. This information can be found in the manual of the device (EnOcean Equipment Profile (EEP)). All in FREDOSAR implemented data packets are listed in [Implemented Devices/Packets](#implemented-devicespackets)
|
|
|
|
... | ... | @@ -48,7 +48,7 @@ Here is an example for an entry in the Address Management: |
|
|
|
|
|

|
|
|
|
|
|
Here is an example where you can see the EnOcean ID of an device in the console:
|
|
|
Here is an example where you can see the EnOcean ID of a device in the console:
|
|
|
|
|
|

|
|
|
|
... | ... | @@ -171,9 +171,9 @@ In the manual of devices is a description called EnOcean Equipment Profile (EEP) |
|
|
This information is necessary to get the detailed information of the sent packet and data. All EEP are described in this PDF <http://www.enocean-alliance.org/eep/>. This document contains the information which byte contains which data in the data packet.
|
|
|
|
|
|
To add a new EEP a new class must be created in the Package `org.fredosar.service.io.enocean.eep`. This class inherits from `EEPRadioPacket.java`.
|
|
|
The new class matches the incoming bytes to FredosarType DTO's. The class also handles sending new EnOcean Messages to the device and maps the FredosarType DTO's to a EnOceanMessage that can be sent to the EnOcean device. To send a EnOcean Message to a device the ResponseRadioPacket is implemented (as new EnOcean Message).
|
|
|
The new class matches the incoming bytes to FredosarType DTO's. The class also handles sending new EnOcean Messages to the device and maps the FredosarType DTO's to an EnOceanMessage that can be sent to the EnOcean device. To send an EnOcean Message to a device the ResponseRadioPacket is implemented (as new EnOcean Message).
|
|
|
|
|
|
Here is an example of the strcutre and methods of such a implementation
|
|
|
Here is an example of the strcutre and methods of such an implementation
|
|
|
```java
|
|
|
public class D5_00_01Device extends EEPRadioPacket {
|
|
|
/** TAG */
|
... | ... | @@ -246,7 +246,7 @@ public class D5_00_01Device extends EEPRadioPacket { |
|
|
}
|
|
|
```
|
|
|
The new implemented class then must be added to a list of all implemented Devices in the Package `org.fredosar.service.io.enocean.impl` in the Class `DeviceHandler.java`.
|
|
|
There is a Map called `radioProtocols` add there an entry for the packet/device as shown in the example below.
|
|
|
There is a Map called `radioProtocols`. Add an entry for the packet/device to the list as shown in the example below.
|
|
|
```java
|
|
|
/** A Map with all Implemented EEP Radio protocols to generate new instances */
|
|
|
private static final Map<String, Class<?>> radioProtocols;
|
... | ... | |