Device Management
This section of the Device API describes the actions that can be performed on devices.
Update Device
PATCH devices/{device_id}
Updates device information. This operation requires at least the OWNER access level.
Request
$ curl -X PATCH \
http://api.enapter.com/v3/devices/devicea0-45f2-4e9e-a6f0-69a310ab110b \
-H 'X-Enapter-Auth-Token: {ACCESS_TOKEN}' \
-d '{
"name": "Hydrogen detector"
}'
Body Parameters
namestringrequired#A new device name.
slugstringrequired#A new device slug.
Response
Updated device.
{
"device": {
"id": "devicea0-45f2-4e9e-a6f0-69a310ab110b",
"blueprint_id": "bluepri1-50n3-4t9d-e6v0-69i310cb110e",
"name": "Hydrogen detector",
"site_id": "sitebba0-79f2-4e9e-a6f0-69a310ab110b",
"updated_at": 1735689600,
"slug": "gas-detector-in-living-room",
"type": "LUA",
"authorized_role": "INSTALLER"
}
}
deviceobject#Object containing device information.
device.idstring#Device ID.
device.blueprint_idstring#Blueprint ID.
device.site_idstring#Site ID.
device.namestring#Device name.
device.updated_atinteger#The timestamp of the most recent update of the device’s information.
device.authorized_rolestring#The user's authorized role for the device.
device.slugstring#
device.typestring#One of the following types:
STANDALONE– device that operates independently without needing to be connected to a Gateway or other Enapter hardware.GATEWAY– device that connects Enapter energy systems to the Enapter Cloud for data communication, remote monitoring and control.EMBEDDED_UCM– communication module, which embedded into Enapter devices UCM,HARDWARE_UCM– Enapter Universal Communication Module (UCM),VIRTUAL_UCM– Enapter virtual UCM,LINK_MASTER_UCM, – Enapter LINK master device,LINK_SLAVE_UCM– Enapter UCM, connected to Enapter LINK master device,LUA– a third-party device, which connected to Enapter UCM and controlled by a Lua script,NATIVE– Enapter device like Electrolyser or Dryer.
device.implemented_profilesarray of strings#A list of profiles implemented by the device. You can also find them in the device's manifest.
Expanded fields
device.propertiesobject#Device's properties.
device.communicationobject#Device's communication info.
UCM_LUAorUCM_EMBBEDEDOther communication types communication.upstream_idstring#- Device ID of upstream device.
communication.upstream_idstring#- Device ID of upstream device.
communication.typestring#- A type of communication to the Enapter EMS:
-MQTT_V1_PLAINTEXT– unencrypted MQTT connection,
-MQTT_V1_TLS– encrypted MQTT connection (MQTTS),
-MQTT_V1_LOCALHOST– connected to a local MQTT server,
-UCM_LUA– connected to Enapter UCM, hardware or virtual,
-UCM_EMBEDDED– via embedded UCM,
-LINK– via Enapter LINK.
communication.typestring#- A type of communication to the Enapter EMS:
-MQTT_V1_PLAINTEXT– unencrypted MQTT connection,
-MQTT_V1_TLS– encrypted MQTT connection (MQTTS),
-MQTT_V1_LOCALHOST– connected to a local MQTT server,
-UCM_LUA– connected to Enapter UCM, hardware or virtual,
-UCM_EMBEDDED– via embedded UCM,
-LINK– via Enapter LINK.
communication.hardware_idstring#- Device hardware ID.
communication.channel_idstring#- Device channel ID.
Delete Device
DELETE devices/{device_id}
Deletes device. This operation requires at least the OWNER access level.
It's not possible to delete an upstream device with running device(s). You need to delete the running device(s) first.
Request
$ curl -X DELETE \
http://api.enapter.com/v3/devices/devicea0-45f2-4e9e-a6f0-69a310ab110b \
-H 'X-Enapter-Auth-Token: {ACCESS_TOKEN}'
Generate Device Configuration
POST devices/{device_id}/generate_config
Generates a new configuration for connecting to the Enapter Cloud.
It's not possible to generate a configuration for devices with communication types UCM_LUA or UCM_EMBEDDED.
Request
$ curl -X POST \
http://api.enapter.com/v3/devices/fecbbba0-79f2-4e9e-a6f0-69a310ab110b/generate_config \
-H 'X-Enapter-Auth-Token: {ACCESS_TOKEN}' \
-d '{
"protocol": "MQTTS"
}'
Body Parameters
protocolstring#Can be
MQTTorMQTTS.
Response
A new device configuration.
MQTTS
{
"config": {
"mqtt_host": "mqtt.enapter.com",
"mqtt_port": 8883,
"mqtt_credentials": {
"private_key": "...",
"certificate": "...",
"ca_chain": "..."
},
"mqtt_protocol": "MQTTS",
"time_sync_protocol": "HTTP",
"time_sync_host": "127.0.0.1",
"time_sync_port": 80,
"hardware_id": "C8795CBA5375484E829105E959663C8B",
"channel_id": "ucm"
}
}
MQTT
{
"config": {
"mqtt_host": "mqtt.enapter.com",
"mqtt_port": 1883,
"mqtt_credentials": {
"username": "...",
"password": "..."
},
"mqtt_protocol": "MQTT",
"time_sync_protocol": "HTTP",
"time_sync_host": "127.0.0.1",
"time_sync_port": 80,
"hardware_id": "C8795CBA5375484E829105E959663C8B",
"channel_id": "ucm"
}
}
configobject#Object containing a device communication configuration information.
config.mqtt_hoststring#Enapter Cloud MQTT broker host.
config.mqtt_postinteger#Enapter Cloud MQTT broker port.
config.mqtt_protocolstring#MQTTorMQTTS.
config.mqtt_credentialsobject#Contains either MQTT or MQTTS protocol credentials.
MQTT MQTTS mqtt_credentials.usernamestring#- Enapter Cloud MQTT broker username.
mqtt_credentials.private_keystring#- Enapter Cloud MQTT broker private key.
mqtt_credentials.passwordstring#- Enapter Cloud MQTT broker password.
mqtt_credentials.certificatestring#- Enapter Cloud MQTT broker certificate.
mqtt_credentials.ca_chainstring#- Enapter Cloud MQTT broker certificate chain.
config.time_sync_protocolstring#Time synchronization protocol.
config.time_sync_hoststring#Time synchronization host.
config.time_sync_portinteger#Time synchronisation server port.
config.hardware_idstring#Device hardware ID.
config.channel_idstring#Device channel ID.
Change Blueprint
POST devices/{device_id}/assign_blueprint
Changes blueprint of a specified device.
Request
$ curl -X POST \
http://api.enapter.com/v3/devices/fecbbba0-79f2-4e9e-a6f0-69a310ab110b/assign_blueprint \
-H 'X-Enapter-Auth-Token: {ACCESS_TOKEN}' \
-d '{
"blueprint_id": "bluepri2-60n4-4t9d-e6v0-69i310cb110e"
}'
Response
An updated device.
{
"device": {
"id": "devicea0-45f2-4e9e-a6f0-69a310ab110b",
"blueprint_id": "bluepri2-60n4-4t9d-e6v0-69i310cb110e",
"name": "Gas detector in living room",
"site_id": "sitebba0-79f2-4e9e-a6f0-69a310ab110b",
"updated_at": 1735693200,
"slug": "gas-detector-in-living-room",
"type": "LUA",
"authorized_role": "INSTALLER"
}
}
deviceobject#Object containing device information.
device.idstring#Device ID.
device.blueprint_idstring#Blueprint ID.
device.site_idstring#Site ID.
device.namestring#Device name.
device.updated_atinteger#The timestamp of the most recent update of the device’s information.
device.authorized_rolestring#The user's authorized role for the device.
device.slugstring#
device.typestring#One of the following types:
STANDALONE– device that operates independently without needing to be connected to a Gateway or other Enapter hardware.GATEWAY– device that connects Enapter energy systems to the Enapter Cloud for data communication, remote monitoring and control.EMBEDDED_UCM– communication module, which embedded into Enapter devices UCM,HARDWARE_UCM– Enapter Universal Communication Module (UCM),VIRTUAL_UCM– Enapter virtual UCM,LINK_MASTER_UCM, – Enapter LINK master device,LINK_SLAVE_UCM– Enapter UCM, connected to Enapter LINK master device,LUA– a third-party device, which connected to Enapter UCM and controlled by a Lua script,NATIVE– Enapter device like Electrolyser or Dryer.
device.implemented_profilesarray of strings#A list of profiles implemented by the device. You can also find them in the device's manifest.
Expanded fields
device.propertiesobject#Device's properties.
device.communicationobject#Device's communication info.
UCM_LUAorUCM_EMBBEDEDOther communication types communication.upstream_idstring#- Device ID of upstream device.
communication.upstream_idstring#- Device ID of upstream device.
communication.typestring#- A type of communication to the Enapter EMS:
-MQTT_V1_PLAINTEXT– unencrypted MQTT connection,
-MQTT_V1_TLS– encrypted MQTT connection (MQTTS),
-MQTT_V1_LOCALHOST– connected to a local MQTT server,
-UCM_LUA– connected to Enapter UCM, hardware or virtual,
-UCM_EMBEDDED– via embedded UCM,
-LINK– via Enapter LINK.
communication.typestring#- A type of communication to the Enapter EMS:
-MQTT_V1_PLAINTEXT– unencrypted MQTT connection,
-MQTT_V1_TLS– encrypted MQTT connection (MQTTS),
-MQTT_V1_LOCALHOST– connected to a local MQTT server,
-UCM_LUA– connected to Enapter UCM, hardware or virtual,
-UCM_EMBEDDED– via embedded UCM,
-LINK– via Enapter LINK.
communication.hardware_idstring#- Device hardware ID.
communication.channel_idstring#- Device channel ID.