Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UART sensor's Analog value unexpected when issuing read from coordinator #309

Open
ncolomer opened this issue Sep 11, 2024 · 0 comments
Open

Comments

@ncolomer
Copy link

ncolomer commented Sep 11, 2024

From https://www.reddit.com/r/ptvo/comments/1fdibfh/ptvo_zigbee2mqtt_custom_converter_issues/

Hello,

I'm currently tinkering my own custom Zigbee2MQTT converter for a PTVO firmware, but I'm facing an issue that may be a firmware bug.

I'm trying to expose UART sensor's Analog value and On/Off values with read access, so that I can issue manual reads from Zigbee2MQTT UI or API without waiting for a report.

It seems the firmware answers unexpected values when doing so.

When the value is reported by the firmware (manual wakeup or reporting interval), it works ok: I do have a serial reading on my mcu and it is received/parsed/displayed correctly by Zigbee2MQTT:

zh:zstack:unpi:parser: <-- [254,1,100,1,0,100]
zh:zstack:unpi:parser: --- parseNext [254,1,100,1,0,100]
zh:zstack:unpi:parser: --> parsed 1 - 3 - 4 - 1 - [0] - 100
zh:zstack:znp: SRSP: <-- AF - dataRequest - {"status":0}
zh:zstack:unpi:parser: --- parseNext []
zh:zstack:unpi:parser: <-- [254,3,68,128,0,1,83,149]
zh:zstack:unpi:parser: --- parseNext [254,3,68,128,0,1,83,149]
zh:zstack:unpi:parser: --> parsed 3 - 2 - 4 - 128 - [0,1,83] - 149
zh:zstack:znp: AREQ: <-- AF - dataConfirm - {"status":0,"endpoint":1,"transid":83}
zh:zstack:unpi:parser: --- parseNext []
zh:zstack:unpi:parser: <-- [254,5,69,196,66,197,1,231,93,184]
zh:zstack:unpi:parser: --- parseNext [254,5,69,196,66,197,1,231,93,184]
zh:zstack:unpi:parser: --> parsed 5 - 2 - 5 - 196 - [66,197,1,231,93] - 184
zh:zstack:znp: AREQ: <-- ZDO - srcRtgInd - {"dstaddr":50498,"relaycount":1,"relaylist":[24039]}
zh:zstack:unpi:parser: --- parseNext []
zh:zstack:unpi:parser: <-- [254,30,68,129,0,0,12,0,66,197,5,1,0,65,0,160,207,4,0,0,10,24,79,10,85,0,57,51,51,222,66,231,93,28,127]
zh:zstack:unpi:parser: --- parseNext [254,30,68,129,0,0,12,0,66,197,5,1,0,65,0,160,207,4,0,0,10,24,79,10,85,0,57,51,51,222,66,231,93,28,127]
zh:zstack:unpi:parser: --> parsed 30 - 2 - 4 - 129 - [0,0,12,0,66,197,5,1,0,65,0,160,207,4,0,0,10,24,79,10,85,0,57,51,51,222,66,231,93,28] - 127
zh:zstack:znp: AREQ: <-- AF - incomingMsg - {"groupid":0,"clusterid":12,"srcaddr":50498,"srcendpoint":5,"dstendpoint":1,"wasbroadcast":0,"linkquality":65,"securityuse":0,"timestamp":315296,"transseqnumber":0,"len":10,"data":{"type":"Buffer","data":[24,79,10,85,0,57,51,51,222,66]}}
zh:controller: Received payload: clusterID=12, address=50498, groupID=0, endpoint=5, destinationEndpoint=1, wasBroadcast=false, linkQuality=65, frame={"header":{"frameControl":{"frameType":0,"manufacturerSpecific":false,"direction":1,"disableDefaultResponse":true,"reservedBits":0},"manufacturerCode":null,"transactionSequenceNumber":79,"commandIdentifier":10},"payload":[{"attrId":85,"dataType":57,"attrData":111.0999984741211}],"command":{"ID":10,"name":"report","parameters":[{"name":"attrId","type":33},{"name":"dataType","type":32},{"name":"attrData","type":1000}]}}
zh:zstack:unpi:parser: --- parseNext []
z2m: Received Zigbee message from '0x0000000000000000', type 'attributeReport', cluster 'genAnalogInput', data '{"presentValue":111.0999984741211}' from endpoint 5 with groupID 0
z2m:mqtt: MQTT publish: topic 'z2m/0x0000000000000000', payload '{"display":"OFF","l4":64.334,"l5":111.1,"l6":7,"l7":300,"linkquality":65,"measurable_distance_max_l7":300,"measurable_distance_min_l6":7,"raw_distance_l5":111.1,"tank_water_level_l4":64.33}'

However, when requesting read from Zigbee2MQTT UI, the value received is not same scale and closely equals to zero (e-39 value):

