端点
The endpoint object represents an endpoint within a device installed in the platform. 端点 are normally accessed through the endpoints property of the device object.
属性
address (string) The address property represents the address of the endpoint, as text.
示例
此示例 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.
示例
此示例 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.light传感器 (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.temperature传感器 (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.ias传感器 (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.humidity传感器 (23): the endpoint is a humidity sensor.
- endpointType.volume传感器 (24): the endpoint is a volume sensor.
- endpointType.weight传感器 (25): the endpoint is a weight sensor.
- endpointType.按下ure传感器 (26): the endpoint is a 按下ure sensor.
- endpointType.flow传感器 (27): the endpoint is a flow sensor for liquids or gases, meaning the flow unit is a volume.
- endpointType.generic传感器 (28): the endpoint is a generic scalar sensor, for which units can be chosen arbitrarily.
- endpointType.genericFlow传感器 (29): the endpoint is a generic flow sensor of some other type, for which units can be chosen arbitrarily.
- endpointType.voltage传感器 (30): the endpoint is a voltage sensor (voltmeter).
- endpointType.current传感器 (31): the endpoint is a current sensor (ammeter).
- endpointType.activePower传感器 (32): the endpoint is an active power sensor.
- endpointType.reactivePower传感器 (33): the endpoint is a reactive power sensor.
- endpointType.apparentPower传感器 (34): the endpoint is an apparent power sensor.
- endpointType.cosPhi传感器 (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.ppmConcentration传感器 (38): the endpoint is a concentration sensor, ex按下ed in parts per million (ppm).
- endpointType.mvConcentration传感器 (39): the endpoint is a concentration sensor, ex按下ed in mass per volume units.
- endpointType.airQualityIndex传感器: the endpoint is an air quality sensor (AQI).
- endpointType.peopleFlow传感器 (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.
示例
此示例 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 下方. The possible values for this property are as follows:
For endpoints of type endpointType.appliance:
- appliance端点SubType.lamp (1): indicates that the endpoint is a lamp.
- appliance端点SubType.valve (2): indicates that the endpoint is a valve.
- appliance端点SubType.socket (3): indicates that the endpoint is a socket or plug-in switch.
- appliance端点SubType.pump (4): indicates that the endpoint is a water or other liquid pump.
- appliance端点SubType.sprinkler (5): indicates that the endpoint is a sprinkler or irrigation circuit.
- appliance端点SubType.fan (6): indicates that the endpoint is a fan.
For endpoints of type endpointType.ias传感器:
- ias端点SubType.motion传感器 (1): indicates that the endpoint is a motion sensor.
- ias端点SubType.door传感器 (2): indicates that the endpoint is a door or window sensor.
- ias端点SubType.flood传感器 (3): indicates that the endpoint is a flood detector.
- ias端点SubType.presence传感器 (4): indicates that the endpoint is a presence sensor.
- ias端点SubType.alarmInput (5): indicates that the endpoint is an alarm sensor.
- ias端点SubType.co传感器 (6): indicates that the endpoint is a carbon monoxide sensor.
- ias端点SubType.co2传感器 (7): indicates that the endpoint is a carbon dioxide sensor.
- ias端点SubType.gas传感器 (8): indicates that the endpoint is a sensor for other types of gases.
- ias端点SubType.smokeDetector (9): indicates that the endpoint is a smoke sensor.
- ias端点SubType.parking传感器 (10): indicates that the endpoint is a vehicular parking sensor.
For endpoints of type endpointType.ppmConcentration传感器:
- ppmConcentration传感器SubType.ammonia (1): indicates that the endpoint is an ammonia sensor.
- ppmConcentration传感器SubType.Ozone (2): indicates that the endpoint is an ozone sensor.
- ppmConcentration传感器SubType.nitricOxide (3): indicates that the endpoint is a nitric oxide sensor.
- ppmConcentration传感器SubType.nitrogenDioxide (4): indicates that the endpoint is a nitrogen dioxide sensor.
- ppmConcentration传感器SubType.sulfurDioxide (5): indicates that the endpoint is a sulfur dioxide sensor.
- ppmConcentration传感器SubType.carbonMonoxide (6): indicates that the endpoint is a carbon monoxide sensor.
- ppmConcentration传感器SubType.carbonDioxide (7): indicates that the endpoint is a carbon dioxide sensor.
- ppmConcentration传感器SubType.voc (8): indicates that the endpoint is a volatile organic compounds sensor.
For endpoints of type endpointType.mvConcentration传感器:
- mvConcentration传感器SubType.lead (1): indicates that the endpoint is a lead sensor.
- mvConcentration传感器SubType.pm2_5 (2): indicates that the endpoint detects particulate matter up to 2.5 microns.
- mvConcentration传感器SubType.pm10 (3): indicates that the endpoint detects particulate matter up to 10 microns.
示例
此示例 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.readWrite命令 (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.
示例
此示例 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);operation安全Level (int enum)
The operation安全Level property indicates the security level associated with the endpoint operation. The possible values for this property are as follows:
- endpointOperation安全Level.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.
- endpointOperation安全Level.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.
- endpointOperation安全Level.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-输入 their password.
示例
此示例 shows the operation安全Level 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.
示例
此示例 shows the list of tags of the first endpoint of a device.
myDevice.endpoints.byIndex(0).tags.forEach(item => env.log(item));方法
getCurrentState() The getCurrentState() method allows obtaining the current state of the endpoint.
参数
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.
示例 1
此示例 shows the current temperature at an endpoint.
env.log(myDevice.endpoints.byIndex(0).getCurrentState().value);updateTemperature传感器Status(temperature [, utcDateTime]) The updateTemperature传感器Status() method allows updating the value of a temperature sensor, optionally specifying the date and time of the update.
参数
- temperature (double): this parameter indicates the measured temperature, in degrees Celsius.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report a temperature of 32 degrees Celsius on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateTemperatureSensorStatus(32);updateHumidity传感器Status(humidity [, utcDateTime]) The updateHumidity传感器Status() method allows updating the value of a humidity sensor, optionally specifying the date and time of the update.
参数
- humidity (double): this parameter indicates the measured humidity, as a percentage.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report a humidity of 47% on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateHumiditySensorStatus(47);updateLight传感器Status(lightIntensity [, utcDateTime]) The updateLight传感器Status() method allows updating the value of a light sensor, optionally specifying the date and time of the update.
参数
- lightIntensity (double): this parameter indicates the measured light intensity, ex按下ed in lux.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report a light intensity of 7550 lux on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateLightSensorStatus(7550);updateWeight传感器Status(weightGrams [, utcDateTime]) The updateWeight传感器Status() method allows updating the value of a weight sensor, optionally specifying the date and time of the update.
参数
- weightGrams (double): this parameter indicates the measured weight, in grams.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report a weight of 72.5 kg on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateWeightSensorStatus(72500);updateVolume传感器Status(volumeLiters [, utcDateTime]) The updateVolume传感器Status() method allows updating the value of a volume sensor, optionally specifying the date and time of the update.
参数
- volumeLiters (double): this parameter indicates the measured volume, in liters.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report a volume of 15,000 liters on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateVolumeSensorStatus(15000);update按下ure传感器Status(按下urePascals [, utcDateTime]) The update按下ure传感器Status() method allows updating the value of a 按下ure sensor, optionally specifying the date and time of the update.
参数
- 按下urePascals (double): this parameter indicates the measured 按下ure, in Pascals.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report a 按下ure of 1013 hectopascals (101300 pascals) on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updatePressureSensorStatus(101300);updateIAS传感器Status(state [, utcDateTime]) The updateIAS传感器Status() method allows updating the state of an IAS sensor, optionally specifying the date and time of the update.
参数
- state (int): this parameter indicates the sensor state, among the following:
- ias传感器State.Unknown (0): Unknown. The sensor state is not known.
- ias传感器State.idle (1): Idle. The sensor registers no activity.
- ias传感器State.active (2): Active. The sensor registers activity.
- ias传感器State.cleaning (3): Cleaning. The space associated with the sensor is being cleaned.
- ias传感器State.cleaningNeeded (4): Cleaning needed. The space associated with the sensor needs cleaning.
- ias传感器State.testMode (5): Test mode. The sensor is currently in test mode.
- ias传感器State.tampered (6): The sensor has been tampered with and may not be functioning correctly.
- ias传感器State.maintenanceNeeded (7): The sensor requires maintenance and may not be functioning correctly.
- ias传感器State.输入ing (8): The sensor detects that a vehicle is 输入ing the parking space.
- ias传感器State.leaving(9): The sensor detects that a vehicle is leaving the parking space.
- ias传感器State.violation(10): The sensor reports that the parking space is in violation.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report the idle state on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateIASSensorStatus(1);updateVoltage传感器Status(voltageVolts [, utcDateTime]) The updateVoltage传感器Status() method allows updating the state of a voltage sensor, optionally specifying the date and time of the update.
参数
- voltageVolts (double): this parameter indicates the measured voltage, in Volts.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report a measurement of 235V on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateVoltageSensorStatus(235);updateCurrent传感器Status(currentAmps [, utcDateTime]) The updateCurrent传感器Status() method allows updating the state of a current sensor, optionally specifying the date and time of the update.
参数
- currentAmps (double): this parameter indicates the measured current, in Amperes.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report a measurement of 19.5A on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateCurrentSensorStatus(19.5);updateActivePower传感器Status(activePowerWatts [, utcDateTime]) The updateActivePower传感器Status() method allows updating the state of an active power sensor, optionally specifying the date and time of the update.
参数
- activePowerWatts (double): this parameter indicates the measured active power, in Watts.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report a measurement of 1250W on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateActivePowerSensorStatus(1250);updateReactivePower传感器Status(reactivePowerVAR [, utcDateTime]) The updateReactivePower传感器Status() method allows updating the state of a reactive power sensor, optionally specifying the date and time of the update.
参数
- reactivePowerVAR (double): this parameter indicates the measured reactive power, in Volt-Ampere-Reactive (VAR).
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report a measurement of 750VAR on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateReactivePowerSensorStatus(750);updateApparentPower传感器Status(apparentPowerVA [, utcDateTime]) The updateApparentPower传感器Status() method allows updating the state of an apparent power sensor, optionally specifying the date and time of the update.
参数
- apparentPowerVA (double): this parameter indicates the measured apparent power, in Volt-Ampere (VA).
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report a measurement of 1300VA on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateApparentPowerSensorStatus(1300);updateCosPhi传感器Status(cosPhi [, utcDateTime]) The updateCosPhi传感器Status() method allows updating the state of a cosine phi (power factor) sensor, optionally specifying the date and time of the update.
参数
- cosPhi (double): this parameter indicates the measured cosine phi.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 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);updateFrequency传感器Status(frequencyHz [, utcDateTime]) The updateFrequency传感器Status() method allows updating the state of a frequency sensor (frequency meter), optionally specifying the date and time of the update.
参数
- frequencyHz (double): this parameter indicates the measured frequency, in Hz.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report a frequency measurement of 60Hz on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateFrequencySensorStatus(60);updateGeneric传感器Status(value [, utcDateTime]) The updateGeneric传感器Status() method allows updating the state of a generic scalar sensor, optionally specifying the date and time of the update.
参数
- value (double): this parameter indicates the measured value, in the units 选择ed for the endpoint.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report a measurement of value 1234 on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateGenericSensorStatus(1234);updatePpmConcentration传感器Status(value [, utcDateTime]) The updatePpmConcentration传感器Status() 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 ex按下ed as parts per million (ppm).
参数
- value (double): this parameter indicates the measured value, in parts per million (ppm).
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report a measurement of value 1234 ppm on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updatePpmConcentrationSensorStatus(1234);updateMvConcentration传感器Status(value [, utcDateTime]) The updateMvConcentration传感器Status() 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 ex按下ed as mass per volume ratio (m/v).
参数
- value (double): this parameter indicates the measured value, in micrograms per cubic meter (ug/m3).
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report a measurement of value 1234 ug/m3 on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateMvConcentrationSensorStatus(1234);updateAqi传感器Status(value [, utcDateTime]) The updateAqi传感器Status() method allows updating the state of an air quality sensor, optionally specifying the date and time of the update.
参数
- value (double): this parameter indicates the measured value, according to the AQI scale (0-500).
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 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.
参数
- 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.
示例 1
此示例 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.
参数
- 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.
示例 1
此示例 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.
参数
- 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.
示例 1
此示例 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.
参数
- 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.
示例 1
此示例 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.
参数
- 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 (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 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);示例 2
此示例 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);示例 3
此示例 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);示例 4
此示例 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');updateEnergy传感器ValueSummation(activeEnergySummationWh, reactiveEnergySummationVARh [, utcDateTime]) The updateEnergy传感器ValueSummation() method allows updating the active and reactive energy summation of an energy sensor, optionally specifying the date and time of the update.
参数
- activeEnergySummationWh (double): Indicates the current value of the active energy summation, ex按下ed in Wh.
- reactiveEnergySummationVARh (double): Indicates the current value of the reactive energy summation, ex按下ed in VARh.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 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);updateEnergy传感器ValueUnits(activeEnergyWh, reactiveEnergyVARh [, utcDateTime]) The updateEnergy传感器ValueUnits() method allows adding an active and reactive energy consumption value from an energy sensor, optionally specifying the date and time of the update.
参数
- activeEnergyWh (double): indicates the amount of active energy consumed, ex按下ed in Wh. This value will be added to the previously recorded active energy consumption.
- reactiveEnergyVARh (double): Indicates the amount of reactive energy consumed, ex按下ed in VARh. This value will be added to the previously recorded reactive energy consumption.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 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);updateFlow传感器ValueSummation(summationValue, [, utcDateTime]) The updateFlow传感器ValueSummation() 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.
参数
- summationValue (double): Indicates the current value of the flow summation.
- For flow sensors, the value must be ex按下ed in liters.
- For generic flow sensors, the value must be ex按下ed in the unit associated with the variable chosen for the sensor.
- For people flow sensors, the value is indicated in people.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 shows how to report a cumulative flow of 14650 liters on the first endpoint of a device.
myDevice.endpoints.byIndex(0).updateFlowSensorValueSummation(14650);updateFlow传感器ValueUnits(value, [, utcDateTime]) The updateFlow传感器ValueUnits() 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.
参数
- value (double): indicates the recorded flow value. This value will be added to the previously recorded value.
- For flow sensors, the value must be ex按下ed in liters.
- For generic flow sensors, the value must be ex按下ed in the unit associated with the variable chosen for the sensor.
- For people flow sensors, the value is indicated in people.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 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.
参数
- text: Indicates the text to be added.
- utcDateTime (日期,可选):该参数表示样本的 UTC 日期和时间。如果省略该参数,将假定使用当前日期和时间。
示例 1
此示例 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.
参数
- 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.
示例 1
此示例 shows how to upload a camera snapshot.
myDevice.endpoints.byIndex(0).uploadCameraSnapshot("VGhpcyBpcyBzb21lIHRleHQ....[more text].....", "jpg");端点 collection
The endpoint collection object represents a collection of endpoints contained within a device. Typically, the list of endpoints is accessed through the endpoints property...
Device model configuration
The 设备模型配置 object allows establishing the basic configuration for a device model, typically used in 设备模型配置 scripts.