Tip Tip The Scheduled MQTT control is meant for scheduled messages ahead of time. For live control, see instead.
This guide will help you configure MQTT on your SmartgridOne Controller to remotely control and monitor battery and solar panel installations.
SmartgridOne Controller with internet connectivity.
MQTT credentials: This can be requested from our .
Python development environment (or any other MQTT client). This guide uses a basic example written in Python to get you started with MQTT and sending commands. We recommend to use Python for the ease of use, but any other MQTT client is supported.
MQTT is a fast communication protocol over the internet. It is a publish/subscribe message systems, which allows for a direct connection between your machine and the SmartgridOne Controller . Your assets are classified into solar, battery, EV, and HVAC groups. At the moment, this integration allows for control per group, not per device.
I have a SmartgridOne Controller that I'd like to setup for MQTT Remote Control.
Ensure that your network allows mqtt network traffic over port 1883. You can do this using command:
nc -zv mqtt.eniris.be 1883 When this command is not available, you can alternatively download and execute the python code:
When in in doubt, consult your network engineer or temporarily use your phone's 4G/5G hotspot when connection errors occur.
Note Note When port 1883 is not accessible from your network, we offer a backup at port 80. This can be configured in your MQTT-client at a later step in this manual.
and make sure the to the SmartgridOne Controller .
Select all devices that you'd wish to include in MQTT Remote Control.
The MQTT Remote Control interface has now been activated on the SmartgridOne Controller .
We are now ready to send some basics commands using a simple example. The Status column tells you if any command is active.
A good first starting point would be to test your newly setup integration with a simple example.
This test code does a simple job of continuously sending the following schedule:
Battery: Charge at 5 kW for 15 minutes in 10 minutes
Solar: Set power to 0 kW for an hour in 30 minutes
The SmartgridOne Controller responds with an acknowledgement message containing the unique schedule identifier, or an error message.
We then fetch the next schedule for both device types, confirming that the command was successful.
Please download the file below in your preferred Python IDE. Fill in your serial number and MQTT-credentials and execute the script:
When the above is successful, you can continue with sending other type of messages. All messages are described below.
This section details the MQTT messaging format and payload requirements for setting up scheduled control of devices within the SmartgridOne Controller 's network.
Subscribe Topic: standard1/rp_one_s/remoteScheduleMetrics/<controller SN>
Feedback Topic: standard1/outbound/remoteScheduleMetrics/feedback/<controller SN>
Where <controller SN> should be replaced with the actual serial number of the SmartgridOne Controller you intend to control.
Creates a new schedule for a device type.
{
"extraTags" : {
"nodeId" : "<Controller SN>_site_0"
},
"time" : <Unix Timestamp> ,
"message_type" : "set_schedule" ,
"fields" : {
"device_type" : "<Device Type>" ,
"node_id" : "<Node ID>" (Optional) ,
"start_time" : <Unix
{
"requestTime" : <Unix Timestamp> ,
"time" : <Unix Timestamp> ,
"siteNodeId" : "<Controller SN>_site_0" ,
"data" : {
"message_type" : "set_schedule_ack" ,
"state" : {
"schedule_id" : <Schedule ID> ,
Creates multiple new schedules.
{
"extraTags" : {
"nodeId" : "<Controller SN>_site_0"
},
"time" : <Unix Timestamp> ,
"message_type" : "set_schedules" ,
"fields" :
"0" : "{
" device_type ": " <Device Type> ",
"
{
"requestTime" : <Unix Timestamp> ,
"time" : <Unix Timestamp> ,
"siteNodeId" : "<Controller SN>_site_0" ,
"data" : {
"message_type" : "set_schedules_ack" ,
"state" : {
"schedule_ids" : <Schedule IDs> ,
Retrieves a specific schedule by ID.
{
"extraTags" : {
"nodeId" : "<Controller SN>_site_0"
},
"time" : <Unix Timestamp> ,
"message_type" : "get_schedule" ,
"fields" : {
"id" : <Schedule ID>
}
} {
"requestTime" : <Unix Timestamp> ,
"time" : <Unix Timestamp> ,
"siteNodeId" : "<Controller SN>_site_0" ,
"data" : {
"message_type" : "get_schedule_ack" ,
"state" : <Schedule> ,
"responseCode" : 0
}
Retrieves the currently active schedule for a device type.
{
"extraTags" : {
"nodeId" : "<Controller SN>_site_0"
},
"time" : <Unix Timestamp> ,
"message_type" : "get_active_schedule" ,
"fields" : {
"device_type" : "<Device Type>" ,
"node_id" : "<Node ID>" (Optional) ,
}
} {
"requestTime" : <Unix Timestamp> ,
"time" : <Unix Timestamp> ,
"siteNodeId" : "<Controller SN>_site_0" ,
"data" : {
"message_type" : "get_active_schedule_ack" ,
"state" : <Schedule> ,
"responseCode" : 0
}
Retrieves the next upcoming schedule for a device type.
{
"extraTags" : {
"nodeId" : "<Controller SN>_site_0"
},
"time" : <Unix Timestamp> ,
"message_type" : "get_next_schedule" ,
"fields" : {
"device_type" : "<Device Type>" ,
"node_id" : "<Node ID>" (Optional) ,
}
} {
"requestTime" : <Unix Timestamp> ,
"time" : <Unix Timestamp> ,
"siteNodeId" : "<Controller SN>_site_0" ,
"data" : {
"message_type" : "get_next_schedule_ack" ,
"state" : <Schedule> ,
"responseCode" : 0
}
Retrieves all schedules for a specific date.
{
"extraTags" : {
"nodeId" : "<Controller SN>_site_0"
},
"time" : <Unix Timestamp> ,
"message_type" : "get_schedules" ,
"fields" : {
"date" : "<Date String of Format dd/mm/yyyy>"
}
} {
"requestTime" : <Unix Timestamp> ,
"time" : <Unix Timestamp> ,
"siteNodeId" : "<Controller SN>_site_0" ,
"data" : {
"message_type" : "get_schedules_ack" ,
"state" : {
"schedules" : [ <Schedule> , ...
Retrieves all future schedules.
{
"extraTags" : {
"nodeId" : "<Controller SN>_site_0"
},
"time" : <Unix Timestamp> ,
"message_type" : "get_future_schedules" ,
"fields" : {}
} {
"requestTime" : <Unix Timestamp> ,
"time" : <Unix Timestamp> ,
"siteNodeId" : "<Controller SN>_site_0" ,
"data" : {
"message_type" : "get_future_schedules_ack" ,
"state" : {
"schedules" : [ <Schedule> , ...
Removes a specific schedule by ID.
{
"extraTags" : {
"nodeId" : "<Controller SN>_site_0"
},
"time" : <Unix Timestamp> ,
"message_type" : "remove_schedule" ,
"fields" : {
"id" : <Schedule ID>
}
} {
"requestTime" : <Unix Timestamp> ,
"time" : <Unix Timestamp> ,
"siteNodeId" : "<Controller SN>_site_0" ,
"data" : {
"message_type" : "remove_schedule_ack" ,
"state" : "Schedule <Schedule ID> removed successfully" ,
"responseCode" : 0
}
Retrieves detailed feedback on the state of the system.
{
"extraTags" : {
"nodeId" : "<Controller SN>_site_0"
},
"time" : <Unix Timestamp> ,
"message_type" : "get_feedback" ,
"fields" : {
"device" : <Device (node) level>
}
} Gets the topology of the site.
{
"extraTags" : {
"nodeId" : "<Controller SN>_site_0"
},
"time" : <Unix Timestamp> ,
"message_type" : "get_topology" ,
"fields" : {}
} {
"requestTime" : <Unix Timestamp> ,
"time" : <Unix Timestamp> ,
"siteNodeId" : "<Controller SN>_site_0" ,
"data" : {
"message_type" : "get_topology_ack" ,
"state" : {
"nodeId" : <nodeId> ,
"nodeType" :
{
"id" : <Schedule ID> ,
"device_type" : "<Device Type>" ,
"node_id" : "<Node ID>" (Optional) ,
"start_time" : <Unix Timestamp> ,
"end_time" : <Unix Timestamp> ,
"policy" : "<Schedule Policy>"
For details about available components and policies that can be scheduled, refer to the section in the Live MQTT Control documentation.
Device-specific schedules can be sent using the optional node_id field, referring to the node ID of the controllable device.
All messages can return an error response with responseCode: 1 when an error occurs:
{
"requestTime" : <Unix Timestamp> ,
"time" : <Unix Timestamp> ,
"siteNodeId" : "<Controller SN>_site_0" ,
"data" : {
"message_type" : "<Message Type>_ack" ,
"error" : <Error Body> ,
"responseCode" :
When an unrelated error occurs, the message type will be (general_error).
Schedule overlap with existing schedules
Invalid time range
Device type not found
Schedule ID not found
Invalid policy for device type
Overlap Rules
Schedules cannot overlap for the same device type
Schedules cannot overlap for the same device
Schedules for the same device and device type cannot overlap
Existing, overlapping schedules will be deleted if the remove_overlap variable is set to True when creating a new schedule.
Each schedule must have:
A valid device type
A start time (Unix timestamp)
An end time (Unix timestamp)
A policy (matching the device type's available policies)
A power setpoint (for policies that require it)
Start time must be before end time
If the start time is in the past, it is automatically changed to start now
Schedules can only be deleted if they have not started yet. Active schedules cannot be deleted.
Schedules can be set for different device types independently
The system automatically applies the appropriate policy when a schedule becomes active
Timestamp>
,
"end_time" : <Unix Timestamp> ,
"policy" : "<Policy>" ,
"power_setpoint_w" : <Setpoint in watts> ,
"site_import" : <Site Import in Watts> ,
"site_export" : <Site Export in Watts> ,
"remove_overlap" : <True/False> (Optional) (default=False) ,
"tag" : <Tag String> (Optional) (default=None) ,
}
}
"deleted_ids" : <Schedulde IDs deleted if remove_overlap=True>
"tag" : <Tag String> (default=None) ,
},
"responseCode" : 0
}
}
node_id
": "
<Node
ID>
" (Optional),
" start_time ": <Unix Timestamp>,
" end_time ": <Unix Timestamp>,
" policy ": " <Policy> ",
" power_setpoint_w ": <Setpoint in watts>,
" site_import ": <Site Import in Watts>,
" site_export ": <Site Export in Watts>,
" remove_overlap ": <True/False> (Optional) (default=False),
}" ,
"1" : "{
" device_type ": " <Device Type> ",
" node_id ": " <Node ID> " (Optional),
" start_time ": <Unix Timestamp>,
" end_time ": <Unix Timestamp>,
" policy ": " <Policy> ",
" power_setpoint_w ": <Setpoint in watts>,
" site_import ": <Site Import in Watts>,
" site_export ": <Site Export in Watts>,
" remove_overlap ": <True/False> (Optional) (default=False),
}" ,
...
}
"deleted_ids" : <Schedulde IDs deleted if remove_overlap=True>
},
"responseCode" : 0
}
}
}
}
}
]
},
"responseCode" : 0
}
}
]
},
"responseCode" : 0
}
}
}
<nodeType>
,
"nomCurrent" : <nominalCurrent>
"children" : [{ <ChildObject> }]
},
"responseCode" : 0
}
}
,
"power_setpoint_w" : <Setpoint in watts> ,
Scheduled MQTT control | SmartgridOne Documentation "created_at" : <Unix Timestamp>
}
1
}
}