This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

ZigBee library
#1
Hi at all,
I'm studying the ZigBee library, because I have a problem with a ZigBee device (his firmware it is bagged). The device sends status if the CMD arrives from LM but if I made changed in local, it doesn't send messages.
If I press the read command on the ZigBee interface status arrive. (See attached picture)
Here my request, is it possible by script simulate the pressing of that button?
Or which is the function in the library to request the device status?
Best regards Cristian

Attached Files Thumbnail(s)
   
Reply
#2
Full status read is done in the user UI part so it cannot be called from scripts. You can read attributes like LocalTemperature via a script:
Code:
zb = require('applibs.zigbee')

addr = '0123456789abcdef'
cluster = 0x0201 -- HvacThermostat
attrs = { 'LocalTemperature' }

res, err = zb.cmdsync('getnamedattributes', addr, cluster, attrs)
log(res, err)

if type(res) == 'table' and res.LocalTemperature then
  temperature = res.LocalTemperature / 100
  log(temperature)
end
Reply
#3
(13.09.2023, 10:57)CristianAgata Wrote: Hi at all,
I'm studying the ZigBee library, because I have a problem with a ZigBee device (his firmware it is bagged). The device sends status if the CMD arrives from LM but if I made changed in local, it doesn't send messages.
If I press the read command on the ZigBee interface status arrive. (See attached picture)
Here my request, is it possible by script simulate the pressing of that button?
Or which is the function in the library to request the device status?
Best regards Cristian

Thank you so much
Reply
#4
(13.09.2023, 11:56)admin Wrote: Full status read is done in the user UI part so it cannot be called from scripts. You can read attributes like LocalTemperature via a script:
Code:
zb = require('applibs.zigbee')

addr = '0123456789abcdef'
cluster = 0x0201 -- HvacThermostat
attrs = { 'LocalTemperature' }

res, err = zb.cmdsync('getnamedattributes', addr, cluster, attrs)
log(res, err)

if type(res) == 'table' and res.LocalTemperature then
  temperature = res.LocalTemperature / 100
  log(temperature)
end

Hi admin,
i'm testing the code, this is the log on the zigbee device
Code:
Manufacturer: Rti-Tek
Model: Thermostat
Firmware version: 2.2

Device type: End device
Power source: Battery
Receive when idle: No

Endpoint 1
Profile: 260
Input clusters
- Basic (0)
- PowerCfg (1)
- Identify (3)
- HvacThermostat (513)
- HaDiagnostic (2821)
- 64527
Output clusters
- Time (10)
- Ota (25)

Reported attributes
- heatingstatus: true
- localtemperature: 26.20
- occupiedheatingsetpoint: 27.00
- systemmode: 1

I have filled my script in this way;
Code:
zb = require('applibs.zigbee')
--log(zb)

addr = '84fd27fffea5ec1c'
cluster = 0x0201 -- HvacThermostat
attrs = { 'heatingstatus' }

res, err = zb.cmdsync('getnamedattributes', addr, cluster, attrs)
log(res, err)

if type(res) == 'table' and res.heatingstatus then
  --temperature = res.LocalTemperature / 100
  log(res.heatingstatus)
end
In log I have this error:

* arg: 1
  * nil
* arg: 2
  * string: .../tmp.VsS0GSqtJq/files/store/daemon/zigbee/zigbee/zcl.lua:167: attempt to index a nil value
Where am I wronging?

Best regards Cristian
Reply
#5
You need to read the SystemMode attribute. If it's not zero then the heating is enabled. You can read multiple attributes from the same cluster by adding multiple names to the attrs table.

In the next app version read response will be treated the same as reporting that devices send from time to time. This means that mapped objects will be updated automatically. It will be enough to send the attribute read request without adding any extra code for parsing values.
Reply
#6
(15.09.2023, 05:14)admin Wrote: You need to read the SystemMode attribute. If it's not zero then the heating is enabled. You can read multiple attributes from the same cluster by adding multiple names to the attrs table.

In the next app version read response will be treated the same as reporting that devices send from time to time. This means that mapped objects will be updated automatically. It will be enough to send the attribute read request without adding any extra code for parsing values.

