meaning of %value% in plugin generic pulse counter

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
wonk
Normal user
Posts: 20
Joined: 29 Nov 2020, 21:31

meaning of %value% in plugin generic pulse counter

#1 Post by wonk » 07 Mar 2021, 11:38

Hi,
I connected a switch TCRT5000 to a NodeMCU with ESPEasy. The optical digtal sensor is looking to a ferraris counter with a turning wheel. Its normaly HIGH and one count is a LOW impulse for some tenth second. I use the plugin generic Pulse counter. It works so far as I get values for TOTAL, COUNT, TIME, but only when I actualise the the devices tap. Although reding the documentation, I do not understand the meaning of the values. I thought the counter will show 1,2,3,4,....
I only changed the GPIO data to D6, where my wire is connected. Why do I habe to set an interval? The time between two pulses differs according to the speed of the turning wheel.
Gruss, wonk

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

Re: meaning of %value% in plugin generic pulse counter

#2 Post by TD-er » 07 Mar 2021, 12:52

I just checked the documentation and it really needs some updates to explain it all a bit more: https://espeasy.readthedocs.io/en/lates ... #p003-page
Maybe the old documentation on the wiki may help you out a bit more? https://www.letscontrolit.com/wiki/inde ... ogic_input

wonk
Normal user
Posts: 20
Joined: 29 Nov 2020, 21:31

Re: meaning of %value% in plugin generic pulse counter

#3 Post by wonk » 07 Mar 2021, 18:29

Hi,
thank you for the additional dokumentation, but it does not help solving my above questions. I got a system with some temperature sensors very nice working, but this problem ist to disturbing without further explanation.
Gruss, wonk

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

Re: meaning of %value% in plugin generic pulse counter

#4 Post by TD-er » 07 Mar 2021, 21:04

OK, I read your post again and now it occurs to me that you really want to know why the value doesn't update in the "devices" tab of the web interface.
Is that correct?

Let me first explain how the values are updates on that page.
There is some JavaScript running on that page to fetch the values every N second via a call for some JSON stream.
This is a GET call, meaning the browser must poll to get updated values and thus it will not update immediately when a value has been updated.
The interval to fetch data is based on the lowest set "Interval" value of all tasks.

For the pulse task it may not always be very useful to set the interval as it will also generate events and send data to any connected controller (if any) at set interval.
So what you can do is add some other task like system info, and set its interval to 1 sec.
This will cause the update of the values on the Devices page to happen at 1 sec interval.
Still not real-time but may be an improvement compared to refreshing the page.

N.B. when the pulse plugin does have new values (and the rules are enabled), it will also generate an event which can then be processed in the rules to act immediately on the changed values.

wonk
Normal user
Posts: 20
Joined: 29 Nov 2020, 21:31

Re: meaning of %value% in plugin generic pulse counter

#5 Post by wonk » 08 Mar 2021, 11:43

Hi!
TD-er wrote: 07 Mar 2021, 21:04 Let me first explain how the values are updates on that page.
There is some JavaScript running on that page to fetch the values every N second via a call for some JSON stream.
This is a GET call, meaning the browser must poll to get updated values and thus it will not update immediately when a value has been updated.
The interval to fetch data is based on the lowest set "Interval" value of all tasks.
Thank you for the explanation, would be nice, if such documents are somewhere, I did not find them.
In this case, it will not work in my environment. My signal is e.g. 5 seconds low, then about 0.3 secsonds high. In this case polling with 1 secsond will not work.
Anyway my values do not change without actualising the web side, even with an interval of 1.
I tried the switch input-plugin too, but there is the same problem, maybe because of the same working method.
I will have to surch another solution.
Gruss, wonk

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

Re: meaning of %value% in plugin generic pulse counter

#6 Post by TD-er » 08 Mar 2021, 11:47

Like I said, the page does use JavaScript to fetch the updates.
Are you sure JavaScript isn't blocked in your browser?

If you right-click in the web page and click "inspect", you will get a panel showing parts of the HTML code etc.
There are several tabs in that panel, with one of them being "Network".
If you click there you should see periodical updates of fetching a JSON URL.
If that's not happening, maybe you can find more info on the "Console" of that inspect panel?

wonk
Normal user
Posts: 20
Joined: 29 Nov 2020, 21:31

Re: meaning of %value% in plugin generic pulse counter

#7 Post by wonk » 08 Mar 2021, 17:40

Hi,
javascript is enabled. the "inspection" shows:
Bild1.jpg
Bild1.jpg (48.93 KiB) Viewed 8525 times
I think, this is ok. It's firefox.

But ESPEasy Tools/Log shows:
Bild2.jpg
Bild2.jpg (35.1 KiB) Viewed 8525 times
I do not know, why the connection fails. The NodeMCU ist connected via a mesh repeater to the router, it has a fixed IP. In the router settings anything seems to be ok for me. I always can communicate with the NodeMCU with my PC connected to the router via cable.
I tried it from another PC with linux and chromium, it's the same.
Gruss, wonk

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

Re: meaning of %value% in plugin generic pulse counter

#8 Post by TD-er » 08 Mar 2021, 22:24

How do you try to connect to the host configured in C008?
Is it via DNS, and if so, is the DNS server configured on the ESP?
Is it a remote host, or local on your network?
If remote, make sure to set the timeout long enough (default is 100 msec)
If you need to connect to the internet (or another subnet) make sure to have a gateway configured on he ESP.

wonk
Normal user
Posts: 20
Joined: 29 Nov 2020, 21:31

Re: meaning of %value% in plugin generic pulse counter

#9 Post by wonk » 09 Mar 2021, 13:37

Hi!
TD-er wrote: 08 Mar 2021, 22:24 How do you try to connect to the host configured in C008?
I do not know, which is host C008. But I recognized, that the controller PC's IP was not set correct. I did so now. I did not realize this before, because the controller communication was not activated on the device tap. Now this error is gone, but I now have:
Bild3.jpg
Bild3.jpg (45.08 KiB) Viewed 8474 times
Controller communication is now activated, but the controller PC seems to get no data.
TD-er wrote: 08 Mar 2021, 22:24 Is it via DNS, and if so, is the DNS server configured on the ESP?
Is it a remote host, or local on your network?
If remote, make sure to set the timeout long enough (default is 100 msec)
If you need to connect to the internet (or another subnet) make sure to have a gateway configured on he ESP.
DNS is configured on ESP, it's the local router. ESP, PC's are all in a local network. I set timeout to 500ms, did not alter anything.
Gruss, wonk

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

Re: meaning of %value% in plugin generic pulse counter

#10 Post by TD-er » 09 Mar 2021, 13:47

Those messages you see in the log, probably appearing every 30 seconds, are more like a status update / heartbeat of ESPEasy.
Do you have any task configured to send data to the controller?
And what kind of service is on the receiving end of the configured controller?
Some services need to have "Check Reply:" in the controller settings set to "Check Acknowledgement"

wonk
Normal user
Posts: 20
Joined: 29 Nov 2020, 21:31

Re: meaning of %value% in plugin generic pulse counter

#11 Post by wonk » 11 Mar 2021, 17:59

Hi,
till now I only tested the device without sending data to a controller.

Formerly I used the NodeMCU to get data from some temperature sensors DS18B20. This worked fine. I connected such sensor new, this still works.

Looking for anther error: On NodeMCU I used D6 as input, is this correct? What does the exclamation mark behind some inputs in the devices tap mean - did not find any documentation.

Do I need a resistor between out signal of TCRT5000 and in NodeMCU? Do I need pull_up or pull_down on NodeMCU?
Gruss, wonk

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 34 guests