fixje / deflux

Write deCONZ sensor measurements to InfluxDB
MIT License
2 stars 2 forks source link

Update zhalightlevel.go #3

Closed jan666 closed 1 year ago

jan666 commented 2 years ago

fix for

time="2022-03-10T09:31:02+01:00" level=warning msg="unable to decode state: json: cannot unmarshal number 41476 into Go struct field ZHALightLevel.Lux of type int16" time="2022-03-10T09:31:11+01:00" level=error msg="Dropping event due to error: unable to parse message: unable to decode state: json: cannot unmarshal number 41620 into Go struct field ZHALightLevel.Lux of type int16"

jan666 commented 2 years ago

Maybe it should be uint32: https://dresden-elektronik.github.io/deconz-rest-doc/devices/xiaomi/xiaomi_gzcgq01lm_light_sensor/

But then writing to influx fails:

write error: write failed (attempts 0): 400 Bad Request: unable to parse 'deflux_ZHALightLevel,id=61,name=Lichtsensor\ DG\ links,source=websocket,type=ZHALightLevel age_secs=0i,battery=100i,dark=false,daylight=true,lightlevel=46277u,lux=42423u 1646901210684602680': invalid number time="2022-03-10T09:33:51+01:00" level=warning msg="unable to decode state: CLIPGenericStatus is not a known sensor type" 2022/03/10 09:34:05 influxdb2client E! Write error: 400 Bad Request: unable to parse 'deflux_ZHALightLevel,id=61,name=Lichtsensor\ DG\ links,source=websocket,type=ZHALightLevel age_secs=0i,battery=100i,dark=false,daylight=true,lightlevel=46296u,lux=42609u 1646901245411484296': invalid number write error: write failed (attempts 0): 400 Bad Request: unable to parse 'deflux_ZHALightLevel,id=61,name=Lichtsensor\ DG\ links,source=websocket,type=ZHALightLevel age_secs=0i,battery=100i,dark=false,daylight=true,lightlevel=46296u,lux=42609u 1646901245411484296': invalid number