Is there any way to know attributes names?
Reply
#7
Here's a list of clusters and respective attributes.
Code:
Basic (0x0000)
  ZCLVersion
  HwVersion
  ManufacturerName
  ModelId
  SwBuildId

PowerCfg (0x0001)
  BatteryVoltage
  BatteryLevel

OnOff (0x0006)
  OnOff

LevelCtrl (0x0008)
  CurrentLevel
  OnOffTransitionTime
  OnLevel
  StartUpCurrentLevel

LightingColorCtrl (0x0300)
  CurrentHue
  CurrentSaturation
  RemainingTime
  CurrentX
  CurrentY
  ColorTemperature
  ColorMode
  EnhancedCurrentHue
  EnhancedColorMode
  ColorCapabilities
  ColorTempPhysicalMin
  ColorTempPhysicalMax

LightingBallastCfg (0x0301)
  PhysicalMinLevel
  PhysicalMaxLevel
  MinLevel
  MaxLevel
  ControlMode

MsIlluminanceMeasurement (0x0400)
  MeasuredValue

MsTemperatureMeasurement (0x0402)
  MeasuredValue
  TemperatureSensorType

MsPressureMeasurement (0x0403)
  MeasuredValue

MsRelativeHumidity (0x0405)
  MeasuredValue

AnalogInput (0x000C)
  Description
  MaxPresentValue
  MinPresentValue
  OutOfService
  PresentValue
  Reliability
  RelinquishDefault
  Resolution

BinaryInput (0x000F)
  PresentValue

HvacThermostat (0x0201)
  LocalTemperature
  OutdoorTemperature
  Occupancy
  AbsMinHeatSetpointLimit
  AbsMaxHeatSetpointLimit
  AbsMinCoolSetpointLimit
  AbsMaxCoolSetpointLimit
  PICoolingDemand
  PIHeatingDemand
  HVACSystemTypeConfiguration
  LocalTemperatureCalibration
  OccupiedCoolingSetpoint
  OccupiedHeatingSetpoint
  UnoccupiedCoolingSetpoint
  UnoccupiedHeatingSetpoint
  MinHeatSetpointLimit
  MaxHeatSetpointLimit
  MinCoolSetpointLimit
  MaxCoolSetpointLimit
  MinSetpointDeadBand
  RemoteSensing
  ControlSequenceOfOperation
  SystemMode
  AlarmMask
  ThermostatRunningMode

HvacFanCtrl (0x0202)
  FanMode
  FanModeSequence

HaElectricalMeasurement (0x0B04)
  RmsVoltage
  RmsCurrent
  HaActivePower
  HaReactivePower
  HaApparentPower
  PowerFactor
  VoltageMultiplier
  VoltageDivisor
  CurrentMultiplier
  CurrentDivisor
  HaPowerMultiplier
  HaPowerDivisor

SeMetering (0x0702)
  CurrentSummDelivered
  SePowerMultiplier
  SePowerDivisor
  SeActivePower

SsIasZone (0x0500)
  ZoneState
  ZoneType
  ZoneStatus
  IasCieAddr
  ZoneId
  ZoneSensitivityLevel
  DetectionTimeout

ClosuresDoorLock (0x0101)
  LockState
  LockType
  ActuatorEnabled
  DoorState

ClosuresWindowCovering (0x0102)
  WindowCoveringType
  PhysicalClosedLimitLift
  PhysicalClosedLimitTilt
  CurrentPositionLift
  CurrentPositionTilt
  NumberOfActuationsLift
  NumberOfActuationsTilt
  ConfigStatus
  CurrentPositionLiftPercentage
  CurrentPositionTiltPercentage
  Mode
  LiftDriveUpTime
  LiftDriveDownTime
  TiltOpenCloseAndStepTime
  TiltPositionPercentageAfterMoveToLevel

MsOccupancySensing (0x0406)
  Occupancy
  OccupancySensorType
  PirOToUDelay
  OccupancyDfltOperationMode
Reply


Forum Jump: