14.09.2023, 13:42
(This post was last modified: 14.09.2023, 13:51 by CristianAgata.)
(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
* 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