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
#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


Messages In This Thread
ZigBee library - by CristianAgata - 13.09.2023, 10:57
RE: ZigBee library - by admin - 13.09.2023, 11:56
RE: ZigBee library - by CristianAgata - 14.09.2023, 13:42
RE: ZigBee library - by CristianAgata - 13.09.2023, 12:14
RE: ZigBee library - by admin - 15.09.2023, 05:14
RE: ZigBee library - by Zen - 15.09.2023, 10:55
RE: ZigBee library - by admin - 15.09.2023, 13:40
RE: ZigBee library - by batistacaceres - 01.10.2024, 09:49
RE: ZigBee library - by admin - 01.10.2024, 10:59

Forum Jump: