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

wrong Json with PCF8574 sensor (missing curly brace) #12088

Closed
10 of 13 tasks
megamarco833 opened this issue May 12, 2021 · 6 comments
Closed
10 of 13 tasks

wrong Json with PCF8574 sensor (missing curly brace) #12088

megamarco833 opened this issue May 12, 2021 · 6 comments
Labels
bug Type - Confirmated Bug fixed Result - The work on the issue has ended

Comments

@megamarco833
Copy link

PROBLEM DESCRIPTION

json format error on PCF8574 driver usage with sensor enabled

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

  • Read the Contributing Guide and Policy and the Code of Conduct
  • Searched the problem in issues
  • Searched the problem in discussions
  • Searched the problem in the docs
  • Searched the problem in the chat
  • Device used (e.g., Sonoff Basic): _____
  • Tasmota binary firmware version number used: _____
    • [] Pre-compiled
    • Self-compiled
  • Flashing tools used: gitpod
  • Provide the output of command: Backlog Template; Module; GPIO 255:
15:16:21.558 MQT: stat/tasmota_156/RESULT = {"NAME":"Generic","GPIO":[1,1,1,1,1,1,1,1,1,1,1,1,1,1],"FLAG":0,"BASE":18}
15:16:21.781 MQT: stat/tasmota_156/RESULT = {"Module":{"0":"Generic"}}
15:16:22.036 MQT: stat/tasmota_156/RESULT = {"GPIO0":{"32":"Button1"},"GPIO1":{"608":"I2C SCL"},"GPIO2":{"33":"Button2"},"GPIO3":{"640":"I2C SDA"},"GPIO4":{"0":"None"},"GPIO5":{"34":"Button3"},"GPIO9":{"0":"None"},"GPIO10":{"0":"None"},"GPIO12":{"0":"None"},"GPIO13":{"0":"None"},"GPIO14":{"0":"None"},"GPIO15":{"0":"None"},"GPIO16":{"0":"None"},"GPIO17":{"0":"None"}}
15:16:25.391 MQT: tele/tasmota_156/STATE = {"Time":"2021-05-12T15:16:25","Uptime":"0T01:45:20","UptimeSec":6320,"Heap":17,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER1":"OFF","POWER2":"OFF","POWER3":"OFF","POWER4":"OFF","POWER5":"OFF","POWER6":"OFF","POWER7":"OFF","POWER8":"OFF","POWER9":"OFF","POWER10":"OFF","POWER11":"OFF","POWER12":"OFF","POWER13":"OFF","POWER14":"OFF","POWER15":"OFF","Wifi":{"AP":1,"SSId":"NETGEAR","BSSId":"E0:3F:49:A8:C5:70","Channel":11,"RSSI":80,"Signal":-60,"LinkCount":1,"Downtime":"0T00:00:03"}}

  • If using rules, provide the output of this command: Backlog Rule1; Rule2; Rule3:
  Rules output here:

  • Provide the output of this command: Status 0:
  STATUS 0 output here:

  • Set weblog to 4 and then, when you experience your issue, provide the output of the Console log:
  Console output here:

TO REPRODUCE

compile with:

  #define USE_PCF8574                            // [I2cDriver2] Enable PCF8574 I/O Expander (I2C addresses 0x20 - 0x26 and 0x39 - 0x3F) (+1k9 code)
    #define USE_PCF8574_SENSOR                   // enable PCF8574 inputs and outputs in SENSOR message
    #define USE_PCF8574_DISPLAYINPUT             // enable PCF8574 inputs display in Web page
    #define USE_PCF8574_MQTTINPUT                // enable MQTT message & rule process on input change detection : stat/%topic%/PCF8574_INP = {"Time":"2021-03-07T16:19:23+01:00","PCF8574-1_INP":{"D1":1}}

EXPECTED BEHAVIOUR

this is the output received:
13:19:07.459 MQT: tele/tasmota_156/SENSOR = {"Time":"2021-05-12T13:19:07","PCF8574-1":{"D0":1,"D1":1,"D2":1,"D3":1,"D4":1,"D5":1,"D6":1,"D7":1,"PCF8574-2":{"D0":1,"D1":1,"D2":1,"D3":1,"D4":0,"D5":1,"D6":1,"D7":1}}

it actually is not valid JSON. A curly brace after the first sensor data is missing.
should be:
13:19:07.459 MQT: tele/tasmota_156/SENSOR = {"Time":"2021-05-12T13:19:07","PCF8574-1":{"D0":1,"D1":1,"D2":1,"D3":1,"D4":1,"D5":1,"D6":1,"D7":1###right here###,"PCF8574-2":{"D0":1,"D1":1,"D2":1,"D3":1,"D4":0,"D5":1,"D6":1,"D7":1}}

SCREENSHOTS

If applicable, add screenshots to help explain your problem.

ADDITIONAL CONTEXT

Add any other context about the problem here.

(Please, remember to close the issue when the problem has been addressed)

@sfromis
Copy link
Contributor

sfromis commented May 12, 2021

Looks like a simple omission at the end of line 222 in the driver
ResponseAppend_P(PSTR(",\"PCF8574%c%d\":{\"D0\":%i,\"D1\":%i,\"D2\":%i,\"D3\":%i,\"D4\":%i,\"D5\":%i,\"D6\":%i,\"D7\":%i"),

arendst added a commit that referenced this issue May 12, 2021
Fix PCF8574 JSON (#12088)
@arendst arendst added bug Type - Confirmated Bug fixed Result - The work on the issue has ended labels May 12, 2021
@arendst
Copy link
Owner

arendst commented May 12, 2021

Thx for reporting

@megamarco833
Copy link
Author

thanks to you for fixing so quickly and to @sfromis to help me again and again!

yvesdm3000 pushed a commit to yvesdm3000/Tasmota that referenced this issue May 16, 2021
@tobschn
Copy link

tobschn commented Jun 14, 2021

I'm still having problems with this. In my case there is one currly brace too many at the end.
Additionally to the above I compiled with USE_SR04.

The given output:

{"Time":"2021-06-14T11:43:59","SR04":{"Distance":23.596},"PCF8574-1":{"D0":1,"D1":1,"D2":1,"D3":1,"D4":1,"D5":1,"D6":1,"D7":1},"PCF8574-2":{"D0":1,"D1":0,"D2":1,"D3":1,"D4":1,"D5":0,"D6":1,"D7":0}}}

how it should be:

{"Time":"2021-06-14T11:43:59","SR04":{"Distance":23.596},"PCF8574-1":{"D0":1,"D1":1,"D2":1,"D3":1,"D4":1,"D5":1,"D6":1,"D7":1},"PCF8574-2":{"D0":1,"D1":0,"D2":1,"D3":1,"D4":1,"D5":0,"D6":1,"D7":0}}

arendst added a commit that referenced this issue Jun 14, 2021
Fix wrong Json with PCF8574 sensor (#12088)
@arendst
Copy link
Owner

arendst commented Jun 14, 2021

Thx for reporting.

Pls retry latest development release (pre-compiled available in an hour)

@tobschn
Copy link

tobschn commented Jun 14, 2021

Issue is fixed. Works now correctly, thanks!

Jason2866 added a commit to Jason2866/Tasmota that referenced this issue Jun 23, 2021
* Use Tasmota Core32

* Use Tasmota core 32

* Tasmota core32

* use esptoolpy V.3.1.0

* esptoolpy v.3.10 for solo1

* LITTLEFS is a lib in Tasmota core32

* Update platformio_tasmota32.ini

* Berry fix #102

* Fix wrong Json with PCF8574 sensor

Fix wrong Json with PCF8574 sensor (arendst#12088)

* Update RELEASENOTES.md

* Remove CCLoader from zigbee binary

* Enable CCLoader in binary tasmota-zigbee

* Esp32c3 fix wrong baudrate

* Esp32c3 fix template command and Web UI

* Add command ``MqttWifiTimeout 100..20000``

Add command ``MqttWifiTimeout 100..20000`` to control MQTT Wi-Fi connection timeout default set to 200 mS (arendst#12222)

* Berry report bug fix #106

* Fix NEO_RGBW

* Allow Captive Portal to be optional

* Fix Berry documentation link

* Improve behavior of color2 for unlinked RGBW and RGBWW lights

* LVGL

* tasmota32-lvgl.bin

* Remove exceptions in build flags

* No exceptions to build flags

* Use really new core

* Enable exceptions for bluetooth

* Fix BT build (need exceptions)

* Remove exceptions from BLE

* Berry improve inheritance #107

* RM exceptions extra handling BT

solved with PR arendst#12384

* Rm BT exceptions

* Bump version 9.5.0.1

* remove speed settings

* Force ESP32 defines Force ESP32 defines USE_UFILESYS, GUI_TRASH_FILE and #define GUI_EDIT_FILE

* FSMan: add file deletion confirmation

* fix RO translation file

* Update xsns_05_ds18x20_esp32.ino

* rm upload speed

* rm upload speed

* Add 4M board variants

* rm upload speed

* rm upload speed

* Try with override env:tasmota32_base

* rm duplicate lib_extra_dirs

* Override via [env]

* Create esp8266_zbbridge.json

* Use esp8266_zbbridge board

* Update platformio_override_sample.ini

* rm outdated info

* Update pt_BR.h

Update labels (Translate new ones and correct some old ones). Adjust to brazilian portuguese

* Ethernet fix for ESP32

* #define USE_WS2812 for lvgl build

* Fix GUI console initial update time

* Fix s2

* Berry added I2C_Driver class and patches

* Updated MPUxxx driver

* Add Partition Manager v0 in Berry

* Added features

* Speed up initial GUI console refresh

* Fix ESP32 Webcam add boundary marker before sending mjpeg image (arendst#12376)

* Update

* Fix DDS238-2 wrong reactive power value (arendst#12283)

* Remove ProgramFlashSize from ESP32 Gui

* Fix compilation when USE_UFILESYS is not defined

* Simplified configuration for ir-full, tasmota-ircustom no more needed

* Remove unwanted files

* Update changelog

* Fix build

* Fix build

* Berry simplify Driver class

* Add ESP-NOW hooks

* make override possible for flags

* More refactor Platformio

* wrong link to platform

Co-authored-by: Stephan Hadinger <stephan.hadinger@gmail.com>
Co-authored-by: Theo Arends <11044339+arendst@users.noreply.github.com>
Co-authored-by: s-hadinger <49731213+s-hadinger@users.noreply.github.com>
Co-authored-by: Adrian Scillato <35405447+ascillato@users.noreply.github.com>
Co-authored-by: Erik <erik@montnemery.com>
Co-authored-by: Barbudor <barbudor@barbudor.net>
Co-authored-by: Serge <60098151+Xjeater@users.noreply.github.com>
Co-authored-by: Jansen Arruda <jansen.arruda@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Type - Confirmated Bug fixed Result - The work on the issue has ended
Projects
None yet
Development

No branches or pull requests

5 participants