Pulse counter Domoticz MQTT output misses quotes in svalue.

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Rini52
Normal user
Posts: 47
Joined: 19 Jun 2021, 17:23
Location: NL

Pulse counter Domoticz MQTT output misses quotes in svalue.

#1 Post by Rini52 » 15 Jul 2021, 16:05

When the pulse counter is set to output only one value (delta option), the svalue message is missing the quotes. This is interpreted by Domoticz as invalid message.

Mqtt-output:

1) For one (delta) svalue:

{"idx":37,"RSSI":8,"nvalue":0,"svalue":2800.00}

2) For two (delta + total) svalues :

{"idx":37,"RSSI":8,"nvalue":0,"svalue":"2800.00;3124.00"}


note: The quotes (''2800") are missing in case 1 when only the counting is requested (delta option).

Work around: output two values(delta/total option) and ignore the second value in Domoticz.

Build : 20114 - Mega

Rini52
Normal user
Posts: 47
Joined: 19 Jun 2021, 17:23
Location: NL

Re: Pulse counter Domoticz MQTT output misses quotes in svalue.

#2 Post by Rini52 » 16 Jul 2021, 14:31

The same problem occurs for the ping device. This device only sends out one value and Domoticz can't handle this mtqq payload.
This happens when using 20114 -mega build and also on the newly TD generated "ESP_Easy_mega_20210615_energy_ESP8266_4M1M" build. The previous (20210503) was okay.
Looks that something was changes in the MQTT payload parsing...

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Pulse counter Domoticz MQTT output misses quotes in svalue.

#3 Post by Ath » 16 Jul 2021, 20:30

It's a bit surprising that it works with the 20210503 release, but not with newer releases.
Around that time I did a change adding the JSON Bool with or without quotes feature, could you change that setting to see if that changes behavior, as if it does I have a bug to fix...

NB: I have a fix, as that svalue attribute has a requirement to be quoted.
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Pulse counter Domoticz MQTT output misses quotes in svalue.

#4 Post by Ath » 16 Jul 2021, 21:04

Did a pull request with a fix, PR #3706
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Pulse counter Domoticz MQTT output misses quotes in svalue.

#5 Post by Ath » 18 Jul 2021, 13:11

Rini52 wrote: 16 Jul 2021, 14:31 and Domoticz can't handle this mtqq payload.
Hi @Rini52, can you please confirm if
a) changing the "JSON bool output without quotes" option (Tools/Advanced page) changes the output sent to Domoticz (it shouldn't, but confirmation would be very nice)
b) can you try the build from the PR I linked above? (If needed I can provide the desired .bin file for testing)

TIA!
/Ton (PayPal.me)

Rini52
Normal user
Posts: 47
Joined: 19 Jun 2021, 17:23
Location: NL

Re: Pulse counter Domoticz MQTT output misses quotes in svalue.

#6 Post by Rini52 » 18 Jul 2021, 18:33

Arth

I pulled the 3705 branch of the git. I hope this include your update (atleast files were changed when I checked. Compiled it with core 3.0.1 in Arduino-IDE and the result was negative.
Still the same problem, no quotes when a single value is requested in de Domoticz MqTT output :cry: .

Rini

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Pulse counter Domoticz MQTT output misses quotes in svalue.

#7 Post by Ath » 18 Jul 2021, 19:46

You will need to pull the 3706 PR and build that, as separate pull-requests have no relation until there are merged into the main branch (called `mega` in this repository).
So to me it is no surprise you have a negative outcome ;).
Does changing the JSON bool setting make any difference?
/Ton (PayPal.me)

Rini52
Normal user
Posts: 47
Joined: 19 Jun 2021, 17:23
Location: NL

Re: Pulse counter Domoticz MQTT output misses quotes in svalue.

#8 Post by Rini52 » 18 Jul 2021, 21:12

arh

I test the JSON bool option no change. As you predicted. I think I made a typo and have already 3707 in my local branch.

To me this git stuff is like magic. You pull and pull and you never know which one you have..

If I do clone http:lets.... which one do I get?
I have a desktop gui and it says uptodate 3707.
I'm a linux user but this is ababgadabra for me....

show branch
git output.....


