Endpoint
The endpoint object represents an endpoint within a device installed in the platform. Endpoints are normally accessed through the endpoints property of the device object.
Properties
### address (string) The address property represents the address of the endpoint, as text.
Examples
This example shows the address of the first endpoint of a device, through the log console.
env.log('Endoint address: ', myDevice.endpoints.byIndex(0).address);### description (string) The description property represents the description of the endpoint.
Examples
This example shows the description of the first endpoint of a device, through the log console.
env.log('Endoint description: ', myDevice.endpoints.byIndex(0).description);### endpointType (int enum)
The endpointType property indicates the endpoint type. The possible values for this property are as follows:
- endpointType.appliance (1): the endpoint is of on/off type, meaning it can be turned on and off, such as a lamp without brightness control, a valve, a water pump, etc.
- endpointType.dimmer (2): the endpoint can be turned on and off, but its brightness can also be controlled.
- endpointType.lightSensor (4): the endpoint is a light sensor.
- endpointType.colorDimmer (7): the endpoint is capable of controlling chromatic light (RGB or similar).
- endpointType.closureController (10): the endpoint is a valve, curtain, or closure controller that can be opened, closed, and positioned.
- endpointType.curtainController (10): equivalent to endpointType.closureController. This value exists for backward compatibility.
- endpointType.thermostat (12): the endpoint is a thermostat.
- endpointType.camera (13): the endpoint is a camera.
- endpointType.temperatureSensor (14): the endpoint is a temperature sensor.
- endpointType.energyMeter (17): the endpoint is an energy meter.
- endpointType.doorLock (19): the endpoint is an electronic lock.
- endpointType.iasSensor (20): the endpoint is an intrusion, presence, motion, or any other security sensor that has a discrete number of states.
- endpointType.locationTracker (22): the endpoint is a position tracker (GPS).
- endpointType.humiditySensor (23): the endpoint is a humidity sensor.
- endpointType.volumeSensor (24): the endpoint is a volume sensor.
- endpointType.weightSensor (25): the endpoint is a weight sensor.
- endpointType.pressureSensor (26): the endpoint is a pressure sensor.
- endpointType.flowSensor (27): the endpoint is a flow sensor for liquids or gases, meaning the flow unit is a volume.
- endpointType.genericSensor (28): the endpoint is a generic scalar sensor, for which units can be chosen arbitrarily.
- endpointType.genericFlowSensor (29): the endpoint is a generic flow sensor of some other type, for which units can be chosen arbitrarily.
- endpointType.voltageSensor (30): the endpoint is a voltage sensor (voltmeter).
- endpointType.currentSensor (31): the endpoint is a current sensor (ammeter).
- endpointType.activePowerSensor (32): the endpoint is an active power sensor.
- endpointType.reactivePowerSensor (33): the endpoint is a reactive power sensor.
- endpointType.apparentPowerSensor (34): the endpoint is an apparent power sensor.
- endpointType.cosPhiSensor (35): the endpoint is a power factor sensor.
- endpointType.frequencyMeter (36): the endpoint is a frequency sensor (frequency meter).
- endpointType.runTimeMeter (37): the endpoint is a usage time meter (hour meter / run time meter).
- endpointType.ppmConcentrationSensor (38): the endpoint is a concentration sensor, expressed in parts per million (ppm).
- endpointType.mvConcentrationSensor (39): the endpoint is a concentration sensor, expressed in mass per volume units.
- endpointType.airQualityIndexSensor: the endpoint is an air quality sensor (AQI).
- endpointType.peopleFlowSensor (41): the endpoint is a people flow sensor, meaning it can detect the entry and/or exit of people.
- endpointType.peopleCounter (42): the endpoint is a people count sensor, meaning it can detect how many people are present in a given area.
- endpointType.textContainer (43): the endpoint is a text sensor, meaning it can store any text up to 255 characters in length.
Examples
This example shows the endpoint type of the first endpoint of a device, through the log console.
env.log('Endoint type: ', myDevice.endpoints.byIndex(0).endpointType);### endpointSubType (int enum)
The endpointSubType property indicates the endpoint subtype. The subtype can only be specified for certain endpoint types, as indicated below. The possible values for this property are as follows:
For endpoints of type endpointType.appliance:
- applianceEndpointSubType.lamp (1): indicates that the endpoint is a lamp.
- applianceEndpointSubType.valve (2): indicates that the endpoint is a valve.
- applianceEndpointSubType.socket (3): indicates that the endpoint is a socket or plug-in switch.
- applianceEndpointSubType.pump (4): indicates that the endpoint is a water or other liquid pump.
- applianceEndpointSubType.sprinkler (5): indicates that the endpoint is a sprinkler or irrigation circuit.
- applianceEndpointSubType.fan (6): indicates that the endpoint is a fan.
For endpoints of type endpointType.iasSensor:
- iasEndpointSubType.motionSensor (1): indicates that the endpoint is a motion sensor.
- iasEndpointSubType.doorSensor (2): indicates that the endpoint is a door or window sensor.
- iasEndpointSubType.floodSensor (3): indicates that the endpoint is a flood detector.
- iasEndpointSubType.presenceSensor (4): indicates that the endpoint is a presence sensor.
- iasEndpointSubType.alarmInput (5): indicates that the endpoint is an alarm sensor.
- iasEndpointSubType.coSensor (6): indicates that the endpoint is a carbon monoxide sensor.
- iasEndpointSubType.co2Sensor (7): indicates that the endpoint is a carbon dioxide sensor.
- iasEndpointSubType.gasSensor (8): indicates that the endpoint is a sensor for other types of gases.
- iasEndpointSubType.smokeDetector (9): indicates that the endpoint is a smoke sensor.
- iasEndpointSubType.parkingSensor (10): indicates that the endpoint is a vehicular parking sensor.
For endpoints of type endpointType.ppmConcentrationSensor:
- ppmConcentrationSensorSubType.ammonia (1): indicates that the endpoint is an ammonia sensor.
- ppmConcentrationSensorSubType.Ozone (2): indicates that the endpoint is an ozone sensor.
- ppmConcentrationSensorSubType.nitricOxide (3): indicates that the endpoint is a nitric oxide sensor.
- ppmConcentrationSensorSubType.nitrogenDioxide (4): indicates that the endpoint is a nitrogen dioxide sensor.
- ppmConcentrationSensorSubType.sulfurDioxide (5): indicates that the endpoint is a sulfur dioxide sensor.
- ppmConcentrationSensorSubType.carbonMonoxide (6): indicates that the endpoint is a carbon monoxide sensor.
- ppmConcentrationSensorSubType.carbonDioxide (7): indicates that the endpoint is a carbon dioxide sensor.
- ppmConcentrationSensorSubType.voc (8): indicates that the endpoint is a volatile organic compounds sensor.
For endpoints of type endpointType.mvConcentrationSensor:
- mvConcentrationSensorSubType.lead (1): indicates that the endpoint is a lead sensor.
- mvConcentrationSensorSubType.pm2_5 (2): indicates that the endpoint detects particulate matter up to 2.5 microns.
- mvConcentrationSensorSubType.pm10 (3): indicates that the endpoint detects particulate matter up to 10 microns.
Examples
This example shows the endpoint subtype of the first endpoint of a device, through the log console.
env.log('Endoint subtype: ', myDevice.endpoints.byIndex(0).endpointSubType);### accessType (int enum)
The accessType property indicates the type of access applied to the endpoint. The possible values for this property are as follows:
- endpointAccessType.readOnly (1): indicates that the value associated with the endpoint cannot be modified manually.
- endpointAccessType.readWrite (2): indicates that the value associated with the endpoint can be modified manually. When doing so, the new value will be recorded immediately, without interacting with the device.
- endpointAccessType.readWriteCommand (3): indicates that the value associated with the endpoint can be modified manually. When doing so, a command will be sent to the device to change the value. It is the device's responsibility to report the new value upon accepting the command.
Examples
This example shows the accessType property value of the first endpoint of a device, through the log console.
env.log('Endoint access type: ', myDevice.endpoints.byIndex(0).accessType);### operationSecurityLevel (int enum)
The operationSecurityLevel property indicates the security level associated with the endpoint operation. The possible values for this property are as follows:
- endpointOperationSecurityLevel.simple (1): indicates that the endpoint can be operated directly. No warning message or user confirmation is required. In user interfaces, when operating the endpoint, the corresponding command is sent immediately.
- endpointOperationSecurityLevel.medium (2): indicates that to operate the endpoint, a confirmation message must first be displayed, along with the corresponding options to accept or cancel the operation. The message is configurable at the individual endpoint level, but is optional. If no message is specified, a default confirmation message will be used.
- endpointOperationSecurityLevel.high (3): indicates that to operate the endpoint, the confirmation corresponding to the medium security level is required, but additionally the user is asked to re-enter their password.
Examples
This example shows the operationSecurityLevel property value of the first endpoint of a device, through the log console.
env.log('Endoint access type: ', myDevice.endpoints.byIndex(0).operationSecurityLevel);### tags (array) The tags property indicates the set of tags applied to the endpoint. This property is an array of strings, each of which indicates a tag.
Examples
This example shows the list of tags of the first endpoint of a device.
myDevice.endpoints.byIndex(0).tags.forEach(item => env.log(item));Methods
### getCurrentState() The getCurrentState() method allows obtaining the current state of the endpoint.
Parameters
This method has no parameters.
Result
The value returned by the method is a DataPoint object that represents the current state of the endpoint. If the current state of the endpoint has not yet been established, the returned value is null.
Example 1
This example shows the current temperature at an endpoint.
env.log(myDevice.endpoints.byIndex(0).getCurrentState().value);### updateTemperatureSensorStatus(temperature [, utcDateTime]) The updateTemperatureSensorStatus() method allows updating the value of a temperature sensor, optionally specifying the date and time of the update.
Parameters
- temperature (double): this parameter indicates the measured temperature, in degrees Celsius.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a temperature of 32 degrees Celsius on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateTemperatureSensorStatus(32);### updateHumiditySensorStatus(humidity [, utcDateTime]) The updateHumiditySensorStatus() method allows updating the value of a humidity sensor, optionally specifying the date and time of the update.
Parameters
- humidity (double): this parameter indicates the measured humidity, as a percentage.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a humidity of 47% on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateHumiditySensorStatus(47);### updateLightSensorStatus(lightIntensity [, utcDateTime]) The updateLightSensorStatus() method allows updating the value of a light sensor, optionally specifying the date and time of the update.
Parameters
- lightIntensity (double): this parameter indicates the measured light intensity, expressed in lux.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a light intensity of 7550 lux on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateLightSensorStatus(7550);### updateWeightSensorStatus(weightGrams [, utcDateTime]) The updateWeightSensorStatus() method allows updating the value of a weight sensor, optionally specifying the date and time of the update.
Parameters
- weightGrams (double): this parameter indicates the measured weight, in grams.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a weight of 72.5 kg on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateWeightSensorStatus(72500);### updateVolumeSensorStatus(volumeLiters [, utcDateTime]) The updateVolumeSensorStatus() method allows updating the value of a volume sensor, optionally specifying the date and time of the update.
Parameters
- volumeLiters (double): this parameter indicates the measured volume, in liters.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a volume of 15,000 liters on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateVolumeSensorStatus(15000);### updatePressureSensorStatus(pressurePascals [, utcDateTime]) The updatePressureSensorStatus() method allows updating the value of a pressure sensor, optionally specifying the date and time of the update.
Parameters
- pressurePascals (double): this parameter indicates the measured pressure, in Pascals.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a pressure of 1013 hectopascals (101300 pascals) on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updatePressureSensorStatus(101300);### updateIASSensorStatus(state [, utcDateTime]) The updateIASSensorStatus() method allows updating the state of an IAS sensor, optionally specifying the date and time of the update.
Parameters
- state (int): this parameter indicates the sensor state, among the following:
- iasSensorState.Unknown (0): Unknown. The sensor state is not known.
- iasSensorState.idle (1): Idle. The sensor registers no activity.
- iasSensorState.active (2): Active. The sensor registers activity.
- iasSensorState.cleaning (3): Cleaning. The space associated with the sensor is being cleaned.
- iasSensorState.cleaningNeeded (4): Cleaning needed. The space associated with the sensor needs cleaning.
- iasSensorState.testMode (5): Test mode. The sensor is currently in test mode.
- iasSensorState.tampered (6): The sensor has been tampered with and may not be functioning correctly.
- iasSensorState.maintenanceNeeded (7): The sensor requires maintenance and may not be functioning correctly.
- iasSensorState.entering (8): The sensor detects that a vehicle is entering the parking space.
- iasSensorState.leaving(9): The sensor detects that a vehicle is leaving the parking space.
- iasSensorState.violation(10): The sensor reports that the parking space is in violation.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report the idle state on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateIASSensorStatus(1);### updateVoltageSensorStatus(voltageVolts [, utcDateTime]) The updateVoltageSensorStatus() method allows updating the state of a voltage sensor, optionally specifying the date and time of the update.
Parameters
- voltageVolts (double): this parameter indicates the measured voltage, in Volts.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a measurement of 235V on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateVoltageSensorStatus(235);### updateCurrentSensorStatus(currentAmps [, utcDateTime]) The updateCurrentSensorStatus() method allows updating the state of a current sensor, optionally specifying the date and time of the update.
Parameters
- currentAmps (double): this parameter indicates the measured current, in Amperes.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a measurement of 19.5A on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateCurrentSensorStatus(19.5);### updateActivePowerSensorStatus(activePowerWatts [, utcDateTime]) The updateActivePowerSensorStatus() method allows updating the state of an active power sensor, optionally specifying the date and time of the update.
Parameters
- activePowerWatts (double): this parameter indicates the measured active power, in Watts.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a measurement of 1250W on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateActivePowerSensorStatus(1250);### updateReactivePowerSensorStatus(reactivePowerVAR [, utcDateTime]) The updateReactivePowerSensorStatus() method allows updating the state of a reactive power sensor, optionally specifying the date and time of the update.
Parameters
- reactivePowerVAR (double): this parameter indicates the measured reactive power, in Volt-Ampere-Reactive (VAR).
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a measurement of 750VAR on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateReactivePowerSensorStatus(750);### updateApparentPowerSensorStatus(apparentPowerVA [, utcDateTime]) The updateApparentPowerSensorStatus() method allows updating the state of an apparent power sensor, optionally specifying the date and time of the update.
Parameters
- apparentPowerVA (double): this parameter indicates the measured apparent power, in Volt-Ampere (VA).
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a measurement of 1300VA on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateApparentPowerSensorStatus(1300);### updateCosPhiSensorStatus(cosPhi [, utcDateTime]) The updateCosPhiSensorStatus() method allows updating the state of a cosine phi (power factor) sensor, optionally specifying the date and time of the update.
Parameters
- cosPhi (double): this parameter indicates the measured cosine phi.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a cosine phi measurement of 0.98 on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateCosPhiSensorStatus(0.98);### updateFrequencySensorStatus(frequencyHz [, utcDateTime]) The updateFrequencySensorStatus() method allows updating the state of a frequency sensor (frequency meter), optionally specifying the date and time of the update.
Parameters
- frequencyHz (double): this parameter indicates the measured frequency, in Hz.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a frequency measurement of 60Hz on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateFrequencySensorStatus(60);### updateGenericSensorStatus(value [, utcDateTime]) The updateGenericSensorStatus() method allows updating the state of a generic scalar sensor, optionally specifying the date and time of the update.
Parameters
- value (double): this parameter indicates the measured value, in the units selected for the endpoint.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a measurement of value 1234 on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateGenericSensorStatus(1234);### updatePpmConcentrationSensorStatus(value [, utcDateTime]) The updatePpmConcentrationSensorStatus() method allows updating the state of a concentration measurement sensor, optionally specifying the date and time of the update. This function is only valid for concentration sensors expressed as parts per million (ppm).
Parameters
- value (double): this parameter indicates the measured value, in parts per million (ppm).
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a measurement of value 1234 ppm on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updatePpmConcentrationSensorStatus(1234);### updateMvConcentrationSensorStatus(value [, utcDateTime]) The updateMvConcentrationSensorStatus() method allows updating the state of a concentration measurement sensor, optionally specifying the date and time of the update. This function is only valid for concentration sensors expressed as mass per volume ratio (m/v).
Parameters
- value (double): this parameter indicates the measured value, in micrograms per cubic meter (ug/m3).
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a measurement of value 1234 ug/m3 on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateMvConcentrationSensorStatus(1234);### updateAqiSensorStatus(value [, utcDateTime]) The updateAqiSensorStatus() method allows updating the state of an air quality sensor, optionally specifying the date and time of the update.
Parameters
- value (double): this parameter indicates the measured value, according to the AQI scale (0-500).
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a measurement of value 123 on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateAqiSensorStatus(123);### updateApplianceStatus(turnedOn[, utcDateTime]) The updateApplianceStatus() method allows updating the state of an on-off type endpoint (appliance), optionally specifying the date and time of the update.
Parameters
- turnedOn (boolean): this parameter indicates whether the endpoint is turned on (true) or off (false).
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the update. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report that the first endpoint of a device is turned on.
myDevice.endpoints.byIndex(0).updateApplianceStatus(true);### updateDimmerStatus(turnedOn, level[, utcDateTime]) The updateDimmerStatus() method allows updating the state of a dimmer type endpoint, optionally specifying the date and time of the update.
Parameters
- turnedOn (boolean): this parameter indicates whether the endpoint is turned on (true) or off (false).
- level (int): this parameter indicates the brightness level, between 1% (minimum) and 100% (maximum), regardless of whether the dimmer is turned on or off.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the update. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report that the first endpoint of a device is turned on at 75%.
myDevice.endpoints.byIndex(0).updateDimmerStatus(true, 75);### updateClosureControllerStatus(moving, position[, utcDateTime]) The updateClosureControllerStatus() method allows updating the state of a closure type endpoint (curtain, motorized gate, etc.), optionally specifying the date and time of the update.
Parameters
- moving (boolean): this parameter indicates whether the closure is currently in motion (opening or closing). The value true indicates it is moving, while the value false indicates it is stopped.
- position (int): this parameter indicates the current position, from 0% (closed) to 100% (open).
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the update. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report that the first endpoint of a device is stopped in the "open" position.
myDevice.endpoints.byIndex(0).updateClosureControllerStatus(false, 100);### updateHVACStatus(mode, fanMode, setpoint, ambientTemperature[, utcDateTime]) The updateHVACStatus() method allows updating the state of an HVAC device, such as a thermostat, optionally specifying the date and time of the update.
Parameters
- mode (enum): current mode of the device:
- thermostatMode.off = 1: the device is off.
- thermostatMode.auto = 2: the device is on in automatic mode.
- thermostatMode.heat = 3: the device is on in heat mode.
- thermostatMode.cool = 4: the device is on in cool mode.
- thermostatMode.dry = 5: the device is on in dehumidification mode.
- thermostatMode.fan = 6: the device is on in fan mode.
- fanMode (enum): indicates the current fan mode:
- thermostatFanMode.auto = 1: the fan is in auto mode.
- thermostatFanMode.low = 2: the fan is at low speed.
- thermostatFanMode.mid = 3: the fan is at medium speed.
- thermostatFanMode.high = 4: the fan is at high speed.
- setpoint (number): indicates the desired temperature value, in degrees Celsius.
- ambientTemperature (number): indicates the ambient temperature value, in degrees Celsius.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the update. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report that the first endpoint of a device is on in cool mode, with the fan at automatic speed, a desired temperature of 25 degrees Celsius, and an ambient temperature of 26 degrees Celsius.
myDevice.endpoints.byIndex(0).updateHVACStatus(thermostatMode.cool, thermostatFanMode.auto, 25, 27);### updateLocationTrackerStatus(latitude, longitude [, altitude, flags, utcDateTime]) The updateLocationTrackerStatus() method allows updating the state of a location tracker, optionally specifying the date and time of the update.
Parameters
- latitude (double): Indicates the latitude. The value must be between -90 and 90. The decimal separator is a period.
- longitude (double): Indicates the longitude. The value must be between -180 and 180. The decimal separator is a period.
- altitude (double): Indicates the altitude. Numeric value. The decimal separator is a period.
- flags (int, optional): Indicates extra information for the position. It is an integer value representing a bitwise sum. The available states are:
- locationTrackerFlags.none (0): Nothing special
- locationTrackerFlags.moving (1): The sensor position is changing
- locationTrackerFlags.noPosition (2): The sensor cannot acquire the position
- locationTrackerFlags.malfunctioning (4): The sensor is not functioning correctly. The reported position may be incorrect
- locationTrackerFlags.lowPrecision (8): The reported position has low precision
Values can be combined through the OR operation. For example, to indicate that the reported position has low precision and the position is changing, use (8 OR 1) = 9.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a location with latitude -13.9957594 and longitude 48.933938 on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateLocationTrackerStatus(-13.9957594, 48.933938);Example 2
This example shows how to report a location with latitude -13.9957594, longitude 48.933938, and altitude 123 on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateLocationTrackerStatus(-13.9957594, 48.933938, 123);Example 3
This example shows how to report a location with latitude -13.9957594, longitude 48.933938, altitude 123, and flag 1 (the sensor position is changing) on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateLocationTrackerStatus(-13.9957594, 48.933938, 123, locationTrackerFlags.moving);Example 4
This example shows how to report a location with latitude -13.9957594, longitude 48.933938, and a specific timestamp on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateLocationTrackerStatus(-13.9957594, 48.933938, 0, locationTrackerFlags.none, '2021-02-23T14:55:03');### updateEnergySensorValueSummation(activeEnergySummationWh, reactiveEnergySummationVARh [, utcDateTime]) The updateEnergySensorValueSummation() method allows updating the active and reactive energy summation of an energy sensor, optionally specifying the date and time of the update.
Parameters
- activeEnergySummationWh (double): Indicates the current value of the active energy summation, expressed in Wh.
- reactiveEnergySummationVARh (double): Indicates the current value of the reactive energy summation, expressed in VARh.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a cumulative active and reactive energy of 14650 Wh and 1280 VARh respectively, on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateEnergySensorValueSummation(14650, 1280);### updateEnergySensorValueUnits(activeEnergyWh, reactiveEnergyVARh [, utcDateTime]) The updateEnergySensorValueUnits() method allows adding an active and reactive energy consumption value from an energy sensor, optionally specifying the date and time of the update.
Parameters
- activeEnergyWh (double): indicates the amount of active energy consumed, expressed in Wh. This value will be added to the previously recorded active energy consumption.
- reactiveEnergyVARh (double): Indicates the amount of reactive energy consumed, expressed in VARh. This value will be added to the previously recorded reactive energy consumption.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a consumption of 160 Wh and 22 VARh respectively, on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateEnergySensorValueUnits(160, 22);### updateFlowSensorValueSummation(summationValue, [, utcDateTime]) The updateFlowSensorValueSummation() method allows updating the flow summation of a flow sensor, generic flow sensor, or people flow sensor, optionally specifying the date and time of the update.
Parameters
- summationValue (double): Indicates the current value of the flow summation.
- For flow sensors, the value must be expressed in liters.
- For generic flow sensors, the value must be expressed in the unit associated with the variable chosen for the sensor.
- For people flow sensors, the value is indicated in people.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a cumulative flow of 14650 liters on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateFlowSensorValueSummation(14650);### updateFlowSensorValueUnits(value, [, utcDateTime]) The updateFlowSensorValueUnits() method allows adding a value to the flow recorded by a flow sensor, generic flow sensor, or people flow sensor, optionally specifying the date and time of the update.
Parameters
- value (double): indicates the recorded flow value. This value will be added to the previously recorded value.
- For flow sensors, the value must be expressed in liters.
- For generic flow sensors, the value must be expressed in the unit associated with the variable chosen for the sensor.
- For people flow sensors, the value is indicated in people.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to report a flow of 182 liters on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateFlowSensorValueUnits(182);### updateTextContainerStatus(text, [, utcDateTime]) The updateTextContainerStatus() method allows adding text up to 255 characters in length.
Parameters
- text: Indicates the text to be added.
- utcDateTime (date, optional): this parameter indicates the UTC date and time of the sample. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to add text.
myDevice.endpoints.byIndex(0).updateTextContainerStatus("Sample text for text container endpoint");### uploadCameraSnapshot(base64Content, fileType, [, utcDateTime]) The uploadCameraSnapshot() method allows storing an image obtained from a camera.
Parameters
- base64Content: the text, in base64 format, corresponding to the binary content of the image.
- fileType: indicates the image type. Accepted values are "jpg" and "png".
- utcDateTime (date, optional): this parameter indicates the UTC date and time when the image was taken. If the parameter is omitted, the current date and time will be assumed.
Example 1
This example shows how to upload a camera snapshot.
myDevice.endpoints.byIndex(0).uploadCameraSnapshot("VGhpcyBpcyBzb21lIHRleHQ....[more text].....", "jpg");