ioBroker / ioBroker.sonoff

Control Sonoff-Tasmota devices via ioBroker
MIT License
37 stars 28 forks source link

Sonoff driver not correct parse JSON? #96

Closed itProfi closed 4 years ago

itProfi commented 5 years ago

Hello, friends! When i send JSON from 15 esp8266 with lastest Tasmota, JSON, which send on sonoff is well..But when it's pasing, the time, for example is not correct.. Скриншот 20-10-2019 164724 JS-controller is 2.0.34..

Скриншот 20-10-2019 205731 Maybe in my case with thins thing: "npm WARN deprecated json3@3.3.2: Please use the native JSON object instead of JSON 3" ??

GermanBluefox commented 5 years ago

Can you please provide the JSON string from sonoff? This one with tele/AC1/STATE={"Time": ,...

GermanBluefox commented 5 years ago

Are you sure, that your ALL clients have all different names (clientIds)

itProfi commented 5 years ago

22:52:31 MQT: tele/pump/SENSOR = {"Time":"2019-10-21T22:52:31","ENERGY":{"TotalStartTime":"2019-09-29T21:07:46","Total":[36.130,3.869,27.505],"Yesterday":1.643,"Today":2.468,"Period":0,"Power":3,"ApparentPower":12,"ReactivePower":11,"Factor":0.26,"Voltage":222,"Current":0.05}} Yes, of course all different names - Скриншот 21-10-2019 225228

itProfi commented 5 years ago

Скриншот 21-10-2019 225803 I install lastest JS-controller, sonoff 2.2.3- the same things Скриншот 21-10-2019 225543 Скриншот 21-10-2019 225510

itProfi commented 5 years ago

I see, that sonoff driver maybe skips each second? teleperiod (in picture teleperiod=5) Скриншот 21-10-2019 230759 Скриншот 21-10-2019 230750 Скриншот 22-10-2019 095845

itProfi commented 5 years ago

Yes, driver not parse any teleperiod..just randomise..maybe mqtt part guilty?

itProfi commented 5 years ago

After update to version 2.3.0 (lastest, bump) -time - same errors: Скриншот 22-10-2019 195257 And new erros:

sonoff.0 | 2019-10-22 19:50:01.810 | error | (17548) After: {"Time":"2019-10-22T19:50:01","DS18B20":{"Temperature":24.4},"BME280":{"Temperature":24.3,"Humidity":55.7,"Pressure":766},"BH1750":{"Illuminance":0},"PressureUnit":"mmHg","TempUnit":"C
-- | -- | -- | --
sonoff.0 | 2019-10-22 19:50:01.810 | error | (17548) Before: {"Time":"2019-10-22T19:50:01","DS18B20":{"Temperature":24.4},"BME280":{"Temperature":24.3,"Humidity":55.7,"Pressure":766},"BH1750":{"Illuminance":0},"PressureUnit":"mmHg","TempUnit":"

This code work:) Скриншот 22-10-2019 195735

itProfi commented 5 years ago

Any chances?

itProfi commented 4 years ago

Any chances?

Apollon77 commented 4 years ago

So in fact the device is generating an invalid JSON by using "NaN" as a value or how I should understand the topic now ... with your code fix ... The official fix would be to have the device send valid JSON ;-) Yes we could check the incoming text to hopefully detect a NaN value (and hope that it not part of any string which would lead to a wrong replace) ...

algar42 commented 4 years ago

Look here - https://github.com/arendst/Tasmota/issues/4147 It seems that it was updated to have correct JSON already a year ago... Or I'm wrong?

Apollon77 commented 4 years ago

Sorry but this is not helpful. If there are problems with js-controller 2.0 please provide more details in an own issue or forum.

Controller 2 is the Future base and so the adapter or controller needs to be fixed!

itProfi commented 4 years ago

Thanks for all! I upgrade js-controller-2.21 and redis databse and all fine!