z2m:mqtt: Received MQTT message on 'z2m/0x0000000000000000/get' with data '{"raw_distance_l5":""}'
z2m: Publishing get 'get' 'raw_distance' to '0x0000000000000000'
zh:controller:endpoint: ZCL command 0x0000000000000000/5 genAnalogInput.read(["presentValue"], {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false})
zh:zstack: sendZclFrameToEndpointInternal 0x0000000000000000:50498/5 (0,0,1)
zh:zstack:znp: SREQ: --> AF - dataRequest - {"dstaddr":50498,"destendpoint":5,"srcendpoint":1,"clusterid":12,"transid":85,"options":0,"radius":30,"len":5,"data":{"type":"Buffer","data":[16,30,0,85,0]}}
zh:zstack:unpi:writer: --> frame [254,15,36,1,66,197,5,1,12,0,85,0,30,5,16,30,0,85,0,176]

zh:zstack:unpi:parser: <-- [254,1,100,1,0,100]
zh:zstack:unpi:parser: --- parseNext [254,1,100,1,0,100]
zh:zstack:unpi:parser: --> parsed 1 - 3 - 4 - 1 - [0] - 100
zh:zstack:znp: SRSP: <-- AF - dataRequest - {"status":0}
zh:zstack:unpi:parser: --- parseNext []
zh:zstack:unpi:parser: <-- [254,3,68,128,0,1,85,147]
zh:zstack:unpi:parser: --- parseNext [254,3,68,128,0,1,85,147]
zh:zstack:unpi:parser: --> parsed 3 - 2 - 4 - 128 - [0,1,85] - 147
zh:zstack:znp: AREQ: <-- AF - dataConfirm - {"status":0,"endpoint":1,"transid":85}
zh:zstack:unpi:parser: --- parseNext []
zh:zstack:unpi:parser: <-- [254,5,69,196,66,197,1,231,93,184]
zh:zstack:unpi:parser: --- parseNext [254,5,69,196,66,197,1,231,93,184]
zh:zstack:unpi:parser: --> parsed 5 - 2 - 5 - 196 - [66,197,1,231,93] - 184
zh:zstack:znp: AREQ: <-- ZDO - srcRtgInd - {"dstaddr":50498,"relaycount":1,"relaylist":[24039]}
zh:zstack:unpi:parser: --- parseNext []
zh:zstack:unpi:parser: <-- [254,31,68,129,0,0,12,0,66,197,5,1,0,65,0,17,4,86,0,0,11,24,30,1,85,0,0,57,205,40,18,39,231,93,28,65]
zh:zstack:unpi:parser: --- parseNext [254,31,68,129,0,0,12,0,66,197,5,1,0,65,0,17,4,86,0,0,11,24,30,1,85,0,0,57,205,40,18,39,231,93,28,65]
zh:zstack:unpi:parser: --> parsed 31 - 2 - 4 - 129 - [0,0,12,0,66,197,5,1,0,65,0,17,4,86,0,0,11,24,30,1,85,0,0,57,205,40,18,39,231,93,28] - 65
zh:zstack:znp: AREQ: <-- AF - incomingMsg - {"groupid":0,"clusterid":12,"srcaddr":50498,"srcendpoint":5,"dstendpoint":1,"wasbroadcast":0,"linkquality":65,"securityuse":0,"timestamp":5637137,"transseqnumber":0,"len":11,"data":{"type":"Buffer","data":[24,30,1,85,0,0,57,205,40,18,39]}}
zh:controller: Received payload: clusterID=12, address=50498, groupID=0, endpoint=5, destinationEndpoint=1, wasBroadcast=false, linkQuality=65, frame={"header":{"frameControl":{"frameType":0,"manufacturerSpecific":false,"direction":1,"disableDefaultResponse":true,"reservedBits":0},"manufacturerCode":null,"transactionSequenceNumber":30,"commandIdentifier":1},"payload":[{"attrId":85,"status":0,"dataType":57,"attrData":2.0283688347244285e-15}],"command":{"ID":1,"name":"readRsp","parameters":[{"name":"attrId","type":33},{"name":"status","type":32},{"name":"dataType","type":32,"conditions":[{"type":"statusEquals","value":0}]},{"name":"attrData","type":1000,"conditions":[{"type":"statusEquals","value":0}]}]}}
zh:zstack:unpi:parser: --- parseNext []
z2m: Received Zigbee message from '0x0000000000000000', type 'readResponse', cluster 'genAnalogInput', data '{"presentValue":2.0283688347244285e-15}' from endpoint 5 with groupID 0
z2m:mqtt: MQTT publish: topic 'z2m/0x0000000000000000', payload '{"display":"OFF","l4":64.471,"l5":0,"l6":7,"l7":300,"linkquality":65,"measurable_distance_max_l7":300,"measurable_distance_min_l6":7,"raw_distance_l5":0,"tank_water_level_l4":64.47}'

The firmware configuration is the following:

config

Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant