seb821 / espRFLinkMQTT

ESP8266 gateway between RFLink and MQTT server
96 stars 32 forks source link

Invalid json on publish #23

Closed HenJou closed 3 years ago

HenJou commented 3 years ago

Hi I tested the the espRFLinkMQTT and i tryed the latest dev one but I get an error on my DKW2012 Weather station on the json that is published to my mqtt server . This is the json that is returned

{"TEMP":15.8,"HUM":48,"WINSP":0.0,"WINGS":0.0,"RAIN":5.4,"WINDIR":0010,"BAT":"OK"}

if I run this thru json validate at https://jsonlint.com/ I get thats WINDIR value that's not valid.

My Milight is working and also my other Temp sensors.

image

HenJou commented 3 years ago

What I got from rflink is that the WINDIR of the DKW2012 is a value from 0-15 and every 1 is 22.5 deg. so the 0010 above is then 10 * 22.5 = 225 degrees. Hope this can help.

seb821 commented 3 years ago

I have just pushed a fix on the dev branch to convert it to a proper integer (without the zeros before). Though, I did not implement the multiplication by 22.5 as RFLink reference says it is an integer (though it "reflects" an angle). Maybe you can test and revert whether it is ok.

HenJou commented 3 years ago

Thank seb821 I test the dev and i do get a valid json back and I got the value back to Home assistant with the following configuration.yaml under sensors: , so no need to add the conversion also.