Lemonbeat Data Mirror
The Lemonbeat data mirror is a proxy that encapsulates access to Lemonbeat for IHC. All Lemonbeat data is sent and received via the data mirror. Communication between IHC and the data mirror is both synchronous and asynchronous.
Synchronous Communication Between IHC and Data Mirror
IHC can request Lemonbeat data from the data mirror via a REST API. When a REST API call is made, the data mirror sends a command to Lemonbeat via the RabbitMQ broker. The execution of a command can, for example, result in Lemonbeat sending data back asynchronously via this broker (e.g., metadata).
Asynchronous Communication (Processing of Events)
The Lemonbeat platform sends asynchronous events via a RabbitMQ broker, which are subscribed to and processed by the data mirror. The data mirror forwards these events to the Azure Service Portal so that IHC can process the events.
Execution of the trigger_metadata_device_included_event Command
The command trigger_metadata_device_included_event is sent from the Lemonbeat data mirror to Lemonbeat via the RabbitMQ broker. This command causes Lemonbeat to send a METADATA_DEVICE_INCLUDED event. The METADATA_DEVICE_INCLUDED event is normally sent whenever a new IHC box is installed but can be triggered again using this command. IHC can trigger this command via the REST-API of the data mirror.
Lemonbeat documentation: lemonbeat_docs/operations_p
Processing the METADATA_DEVICE_INCLUDED Event
The METADATA_DEVICE_INCLUDED event is sent when a new IHC box is installed. The data mirror receives this event from the RabbitMQ broker. The event contains:
- deviceSgtin: SGTIN of the added IHC box
- deviceUUID: UUID of the added IHC box
- valueDescriptionList:
- List with all sensor data (name, valueId)
- An entry contains a name (e.g., flowRtd) and a valueId (e.g., 1)
Lemonbeat documentation: lemonbeat_docs/operations_platform_docs/operations_platform/services_topo.html#device-included
If the data mirror receives the METADATA_DEVICE_INCLUDED event, it sends a request to the eIot platform for each ValueId to map the datapoint ID. The datapoint ID is passed to the DEVICE_INCLUDED event and sent to the IHC via the Azure Service Bus. IHC can then query the sensor data from the eIot platform using the name and datapoint ID.
Execution of the metadata_get Command
The metadata_get command is sent from the Lemonbeat data mirror to Lemonbeat via the RabbitMQ broker to obtain metadata from an IHC box. This command causes Lemonbeat to send a META_DATA_REPORT event asynchronously to the data mirror via the RabbitMQ broker. The META_DATA_REPORT event contains EnergySaving data, Heatcurve data, and other data.
Example of a META_DATA_REPORT
{
"DayNightDetection": {"method":"clustering","start_day":0,"start_night":1439},
"DeviceTypeId": "65f5ea5b-4098-469b-9250-5fc614159ccf",
"GlobalDeviceTypeId": "65f5ea5b-4098-469b-9250-5fc614159ccf",
"EnergySavings": [
{"date":"2024-05-07","days":30,"mean_flow_temperature":45.75,"savings":0.02},
{"date":"2024-05-30","days":7,"mean_flow_temperature":45.95,"savings":0.03},
{"date":"2024-06-05","days":1,"mean_flow_temperature":46.85,"savings":0.03}
],
"HeatingCircuitCount": "1",
"HeatingCurveDetection": {"heating_curve_day":{"const":49.28,"cutoff_temperature":100,"mode":44.0,"r2":0.01,"slope":-0.15},"probability":0.01},
"InstallationDate": "2023-02-14T11:00:00",
"InstallationLatitude": "51.68382",
"InstallationLongitude": "6.95158",
"LocationId": "63ea2b4dfe4a29661ab48165",
"ManipulationDetection": {"heating_curve_day":{"const":48.81,"cutoff_temperature":100,"mode":44.0,"r2":0.01,"slope":-0.15},"probability":0.01},
"Manufacturer": "anderer",
"SensorDetection": "guess: NTC436, probability: 0.897",
"SensorType": "Unbekannt"
}
Lemonbeat documentation: lemonbeat_docs/operations_platform_docs/operations_platform/services_metadata.html#metadata-get
Setting Up the Lemonbeat Data Mirror for IHC
The following values must be set in the application.properties in the data mirror so that the data mirror can access the RabbitMQ broker and Azure Service Bus:
# RabbitMQ Broker
lemonbeat.broker.host=test-broker.lemonbeat.org
lemonbeat.broker.port=5671
lemonbeat.broker.vhost=test-eonremote-dmz
lemonbeat.broker.username=O=Eon,OU=Test,CN=Client-test-eonremote
lemonbeat.broker.password=KkxzptE3LPhtsjwUrANnkkpHnVexK7cC
lemonbeat.broker.ssl=true
lemonbeat.broker.clientName=eon-one-ihc
# Path to certificate file lb-cert.p12
lemonbeat.broker.certPath=/home/lb-cert.p12
lemonbeat.broker.certPassword=XXX
lemonbeat.client.username=eon
lemonbeat.client.password=XXX
lemonbeat.client.deviceIncludedQueue=EVENT.APP.METADATASERVICE.METADATA_DEVICE_INCLUDED
# Azure - Service Bus
spring.cloud.azure.servicebus.entity-name=ihc-dev
spring.cloud.azure.servicebus.namespace=ihc-dev
spring.cloud.azure.servicebus.entity-type=queue
azure.queue.consumer-enabled=true
optimum.enabled=false