-
-
Yes, was thinking about sitting it on top of a meter. Currently using a Cyble pulse sensor like this one
https://strongcast.com.au/product/water-meter/cyble-sensor-pulse-output/
But was thinking that puck would be a nice thing to use for a few days of data when weather permits -
-
Hi everyone
I am trying to set the time on Puck.js from another device (ESP32).
I am not able to run from the battery as my electricity meter sometimes gets stuck on pulse LED high and after some time hangs Puck.js and drains the battery. So I am running it off mains power (3.3v), but due to that and it sometimes rebooting, I cannot keep the time in sync with real.
My other ESP32 device is withing BT reach to Puck.js and I just wondered if I can make it connect to Puck.js and somehow set the time on it
Any help with time sync would be much appreciated =) -
-
-
it was just an example. Before it was giving similar errors but from a different sections of the code
Usually it was coming up with errors around to where the comments are in the code.
When this happens, it will actually be in the half working state - all functions and variables are not defined, but it was still sending BLE advertising using the last known values
I have shared it on Gist here: -
@Gordon - thank you, I got that part sorted =)
Now, I have another annoyance - after some time of working ok, I get some random errors like this:> Uncaught ReferenceError: "pin" is not defined at line 1 col 1 pin changes ^ in function called from system Connected to PM Uncaught ReferenceError: "pin" is not defined at line 1 col 1 pin changes ^ in function called from system Uncaught ReferenceError: "unction" is not defined at line 1 col 1 unction() { // every 10 seconds ^ in function called from system Uncaught ReferenceError: "pin" is not defined at line 1 col 1 pin changes ^ in function called from system
Its like its of memory or something. I just dont know what to check as after restart it starts working again... for some time
-
OK, worked out the storage part =)
Now, I was going to set the timer function to update Date.now() to the storage, so that I can reference it after reboot and set the time to the previous value, but for some reason get an error:>Date.setTime(1642303291816.30810546875) Uncaught Error: Function "setTime" not found! at line 1 col 6 Date.setTime(1642303291816.30810546875)
-
Hi everyone.
I have a strange issue that I am trying to solve.
My puck.js gets pulses from my power meter, increments a variable value for day and hour totals and sends it via BLE. Now, I have noticed that on the receiving end the graph falls to zero and starts incrementing again, which tells me that my puck got restarted.
Is there a way to save the current values into non volatile memory, so that if it restarts, it will continue from the value it had? -
thank you again @Gordon!
I will try both. I think its the watchdog that may kick in.
Again, I dont think another device would be able to connect to it. Currently I have the button set to change the status LED between on/off. When it gets stuck it does not work either. -
was not meant to be a production code =) just something I was putting together for myself
Prints are just for debugging. I was under the impression that unless you actually connect to the console it will make no difference. Device is usually just passively sending the data via BLE and I only connect to it to see if all ok or to flash an update
When LED was getting stuck, it was draining the battery quickly. I was adding the code to minimize the drain.
clearWatch - as per API, if no parameter is supplied, all watches will be removed. This is just in the onInit stage and not used anywhere else. I think it was in the original code, so I just left it there
Did not understand the state part -
Thank you @Gordon for helping me out =)
When it disappears from the air, I cannot see it with anything. Plus it's not sending anything out.
Can you elaborate on the watchdog timer?
Power draw is not important as I am currently running it via mains power (over esp32 3.3v output)
May have to solder the wires for TTL output to use when goes off-line again -
I have uploaded the full code to pastebin, if someone interested
https://pastebin.com/rQuaKiKd -
Yes, it was based on the Smart Meter but with a heap of extra code to optimise it for my situation. ESP32 is just a BLE receiver that sends the data to Home Assistant.
It's suppose to get unstuck. I have already implemented some routines with Gordon's help to get past the stuck LED state plus I am restarting it nightly in a hope to clear whatever issues happen during the day. So far 2 days gone ok without issues
@Gordon Highly unlikely. Its in a metal box where smartmeter is. I could not connect to it from the room, so had to get my ESP32 board in the same cabinet as the smartmeter. But agree, it was a plausible suggestion. Problem is that I cannot connect to it with anything - it no longer sends the data and not visible in BT devices to connect via IDE
I just don't know how to debug it so that I know what when the issue happens -
I am giving up on Puck =(
When it works, it is reliable (apart from the battery drain, but that could be due to the LED stuck on)
But after some time it just goes off the air and no way to connect/restart it remotely. The only fix is to yank the battery out. Gave up on the battery option and using a cable to 3.3v out on the ESP32 board that sits in the same box (as BT was not powerful enough to be read from outside the metal box, though WIFI on ESP32 is ok, which uses the same frequency). But still no luck - works for a few days and then just dies.
I have added nightly reboot already, just to clear any RAM/cache issue it may have. So running out of options. Given that I have ESP32 by the meter box anyway, I will just have to modify the code and use ESP32 as a main device -
thought so too but it's only 2 days since I put a fresh battery in. After I removed puck from the meter box and stuck LED (which was not really stuck and went off after about 10 sec) puck started working again and I was able to see/connect to it without removing the battery. When I could connect, battery was showing 50% and went up to 60% a bit later on
-
it does not seem to be RAM related. I set it to reboot every night but having an issue with it getting stuck due to the stupid LED light on the meter staying on and somehow making LDR to cause the puck to hang after a while
Currently, it is checking (as you have suggested) for stuck LED and sets the PIN mode for D2 to either input_pullup or input.
Are any of the PIN modes more useful to reset it? like pin.toggle() or something?
It works for some time, but eventually somehow gets stuck in the state that stops everything.
If I remove puck from the light source, thus causing it to "unstuck", it reboots the puck and then works fine -
Tried various things - none help. Only hard reset is working.
I have also tried to play with E.reboot() to clear the RAM (reload the code) but as soon as it reboots I can no longer connect to it as wellPS: OK, worked out the part where I cannot connect to it. It must have done a reboot or whatever, which has caused this to kick in:
NRF.setSecurity({display : 1, mitm : 1, bond : 1, passkey : '123456'});
-
Hello
I had my puck running for 3 days without an issue as a power meter.
But then it stopped reading the data as a power meter and I can no longer connect to it.
It still sends current battery and temp statuses.
When I try to connect to it I get this:Disconnected from Web Bluetooth, Puck.js 1c30 Unable to retrieve board information. Connection Error? Connected to Web Bluetooth, Puck.js 1c30 (No response from board) You have pre-1v96 firmware. Upload size is limited by available RAM Prompt not detected - upload failed. Trying to recover...
-
-
-
ok... I think I get it now =) thank you for your patience - my brain must be functioning in another way =) But running through it I feel I still dont get it =)
Lets imagine that LED is not stuck and its functioning as needed. And LED is currently OFF during the time this check is done.
Running through this function makes it:
pulledUp=true
first IF is not fired up, as pulledUP variable is true
second IF is fired up and sets pulledUP variable to true again
third IF is not fired up as pulledUP variable is trueNow, there is a brief pulse of LED light, which is a normal meter functioning, but outside the function's 10second loop.
How does my setWatch function work if we did not set the pinMode for D2 to be input_pullup?setWatch(function(e) { if (!pulledUp) return; c.inc(1); pulseTotal++; update(); if (LEDStatus==1){ digitalPulse(LED1,1,1); // show activity } }, D2, { repeat:true, edge:"falling" });
I keep wanting to change
if (!pulledUp) pinMode(D2,"input_pullup");
to
if (pulledUp) pinMode(D2,"input_pullup");
Just dont understand how it works without changing the pinMode if pulledUp variable is staying true on the "unstuck" day
-
Much appreciated!