! [mega] Update _CPlugin_Helper.cpp
* [pr/3707] Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into feature/p053-add-support-for-pms5003st-pms2003-pms3003
--
- [pr/3707] Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into feature/p053-add-support-for-pms5003st-pms2003-pms3003
* [pr/3707^2^2~2] [P036] Updated documentation (and a small textual improvement in the setting)
* [pr/3707^2^2~3] [P036] Make Frame & Line events optional, introduce #defines for flags
* [pr/3707^2^2~4] [P036] Add events for Frame and Line, reduce code size
* [pr/3707^2^2~5] [P036] Eliminate a few unneeded variables, saving a little .bin size
* [pr/3707^2^2~6] [P036] Add Generate Events option for Display and Contrast
* [pr/3707^2^^2^] [P057] Add extra check to avoid reading past string length
* [pr/3707^2^^2~3] [P057] Improve dot display, code optimizations
* [pr/3707^2^^2~4] [P057] Add support for periods in display
* [pr/3707^] [P053] Add support for PMS5003ST, PMS2003 and PMS3003
* [pr/3707~2^2] [WiFi] Fix build issue
* [pr/3707~2^2^] [WiFi] Try to connect right after WiFi scan found known APs
* [pr/3707~2^2~2] [Security Settings] Add alignment checks at compile time.
* [pr/3707~2^2~3] [WiFi] Clear wifiConnectInProgress when prepare WiFi failed
* [pr/3707~2^2~4] [WiFi] No need to disable interrupts when connecting WiFi
* [pr/3707~2^2~5] [WiFi] Fix WiFi need to connect flag not always set
* [pr/3707~2^2~6] [WiFi] Fix scan issue, causing failed connections
+ [mega] Update _CPlugin_Helper.cpp
+* [pr/3707~3] [TinyGPS] TinyGPSCustom::valid was not initialized

Regards..

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Pulse counter Domoticz MQTT output misses quotes in svalue.

#9 Post by Ath » 18 Jul 2021, 22:13

PR #3706 is the one with the Domoticz MQTT fix. You will have to checkout that, and build it.

If unsure I can provide a .bin file for download, just name the file you want.
/Ton (PayPal.me)

Rini52
Normal user
Posts: 47
Joined: 19 Jun 2021, 17:23
Location: NL

Re: Pulse counter Domoticz MQTT output misses quotes in svalue.

#10 Post by Rini52 » 18 Jul 2021, 23:25

ton

After a crash session in the use of git , I managed to get your version 3706 in my Arduino-IDE . And hooray I can confirm that the single entry get the quotes. Also with two svalues the quotes are there. So problem solved. :D .
Unfortunately TD's Wifi-fix (3705?) is not included in yours 3706. Since I don't know how commits in git are handled, I have to go back to 3705 for TD's WIFI testing.>>.

Anyway thanks for you fix. Hope this will all be included in the next xxxxx-mega master update.....

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Pulse counter Domoticz MQTT output misses quotes in svalue.

#11 Post by TD-er » 19 Jul 2021, 00:22

About #3705....
How do you compile it?
This fix should not be needed, as it will break when compiling with older core versions.
I will rebase your PR with Ton's fix, so you can checkout just that PR to build your setup, but I will not merge #3705 as it is not the fix you need.

Rini52
Normal user
Posts: 47
Joined: 19 Jun 2021, 17:23
Location: NL

Re: Pulse counter Domoticz MQTT output misses quotes in svalue.

#12 Post by Rini52 » 19 Jul 2021, 10:41

TD

I started with this "Arduino" boards about a month ago to see what I can do with it. I needed a sensor with an esp to transmit data to my Domoticz server. Therefore I use the Arduino-IDE for compiling and flashing to the ESP8266 boards. It works okay and you separate setups(versions) with the portable option.
To compile your PR versions I use the git to pull the right git version to my local directory and copy/past directories to the Arduino portable version directories and update the custom.h This is documented in your wiki for Arduino. It works okay and you know with what version your are working. This works better for me than the vague head/tail/pull/merge/commit stuff of git. I understand for your project you need to keep track of things, but for me this more visual and I can mix different projects more easily.

Therefore compiling is done the Arduino-IDE followed by flashing to the ESP board. In this case I used the esp8266 community lib (version 3.0.1) of Arduino-IDE and no compilation errors where encountered. Only one warning for a possible incompatible Liquid Crystal lib. Both your Wifi tests and Tons updates were compiled like this and worked very well. My Wifi build (the one without scans) for your tests is already running for a couple of days without reconnects while connected to my mesh Asus router. So great improvements ....

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Pulse counter Domoticz MQTT output misses quotes in svalue.

#13 Post by TD-er » 19 Jul 2021, 11:33

I think you may need an extra define somewhere, to make it compile in Arduino IDE.
Have to look into it.

Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests