[Version 2 Release] RaspberryPints - Digital Taplist Solution

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
that is part of the issue

Can you change logger to log.logger of line 23 of python/hx711.py

Done, it now looks like this:
Python:
def log(msg, process="HX711", isDebug=False):
    if ("RFIDCheck" not in msg and "Status" not in msg) or log.lastMsg != msg:
        if log.logger is not none :
            log.logger.log(msg, process, isDebug)
        log.lastMsg = msg
    else:
        log.logger.logDB(msg, process, isDebug)
log.lastMsg = ""

But I'm sorry to tell you that the log still doesn't say anything about the load cells:
Code:
2021-03-02 06:35:31 RPINTS: No such device - Sleeping to try again
2021-03-02 06:35:37 RPINTS: valve update: RPU:VALVE:0=0
2021-03-02 06:35:37 RPINTS: valve update: RPU:VALVE:1=0
2021-03-02 06:35:37 RPINTS: valve update: RPU:VALVE:2=0
2021-03-02 06:35:37 RPINTS: valve update: RPU:VALVE:3=0
2021-03-02 06:35:39 RPINTS: starting setup...
2021-03-02 06:35:39 RPINTS: resetting alamode to try to force it to listen to us...
2021-03-02 06:35:40 RPINTS: giving it a short break to wake up again...
2021-03-02 06:35:42 RPINTS: reflashing Arduino via:
/usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -patmega328p -calamode -P/dev/ttyS0 -b115200 -D -Uflash:w:/var/www/html//arduino/raspberrypints/raspberrypints.cpp.hex:i
RPINTS: reflashing Arduino failed, moving on anyways, error was:  Command '/usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -patmega328p -calamode -P/dev/ttyS0 -b115200 -D -Uflash:w:/var/www/html//arduino/raspberrypints/raspberrypints.cpp.hex:i' returned non-zero exit status 1
2021-03-02 06:35:48 RPINTS:
2021-03-02 06:35:48 RPINTS: starting WS server
2021-03-02 06:35:48 RPINTS: starting device monitors...
2021-03-02 06:35:48 RPINTS: starting command server
2021-03-02 06:35:48 RPINTS: serial connection stopped...
2021-03-02 06:35:48 RPINTS: starting fan control
2021-03-02 06:35:48 RPINTS: global name 'none' is not defined
2021-03-02 06:35:49 RPINTS: Fan Control fanControl1 is Running
2021-03-02 06:35:49 RPINTS: fan update: RPU:FAN:36=1
2021-03-02 06:35:50 RPINTS: flowmonitor aborted, restarting...
2021-03-02 06:35:50 RPINTS: serial connection stopped...
2021-03-02 06:35:50 RPINTS: global name 'none' is not defined
2021-03-02 06:35:51 RPINTS: flowmonitor aborted, restarting...
2021-03-02 06:35:51 RPINTS: serial connection stopped...
So it just changed from global name 'logger' is not defined to global name 'none' is not defined
 
But I'm sorry to tell you that the log still doesn't say anything about the load cells:
Im really questioning what i did when i added load cell logging....

Anyways none on line 23 should be None
1614691620099.png


I found time to run this locally and found a few other changes that need to be made, if you update to the latest (specifically /python/hx711.py) it should at least look like its trying to communicate with the load cells
 
Im really questioning what i did when i added load cell logging....

Probably taking a well deserved break with a beer and cursing about people like me who keep annoying you :bigmug:
Uploaded the logs here (log) since I honestly don't have a clue what I'm looking for :D, it seems to be getting data tough?
 
it seems to be getting data tough
Yes its getting data but there is one more exceptions in the log i see.

You also need to surround tare_offset with int() on line 93
1614699863721.png


I updated my dev environment earlier this year and am still trying to get used to the new way of committing changes. So my latest doesnt actually have that change in it yet
 
Then I get the error int() argument must be a string or a number, not 'NoneType' in the log
ok i just added a None check to line 91 (might be 92 for your version)
1614701189986.png


I think i also think i finally got my changes committed to github for you to take
 
ok i just added a None check to line 91 (might be 92 for your version)
View attachment 720652

I think i also think i finally got my changes committed to github for you to take

Super great! Did the change and now that error is gone from the log
It even seemed to change values on the load cell page, then I pressed the "Tare" button and it seems to be stuck at the same value even if I put weights on it
 
It even seemed to change values on the load cell page, then I pressed the "Tare" button and it seems to be stuck at the same value even if I put weights on it
Do you have all the taps setup for load cells? are all the pin number > 0? I see "The channel sent is invalid on a Raspberry Pi" in the log which i believe is the code trying to setup an invalid pin. the code checks for null pin numbers but doesnt check for 0 pin number.

Also i dont think the Tare was caused the issue because the log stops recording values well before the tare.
What i do see in the log is " Not enough fast while reading data" which happens if the code takes more than 6 microseconds to turn the clock on and off. It looks like if its over 60 microseconds then the load cell powers down.
Did you take my latest from github or just make the changes i recommended? if its my latest i see a few changes i can make to slightly improve speed.

You may need to repower the load cell to get it to report the weight again.
 
Do you have all the taps setup for load cells? are all the pin number > 0? I see "The channel sent is invalid on a Raspberry Pi" in the log which i believe is the code trying to setup an invalid pin. the code checks for null pin numbers but doesnt check for 0 pin number.
No I've only completed 2 load cells yet, but those taps are empty so far... should I enter some placeholder random pins in them?
1614713378639.png


Also i dont think the Tare was caused the issue because the log stops recording values well before the tare.
What i do see in the log is " Not enough fast while reading data" which happens if the code takes more than 6 microseconds to turn the clock on and off. It looks like if its over 60 microseconds then the load cell powers down.
Did you take my latest from github or just make the changes i recommended? if its my latest i see a few changes i can make to slightly improve speed.

You may need to repower the load cell to get it to report the weight again.
I updated again, this time from the shell and it takes almost a full minute before I start getting those "Not enough fast..." in the log but before that it also spits out a new error:
Code:
2021-03-02 20:23:04 RPINTS: Unable to run Load Cell Checker
2021-03-02 20:23:04 RPINTS: Converted 2's complement value: 0
2021-03-02 20:23:04 RPINTS: unsupported operand type(s) for /: 'int' and 'NoneType'
2021-03-02 20:23:04 RPINTS: Traceback (most recent call last):
  File "/var/www/html/python/FlowMonitor.py", line 644, in run
    weight = self.getWeight()
  File "/var/www/html/python/FlowMonitor.py", line 631, in getWeight
    return self.hx711.get_weight_mean(20)
  File "/var/www/html/python/hx711.py", line 499, in get_weight_mean
    (result - self._offset_A_128) / self._scale_ratio_A_128)
TypeError: unsupported operand type(s) for /: 'int' and 'NoneType'

It's a 3b+ so should be able to handle it or do I need to order a 4?
 
those taps are empty so far... should I enter some placeholder random pins in them?
i think its caused by you having pin 6 defined for tap 2 which i believe is ground.

I updated again, this time from the shell and it takes almost a full minute before I start getting those "Not enough fast..." in the log but before that it also spits out a new error:
I restructured my changes from today to reduce the likelihood of them having affect on the execution time. I dont think they were the issue but they will help.
Getting the latest again would be a good test of it,

3b+ should be enough for this. the one thing I can think of is loading an example code outside of Rpints and see if you get a different result. If you do then there is something slowing down the pin writing in Rpints
 
i think its caused by you having pin 6 defined for tap 2 which i believe is ground.
Oh bloody heck... it was GPIO 5 and 6 so changed the pins now to the correct 29/31
1614760418708.png


I restructured my changes from today to reduce the likelihood of them having affect on the execution time. I dont think they were the issue but they will help.
Getting the latest again would be a good test of it,

3b+ should be enough for this. the one thing I can think of is loading an example code outside of Rpints and see if you get a different result. If you do then there is something slowing down the pin writing in Rpints

Pulled the latest again this morning and the log looks fine at first but then I get:
Code:
2021-03-03 09:11:58 RPINTS: Unable to run Load Cell Checker
2021-03-03 09:11:58 RPINTS: unsupported operand type(s) for /: 'int' and 'NoneType'
2021-03-03 09:11:58 RPINTS: Traceback (most recent call last):
  File "/var/www/html/python/FlowMonitor.py", line 644, in run
    weight = self.getWeight()
  File "/var/www/html/python/FlowMonitor.py", line 631, in getWeight
    return self.hx711.get_weight_mean(20)
  File "/var/www/html/python/hx711.py", line 499, in get_weight_mean
    (result - self._offset_A_128) / self._scale_ratio_A_128)
TypeError: unsupported operand type(s) for /: 'int' and 'NoneType'

2021-03-03 09:11:59 RPINTS: Init Finished Command 31 Rsp 29
2021-03-03 09:11:59 RPINTS: Load Cell Checker LC-2 is Running

After that showed up a couple of times the Not enough fast while reading data starts showing up more frequently. I'll solder the second load cell today and attach to see if that's the problem. Tried removing the pins from that one but after clicking save and reloading they're still there!
 
Pulled the latest again this morning and the log looks fine at first but then I get:
That is because the scale ratio and tare offset are empty. I add logic to check for None in hx711 to prevent that

Tried removing the pins from that one but after clicking save and reloading they're still there!
Im am working on a fix for that
 
You know, I feel terrible for giving you all these problems with it but I also want to say I am super thankful for all your hard work with raspberrypints and being supportive all the time!

So I followed your suggestion of running another script so I followed this guide that I think you linked to earlier.
First off it made me realize some of my solderings was off since it gave me no results and they seem to be inverted since when I put my 1kg load on it went from ~-80 to about -23000
71
21
83
21
-19
13
-90
-71
-106
-345
-8961
-23006
-22978
-22973
-22956
-22989
-23028
-23002
-23011
-23012
-23003
-22981
-23026
-23016
-23031
-23026
-23080

10
-28
-28
-38
-47
-36
-44
-50
-55

But I followed the guide since it said that negative values didn't really matter and calibrated it to -22.54 (-23000/1020) since the load I used weighed 1020g and it works
pi@rpints:~/hx711py $ sudo python example.py
Tare done! Add weight now...
0.177462289264
-1.99645075421
-1.19787045253
0.798580301686
-0.221827861579
-0.0443655723159
0.310559006211
-0.532386867791
-0.0887311446318
1.73025732032
-0.310559006211
1.19787045253
1.06477373558
2.48447204969
-0.488021295475
84.826974268
1022.89263531
235.891748004
1009.00621118
1010.91393079
1011.04702751
1011.75687666
1010.64773736
1010.86956522
1012.77728483
1012.0230701
1010.07098492
1011.40195209
1010.95829636
1011.40195209
1011.75687666
1012.51109139
1012.46672582
1011.40195209
1014.418811

-1.73025732032
1.33096716948
-0.177462289264
1.1091393079
0.0887311446318
1.55279503106
0.75421472937
1.64152617569
-0.443655723159
0.443655723159
0.0443655723159
^CCleaning...
Bye!

Started flowmon again and the log gives me a new error again! (yes, updated right before doing it with your new versions)
Code:
2021-03-03 16:12:47 RPINTS: Not listening for flowmeters
2021-03-03 16:12:47 RPINTS: filtered_data list: [16383, 7]
('Unexpected error:', <type 'exceptions.AttributeError'>)
Traceback (most recent call last):
  File "/var/www/html/python/FlowMonitor.py", line 285, in monitor
2021-03-03 16:12:47 RPINTS: Converted 2's complement value: -48970
    msg = self.readline_notimeout()
  File "/var/www/html/python/FlowMonitor.py", line 80, in readline_notimeout
    c = self.arduino.read(1)
AttributeError: 'FlowMonitor' object has no attribute 'arduino'
2021-03-03 16:12:47 RPINTS: closing serial connection to Arduino...
2021-03-03 16:12:47 RPINTS: data_mean:8195

And then back to not being fast enough after a few iterations. Might the problem be that it's sending negative values somehow?
 
So I followed your suggestion of running another script so I followed this guide that I think you linked to earlier.
I have that code locally like i plan to convert the one i have to use it. I know others have used the version of code in GitHub but maybe there is some flaws in it. I have to be honest i got it from an open source project and updated it to work with RPints so im not that familiar with how load cells work
 
Wait what... does it support mqtt?
I added logic from another user to listen for mqtt, but the sender has to adhere to the message format of RPints arduino code.

Also I converted the example hx711 file you tested with to work with Rpints. It run but i am not sure it works because i dont have load cells.
I attached it if you rename to hx711.py and restart Flowmonitor to see if it works better
 

Attachments

  • hx711-New.txt
    14.2 KB · Views: 3
I added logic from another user to listen for mqtt, but the sender has to adhere to the message format of RPints arduino code.

Also I converted the example hx711 file you tested with to work with Rpints. It run but i am not sure it works because i dont have load cells.
I attached it if you rename to hx711.py and restart Flowmonitor to see if it works better

Ah cool, I thought maybe it would send temp, pours, beer stats etc to a mqtt server! Get the speakers to play cheering sounds everytime one pours a beer etc :D

Ok tried your new file and good thing is that the logs isn't showing any errors or "to slow" messages. The downside... nothing is showing in the UI either. It just stays at the same values. Tried adding a 1 to the ratio, leaving them empty, adding weights, removing weights etc. but no change
1614801383719.png
 
Have you authoritatively documented this format anywhere?
Like everything in my RPints, No.

The main message is Pour with the format semi-colon delimited:
P;<USER_ID>;<PIN>;<COUNT>
Where:
P = "P" for pour
<USER_ID> = ID to associated to the pour -1 for no user
<PIN> = pin in tap configuration
<COUNT> = number of ticks
 
Ah cool, I thought maybe it would send temp, pours, beer stats etc to a mqtt server! Get the speakers to play cheering sounds everytime one pours a beer etc
not impossible but not currently in the code.

The downside... nothing is showing in the UI either. It just stays at the same values.
I missed a keyword to pass back the weight back to save to the database

on line 291 add return before self.get_weight and restart
1614802440677.png
 
not impossible but not currently in the code.


I missed a keyword to pass back the weight back to save to the database

on line 291 add return before self.get_weight and restart
View attachment 720790

Ok changed the file as you suggested
Python:
    # Compatibility function, uses channel A version
    def get_weight_mean(self, times=3):
        return self.get_weight(times)

And no errors in the log but still no changes to the values in the frontend. I don't blame you if you want to give up on this ;)
 
And no errors in the log but still no changes to the values in the frontend. I don't blame you if you want to give up on this
I dont give up as long as someone is willing to give me feedback.

i think we are on the right track with the new hx711. I setup my test VM to use 3 bytes from your log [0, 236, 253] and it successfully saved a weight of ~60700
i set the scale to 6000 and it gave me a weight of 10.115, I know that its not correct but I think it proves that it is "working" to save to the database.

I think a little more trace will help solve the issue.
could you add the following around line 644 of FlowMonitor.py and restart
debug("Weight="+str(weight))

1614806847405.png
 
I dont give up as long as someone is willing to give me feedback.

Oh well in that case I'll do anything to help. Made the changes and it's now reporting weights in the log

It's reporting weights now just as you said
Code:
2021-03-04 07:19:17 RPINTS: [0, 237, 202]
2021-03-04 07:19:17 RPINTS: Weight=247189.0
2021-03-04 07:19:17 RPINTS: Twos: 0x00edca
2021-03-04 07:19:17 RPINTS: [0, 237, 144]
2021-03-04 07:19:17 RPINTS: Twos: 0x00ed90
2021-03-04 07:19:17 RPINTS: Weight=60877.0

~24k seems to be without a weight on and the ~60k is with 1020g weight on it. I removed the weight and it wen't down to ~39k
2021-03-04 09:10:07 RPINTS: Weight=38809.5
2021-03-04 09:10:07 RPINTS: Twos: 0x03c5c8
2021-03-04 09:10:08 RPINTS: Weight=247262.5
[2021-03-04 09:10:08,719] [ERROR] mod_pywebsocket.standalone.WebSocketServer: Exception in processing request from: ('::1', 50008, 0, 0)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 293, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 610, in process_request
t.start()
File "/usr/lib/python2.7/threading.py", line 736, in start
_start_new_thread(self.__bootstrap, ())
error: can't start new thread

2021-03-04 09:10:09 RPINTS: [0, 151, 164]
2021-03-04 09:10:09 RPINTS: [3, 197, 231]
2021-03-04 09:10:09 RPINTS: Twos: 0x0097a4
2021-03-04 09:10:09 RPINTS: Twos: 0x03c5e7
2021-03-04 09:10:09 RPINTS: [0, 151, 157]
2021-03-04 09:10:09 RPINTS: [3, 197, 238]
2021-03-04 09:10:09 RPINTS: Twos: 0x00979d
2021-03-04 09:10:09 RPINTS: Twos: 0x03c5ee
2021-03-04 09:10:09 RPINTS: [0, 151, 176]
2021-03-04 09:10:09 RPINTS: [3, 197, 252]
2021-03-04 09:10:09 RPINTS: Twos: 0x0097b0
2021-03-04 09:10:10 RPINTS: Twos: 0x03c5fc
2021-03-04 09:10:10 RPINTS: [0, 151, 168]
2021-03-04 09:10:10 RPINTS: [255, 255, 255]
2021-03-04 09:10:10 RPINTS: Twos: 0x0097a8
2021-03-04 09:10:10 RPINTS: Twos: 0xffffff
2021-03-04 09:10:10 RPINTS: [0, 151, 156]
2021-03-04 09:10:10 RPINTS: [3, 197, 248]
2021-03-04 09:10:10 RPINTS: Twos: 0x00979c
2021-03-04 09:10:10 RPINTS: Twos: 0x03c5f8
2021-03-04 09:10:10 RPINTS: [0, 151, 163]
2021-03-04 09:10:10 RPINTS: [3, 198, 12]
2021-03-04 09:10:10 RPINTS: Twos: 0x0097a3
2021-03-04 09:10:10 RPINTS: Twos: 0x03c60c
2021-03-04 09:10:10 RPINTS: [0, 151, 137]
2021-03-04 09:10:10 RPINTS: [3, 198, 3]
2021-03-04 09:10:10 RPINTS: Twos: 0x009789
2021-03-04 09:10:10 RPINTS: Twos: 0x03c603
2021-03-04 09:10:10 RPINTS: [0, 151, 131]
2021-03-04 09:10:10 RPINTS: [3, 197, 230]
2021-03-04 09:10:10 RPINTS: Twos: 0x009783
2021-03-04 09:10:10 RPINTS: Twos: 0x03c5e6
2021-03-04 09:10:10 RPINTS: [3, 197, 200]
2021-03-04 09:10:10 RPINTS: [0, 151, 145]
2021-03-04 09:10:10 RPINTS: Twos: 0x009791
2021-03-04 09:10:10 RPINTS: Twos: 0x03c5c8
2021-03-04 09:10:10 RPINTS: [0, 151, 153]
2021-03-04 09:10:10 RPINTS: Twos: 0x009799
2021-03-04 09:10:10 RPINTS: [3, 198, 4]
2021-03-04 09:10:11 RPINTS: [0, 151, 151]
2021-03-04 09:10:11 RPINTS: Twos: 0x03c604
2021-03-04 09:10:11 RPINTS: Twos: 0x009797
2021-03-04 09:10:11 RPINTS: [1, 226, 239]
2021-03-04 09:10:11 RPINTS: [0, 151, 178]
2021-03-04 09:10:11 RPINTS: Twos: 0x01e2ef
2021-03-04 09:10:11 RPINTS: Twos: 0x0097b2
2021-03-04 09:10:11 RPINTS: [3, 197, 161]
2021-03-04 09:10:11 RPINTS: [0, 75, 219]
2021-03-04 09:10:11 RPINTS: Twos: 0x03c5a1
2021-03-04 09:10:11 RPINTS: Twos: 0x004bdb
2021-03-04 09:10:11 RPINTS: [3, 197, 164]
2021-03-04 09:10:11 RPINTS: Twos: 0x03c5a4
2021-03-04 09:10:11 RPINTS: [0, 151, 182]
2021-03-04 09:10:11 RPINTS: [3, 197, 187]
2021-03-04 09:10:11 RPINTS: Twos: 0x0097b6
2021-03-04 09:10:11 RPINTS: Twos: 0x03c5bb
2021-03-04 09:10:11 RPINTS: [0, 151, 167]
2021-03-04 09:10:11 RPINTS: [3, 197, 211]
2021-03-04 09:10:11 RPINTS: Twos: 0x0097a7
2021-03-04 09:10:11 RPINTS: Twos: 0x03c5d3
2021-03-04 09:10:11 RPINTS: [0, 151, 166]
2021-03-04 09:10:11 RPINTS: [3, 197, 245]
2021-03-04 09:10:11 RPINTS: Twos: 0x0097a6
2021-03-04 09:10:11 RPINTS: Twos: 0x03c5f5
2021-03-04 09:10:11 RPINTS: [0, 151, 191]
2021-03-04 09:10:11 RPINTS: [3, 197, 255]
2021-03-04 09:10:11 RPINTS: Twos: 0x03c5ff
2021-03-04 09:10:11 RPINTS: Twos: 0x0097bf
2021-03-04 09:10:11 RPINTS: [3, 197, 246]
2021-03-04 09:10:11 RPINTS: [0, 151, 203]
2021-03-04 09:10:11 RPINTS: Twos: 0x03c5f6
2021-03-04 09:10:12 RPINTS: Twos: 0x0097cb
2021-03-04 09:10:12 RPINTS: [3, 197, 166]
2021-03-04 09:10:12 RPINTS: [0, 151, 137]
2021-03-04 09:10:12 RPINTS: Twos: 0x03c5a6
2021-03-04 09:10:12 RPINTS: Twos: 0x009789
2021-03-04 09:10:12 RPINTS: [3, 197, 214]
2021-03-04 09:10:12 RPINTS: [0, 151, 105]
2021-03-04 09:10:12 RPINTS: Twos: 0x03c5d6
2021-03-04 09:10:12 RPINTS: Twos: 0x009769
2021-03-04 09:10:12 RPINTS: Weight=247273.5
2021-03-04 09:10:12 RPINTS: Weight=38818.5
[2021-03-04 09:10:12,930] [ERROR] mod_pywebsocket.standalone.WebSocketServer: Exception in processing request from: ('::1', 50016, 0, 0)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 293, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 610, in process_request
t.start()
File "/usr/lib/python2.7/threading.py", line 736, in start
_start_new_thread(self.__bootstrap, ())
error: can't start new thread

2021-03-04 09:10:13 RPINTS: [3, 194, 233]
2021-03-04 09:10:13 RPINTS: [0, 151, 176]
2021-03-04 09:10:13 RPINTS: Twos: 0x03c2e9
2021-03-04 09:10:13 RPINTS: Twos: 0x0097b0
2021-03-04 09:10:13 RPINTS: [0, 151, 125]
2021-03-04 09:10:13 RPINTS: [3, 198, 14]
2021-03-04 09:10:13 RPINTS: Twos: 0x00977d
2021-03-04 09:10:13 RPINTS: Twos: 0x03c60e
2021-03-04 09:10:13 RPINTS: [0, 151, 152]
2021-03-04 09:10:13 RPINTS: [3, 197, 207]
2021-03-04 09:10:13 RPINTS: Twos: 0x009798
2021-03-04 09:10:14 RPINTS: Twos: 0x03c5cf
2021-03-04 09:10:14 RPINTS: [0, 151, 131]
2021-03-04 09:10:14 RPINTS: [3, 197, 211]
2021-03-04 09:10:14 RPINTS: Twos: 0x009783
2021-03-04 09:10:14 RPINTS: Twos: 0x03c5d3
2021-03-04 09:10:14 RPINTS: [0, 151, 153]
2021-03-04 09:10:14 RPINTS: [3, 197, 242]
2021-03-04 09:10:14 RPINTS: Twos: 0x009799
2021-03-04 09:10:14 RPINTS: Twos: 0x03c5f2
2021-03-04 09:10:14 RPINTS: [0, 151, 170]
2021-03-04 09:10:14 RPINTS: [3, 198, 0]
2021-03-04 09:10:14 RPINTS: Twos: 0x0097aa
2021-03-04 09:10:14 RPINTS: Twos: 0x03c600
2021-03-04 09:10:14 RPINTS: [0, 151, 169]
2021-03-04 09:10:14 RPINTS: [3, 197, 255]
2021-03-04 09:10:14 RPINTS: Twos: 0x0097a9
2021-03-04 09:10:14 RPINTS: Twos: 0x03c5ff
2021-03-04 09:10:14 RPINTS: [0, 151, 168]
2021-03-04 09:10:14 RPINTS: [3, 226, 248]
2021-03-04 09:10:14 RPINTS: Twos: 0x0097a8
2021-03-04 09:10:14 RPINTS: Twos: 0x03e2f8
2021-03-04 09:10:14 RPINTS: [0, 151, 171]
2021-03-04 09:10:14 RPINTS: [255, 255, 255]
2021-03-04 09:10:14 RPINTS: Twos: 0x0097ab
2021-03-04 09:10:14 RPINTS: Twos: 0xffffff
2021-03-04 09:10:14 RPINTS: [3, 197, 198]
2021-03-04 09:10:14 RPINTS: [0, 151, 132]
2021-03-04 09:10:14 RPINTS: Twos: 0x03c5c6
2021-03-04 09:10:14 RPINTS: Twos: 0x009784
2021-03-04 09:10:14 RPINTS: [3, 197, 222]
2021-03-04 09:10:14 RPINTS: [0, 151, 158]
2021-03-04 09:10:14 RPINTS: Twos: 0x03c5de
2021-03-04 09:10:14 RPINTS: Twos: 0x00979e
2021-03-04 09:10:14 RPINTS: [3, 197, 240]
2021-03-04 09:10:14 RPINTS: [0, 151, 164]
2021-03-04 09:10:14 RPINTS: Twos: 0x03c5f0
2021-03-04 09:10:14 RPINTS: Twos: 0x0097a4
2021-03-04 09:10:14 RPINTS: [3, 197, 214]
2021-03-04 09:10:14 RPINTS: [0, 151, 165]
2021-03-04 09:10:14 RPINTS: Twos: 0x03c5d6
2021-03-04 09:10:15 RPINTS: Twos: 0x0097a5
2021-03-04 09:10:15 RPINTS: [3, 197, 244]
2021-03-04 09:10:15 RPINTS: [0, 151, 168]
2021-03-04 09:10:15 RPINTS: Twos: 0x03c5f4
2021-03-04 09:10:15 RPINTS: Twos: 0x0097a8
2021-03-04 09:10:15 RPINTS: [3, 197, 245]
2021-03-04 09:10:15 RPINTS: [0, 151, 180]
2021-03-04 09:10:15 RPINTS: Twos: 0x03c5f5
2021-03-04 09:10:15 RPINTS: Twos: 0x0097b4
2021-03-04 09:10:15 RPINTS: [3, 197, 200]
2021-03-04 09:10:15 RPINTS: Twos: 0x03c5c8
2021-03-04 09:10:15 RPINTS: [0, 151, 255]
2021-03-04 09:10:15 RPINTS: [3, 197, 228]
2021-03-04 09:10:15 RPINTS: Twos: 0x0097ff
2021-03-04 09:10:15 RPINTS: Twos: 0x03c5e4
2021-03-04 09:10:15 RPINTS: [3, 197, 175]
2021-03-04 09:10:15 RPINTS: [0, 151, 200]
2021-03-04 09:10:15 RPINTS: Twos: 0x03c5af
2021-03-04 09:10:15 RPINTS: Twos: 0x0097c8
2021-03-04 09:10:15 RPINTS: [3, 197, 226]
2021-03-04 09:10:15 RPINTS: [0, 151, 147]
2021-03-04 09:10:15 RPINTS: Twos: 0x03c5e2
2021-03-04 09:10:15 RPINTS: Twos: 0x009793
2021-03-04 09:10:15 RPINTS: [3, 197, 208]
2021-03-04 09:10:15 RPINTS: Twos: 0x03c5d0
2021-03-04 09:10:15 RPINTS: [0, 151, 164]

No problems at all with "not enough fast" anymore and just a random error with the websocket

Code:
[2021-03-04 08:37:45,804] [ERROR] mod_pywebsocket.standalone.WebSocketServer: Exception in processing request from: ('::1', 46966, 0, 0)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 293, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 610, in process_request
    t.start()
  File "/usr/lib/python2.7/threading.py", line 736, in start
    _start_new_thread(self.__bootstrap, ())
error: can't start new thread
 
~24k seems to be without a weight on and the ~60k is with 1020g weight on it. I removed the weight and it wen't down to ~39k
From the log I see ~247k, ~60k, and ~39K so weights are coming in. Are the weights on the Load Cell page still not changing?

Do you have 2 load cells hooked up?


I think we can disable the loadcell.debug now as I think we are past looking at its logic
In python/Config.py change
config['loadcell.debug' ] = True
to
config['loadcell.debug' ] = False#True

I committed this version of hx711, I think its better than the one I had.

error with the websocket
Im not worried about this exception, it part of the auto refresh logic when a pour is registered
 
Ah yeah, 247k... not sure how I missed that! Funny that they are so far apart when it's the same components but that's what aliexpress quality gives you :D

And yes, I have 2 loadcells connected, this is the log now without the debug and it's showing both scales values:
2021-03-04 14:32:29 RPINTS: starting WS server
2021-03-04 14:32:30 RPINTS: starting device monitors...
2021-03-04 14:32:30 RPINTS: starting command server
2021-03-04 14:32:30 RPINTS: starting fan control
2021-03-04 14:32:30 RPINTS: Fan Control fanControl1 is Running
2021-03-04 14:32:30 RPINTS: fan update: RPU:FAN:36=1
2021-03-04 14:32:31 RPINTS: Load Cell Checker LC-1 is Running
2021-03-04 14:32:32 RPINTS: Load Cell Checker LC-2 is Running
2021-03-04 14:32:32 RPINTS: 1Wire Temperature Thread 1 is Running
2021-03-04 14:32:32 RPINTS: Weight=248720.0
2021-03-04 14:32:33 RPINTS: Not listening for flowmeters
2021-03-04 14:32:34 RPINTS: Weight=39372.0
2021-03-04 14:32:38 RPINTS: Weight=248702.0
2021-03-04 14:32:38 RPINTS: Weight=39360.0
2021-03-04 14:32:42 RPINTS: Weight=248726.5
2021-03-04 14:32:42 RPINTS: Weight=39359.5
2021-03-04 14:32:45 RPINTS: Weight=39374.5
2021-03-04 14:32:46 RPINTS: Weight=248724.0
2021-03-04 14:32:49 RPINTS: Weight=39370.5
2021-03-04 14:32:49 RPINTS: Weight=248695.5
2021-03-04 14:32:53 RPINTS: Weight=39374.0
2021-03-04 14:32:53 RPINTS: Weight=248713.5
2021-03-04 14:32:56 RPINTS: Weight=39399.5
2021-03-04 14:32:57 RPINTS: Weight=248723.5
2021-03-04 14:33:00 RPINTS: Weight=248737.5
2021-03-04 14:33:00 RPINTS: Weight=39384.0
2021-03-04 14:33:03 RPINTS: Weight=39400.5
2021-03-04 14:33:04 RPINTS: Weight=248725.0

But yeah the load cell page never changes from 63.0000 and 70.0000
1614865003192.png
 
And yes, I have 2 loadcells connected, this is the log now without the debug and it's showing both scales values:
Ok thats what I thought. I think we should update the weight logging to display which load cell is reporting the weight
in FlowMonitor.py
Change the latest debug statement we added to
debug(self.threadID+": Weight="+str(weight))
1614865481866.png


But yeah the load cell page never changes from 63.0000 and 70.0000
The next step is to check if the update webhook is being called.
After that debug statement lets change the code lets change the next 4-5 lines to this:
#if weight is valid and the difference between the last read is significant enough to update
if weight > 0 and (lastWeight = -1.0 or abs(lastWeight - weight) > self.updateVariance) :
#The following 2 lines passes the PIN and WEIGHT to the php script
subprocess.call(["php", self.updateDir + '/admin/updateKeg.php', str(self.tapId), str(weight), self.unit])
debug(self.threadID+": Updating "+str(self.tapId)+" Weight="+str(weight)+" "+self.unit)

1614865846106.png
 

Attachments

  • 1614865470355.png
    1614865470355.png
    6.7 KB · Views: 4
Hmm, changed it to:
Python:
                weight = self.getWeight()
                debug(self.threadID+": Weight="+str(weight))
                #if weight is valid and the difference between the last read is significant enough to update
                if weight > 0 and (lastWeight = -1.0 or abs(lastWeight - weight) > self.updateVariance) :
                    #The following 2 lines passes the PIN and WEIGHT to the php script
                    subprocess.call(["php", self.updateDir + '/admin/updateKeg.php', str(self.tapId), str(weight), self.unit])
                    debug(self.threadID+": Updating "+str(self.tapId)+" Weight="+str(weight)+" "+self.unit)
                    lastWeight = weight
                time.sleep(self.delay)
But got this at once?
Code:
Traceback (most recent call last):
  File "/var/www/html/python/PintDispatch.py", line 18, in <module>
    from FlowMonitor import FlowMonitor
  File "/var/www/html/python/FlowMonitor.py", line 647
    if weight > 0 and (lastWeight = -1.0 or abs(lastWeight - weight) > self.updateVariance) :
                                  ^
SyntaxError: invalid syntax
 
Ok this was interesting! Log looks fine giving weight values that's easy to read like
Code:
2021-03-04 15:19:28 RPINTS: LC-1: Updating 1 Weight=248836.5 kg
2021-03-04 15:19:28 RPINTS: LC-2: Updating 2 Weight=39178.0 kg
2021-03-04 15:19:31 RPINTS: LC-1: Weight=248826.5
2021-03-04 15:19:32 RPINTS: LC-2: Weight=39172.5
2021-03-04 15:19:32 RPINTS: LC-2: Updating 2 Weight=39172.5 kg
2021-03-04 15:19:32 RPINTS: LC-1: Updating 1 Weight=248826.5 kg
2021-03-04 15:19:35 RPINTS: LC-1: Weight=248846.5
2021-03-04 15:19:35 RPINTS: LC-2: Weight=39193.0
2021-03-04 15:19:36 RPINTS: LC-1: Updating 1 Weight=248846.5 kg
2021-03-04 15:19:36 RPINTS: LC-2: Updating 2 Weight=39193.0 kg
2021-03-04 15:19:39 RPINTS: LC-1: Weight=248829.5

But then it throws a:
Code:
[2021-03-04 15:19:28,372] [ERROR] mod_pywebsocket.standalone.WebSocketServer: Exception in processing request from: ('::1', 43232, 0, 0)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 599, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/dist-packages/mod_pywebsocket/standalone.py", line 664, in __init__
    self, request, client_address, server)
  File "/usr/lib/python2.7/SocketServer.py", line 657, in __init__
    self.finish()
  File "/usr/lib/python2.7/SocketServer.py", line 716, in finish
    self.wfile.close()
  File "/usr/lib/python2.7/socket.py", line 283, in close
    self.flush()
  File "/usr/lib/python2.7/socket.py", line 307, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe

And after that I can't access the admin page anymore, tap page on the frontend seems to be working as normal, I can update the page etc, but just refuses to load "admin/admin.php"
 
looks fine giving weight values that's easy to read like
Yes looks like it should be updating the page.

just refuses to load "admin/admin.php"
The error in the log has nothing to do with loading the admin page. that is specific to the tap list listening for pours. So if you dont open the tap list after a restart you shouldnt see the exception.

Can you look at /var/log/apache2/error.log for any error after you refresh/open the admin page.

I have seen this before where there is a long running SQL query that is causing the page not to load, but if you are just loading the home page no SQL queries should be running. Nor do any look at a historical weight so that shouldnt be that.
 
yeah this should be about the same time:
Code:
[Thu Mar 04 15:28:16.740664 2021] [php7:notice] [pid 25942] [client 192.168.1.219:54881] PHP Notice:  session_start(): A session had already been started - ignoring in /var/www/html/admin/header.php on line 2, referer: http://192.168.1.112/admin/load_cell_list.php

Admin page loads now tough but still no change in values on the load cell page. Want me to do a reinstall incase something got messed up somewhere along the line?
 
Admin page loads now tough but still no change in values on the load cell page. Want me to do a reinstall incase something got messed up somewhere along the line?
You can try to reinstall but first I think we need to add more trace to admin/updateKeg.php

could you add

echo "Tap:".$TAPID."\n";
and
echo "Keg:".$tap->get_kegId()."\n";
1614870997971.png


that should log something like:
1614871025446.png
 
that should log something like:
View attachment 720871

Yup, looks exactly like that:
2021-03-04 16:27:23 RPINTS: Load Cell Checker LC-1 is Running
2021-03-04 16:27:24 RPINTS: Load Cell Checker LC-2 is Running
2021-03-04 16:27:24 RPINTS: 1Wire Temperature Thread 1 is Running
2021-03-04 16:27:24 RPINTS: LC-1: Weight=249655.0
2021-03-04 16:27:25 RPINTS: Not listening for flowmeters
2021-03-04 16:27:26 RPINTS: LC-2: Weight=40314.0
Tap:2
Tap:1
Keg:3
Keg:2
2021-03-04 16:27:28 RPINTS: LC-1: Updating 1 Weight=249655.0 kg
2021-03-04 16:27:28 RPINTS: LC-2: Updating 2 Weight=40314.0 kg
2021-03-04 16:27:31 RPINTS: LC-1: Weight=249657.0
Tap:1
Keg:2
2021-03-04 16:27:32 RPINTS: LC-2: Weight=40299.5
2021-03-04 16:27:32 RPINTS: LC-1: Updating 1 Weight=249657.0 kg
Tap:2
Keg:3
2021-03-04 16:27:33 RPINTS: LC-2: Updating 2 Weight=40299.5 kg
2021-03-04 16:27:35 RPINTS: LC-1: Weight=249681.5
2021-03-04 16:27:36 RPINTS: LC-2: Weight=40316.0
Tap:1
Keg:2
Tap:2
Keg:3
2021-03-04 16:27:36 RPINTS: LC-1: Updating 1 Weight=249681.5 kg
2021-03-04 16:27:36 RPINTS: LC-2: Updating 2 Weight=40316.0 kg
2021-03-04 16:27:39 RPINTS: LC-1: Weight=249667.5
2021-03-04 16:27:39 RPINTS: LC-2: Weight=40297.0
Tap:1
Tap:2
Keg:2
Keg:3
And that looks correct with Keg "Nr 2" on Tap 1 and Keg "Nr 3" on Tap 2
1614873311037.png


Noticed now that when I took this screenshot that it shows the weights on the tap screen correct, or atleast with the values being sent. Same thing on the Keg list: (current amount)
1614873415853.png


but the load cell page is still showing some old numbers:
1614873501031.png
 
but the load cell page is still showing some old numbers:
So it seems everything is working except the load cell page. Which is odd because its working on my test setup.

We can add more trace to admin/load_cell_list.php to figure out what keg is actually being displayed.
add

echo $keg->get_id().";".$keg->get_label().";";
to line 142
1614876106469.png


one other thing to try is to hit the backup button on the install page, this will backup your database to sql/backups
1614875915259.png

from there if you rename it to .txt and upload it, I can run it on my test environment to see if I get the same results. Then we know its the data and the code needs to adjust for it
 
So it seems everything is working except the load cell page. Which is odd because its working on my test setup.

We can add more trace to admin/load_cell_list.php to figure out what keg is actually being displayed.
add

echo $keg->get_id().";".$keg->get_label().";";
to line 142
View attachment 720878

one other thing to try is to hit the backup button on the install page, this will backup your database to sql/backups
View attachment 720877
from there if you rename it to .txt and upload it, I can run it on my test environment to see if I get the same results. Then we know its the data and the code needs to adjust for it

So made the change, tried doing a backup but...
Code:
Validating Entries...Success!
Checking DB connectivity...Success Connecting to Database!
Checking config folder permissions...Success!
backing RaspberryPints...
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 16384 bytes) in /var/www/html/install/includes/configprocessor.php on line 162

Anyway the load cell page shows the correct kegs but wrong values
1614880845497.png


Are the latest changes pushed to git, I'll do a reinstall and see if that helps. Should I clean out something or is it enough to just run the install script and select "Reinstall RPints"
 
Anyway the load cell page shows the correct kegs but wrong values
I wonder if this is caused by the Empty weight of the keg. To do the calculation the empty weight has to be more then the current weight plus if the empty weight is 10 then the keg cannot weigh less than 10

If you hit edit on the keg from the Keg Screen then you should be look at the empty weight of the keg and if its 63 or 70 then we found where the data is coming from

Also you if you run(Where <DATABASENAME> is the name of your RPints database
sudo mysql
use <DATABASENAME>
SELECT * FROM vwKegs;

it will list the kegs and their weights, if you could give me the weight of the kegs then I can try to recreate.

Are the latest changes pushed to git, I'll do a reinstall and see if that helps. Should I clean out something or is it enough to just run the install script and select "Reinstall RPints"
Nothing recently. But yes Reinstall RPints will do a clean install
 
I wonder if this is caused by the Empty weight of the keg. To do the calculation the empty weight has to be more then the current weight plus if the empty weight is 10 then the keg cannot weigh less than 10

If you hit edit on the keg from the Keg Screen then you should be look at the empty weight of the keg and if its 63 or 70 then we found where the data is coming from
Nothing recently. But yes Reinstall RPints will do a clean install
What the heck... Yes Keg 3 had a current weight added of 70. and Keg 2 of 60... but I never added that?
Removed the values but left the "empty weight" at 4.26, saved and when I go back to the load cell it shows current weight as 4.26 ie. empty weight
1614882203402.png


Also you if you run(Where <DATABASENAME> is the name of your RPints database
sudo mysql
use <DATABASENAME>
SELECT * FROM vwKegs;

it will list the kegs and their weights, if you could give me the weight of the kegs then I can try to recreate.


Code:
+----+-------+-----------+---------+-------+--------+--------------+------------+-------+---------------+--------+--------+---------+-----------+--------+-------------+-----------------+-----------+---------------+-------------+-----------------+---------------+-------------------+-----------------+---------------------+-------------+-----------------+------------------+---------------------+---------------------+
| id | label | kegTypeId | make    | model | serial | stampedOwner | stampedLoc | notes | kegStatusCode | weight | beerId | onTapId | tapNumber | active | emptyWeight | emptyWeightUnit | maxVolume | maxVolumeUnit | startAmount | startAmountUnit | currentAmount | currentAmountUnit | fermentationPSI | fermentationPSIUnit | keggingTemp | keggingTempUnit | hasContinuousLid | modifiedDate        | createdDate         |
+----+-------+-----------+---------+-------+--------+--------------+------------+-------+---------------+--------+--------+---------+-----------+--------+-------------+-----------------+-----------+---------------+-------------+-----------------+---------------+-------------------+-----------------+---------------------+-------------+-----------------+------------------+---------------------+---------------------+
|  1 | Nr 1  |         1 | Kegland | NULL  | NULL   | NULL         | NULL       | NULL  | SANITIZED     |   NULL |   NULL |    NULL |      NULL |      1 |      8.1571 | lb              |   18.9271 | ml            |        NULL | ml              |          NULL | ml                |            NULL | psi                 |        5.00 | C               |                0 | 2021-03-04 19:21:42 | 2021-03-01 21:05:59 |
|  2 | Nr 2  |         1 | Kegland | NULL  | NULL   | NULL         | NULL       | NULL  | SERVING       | 4.2600 |      2 |       1 |         1 |      1 |      4.2600 | kg              |   18.9271 | ml            |    18.92706 | ml              |          NULL | ml                |            NULL | psi                 |        5.00 | C               |                0 | 2021-03-04 19:22:43 | 2021-03-01 21:06:17 |
|  3 | Nr 3  |         1 | Kegland | NULL  | NULL   | NULL         | NULL       | NULL  | SERVING       | 4.2600 |      3 |       2 |         2 |      1 |      4.2600 | kg              |   18.9271 | ml            |    18.92706 | ml              |          NULL | ml                |            NULL | psi                 |        5.00 | C               |                0 | 2021-03-04 19:20:45 | 2021-03-01 21:06:37 |
|  4 | Nr 4  |         2 | NULL    | NULL  | NULL   | NULL         | NULL       | NULL  | SERVING       | 1.8500 |      1 |       4 |         4 |      1 |      1.8500 | lb              |    9.4635 | oz            |        NULL | oz              |          NULL | oz                |            NULL | psi                 |       56.00 | F               |                1 | 2021-03-01 21:08:58 | 2021-03-01 21:06:49 |
+----+-------+-----------+---------+-------+--------+--------------+------------+-------+---------------+--------+--------+---------+-----------+--------+-------------+-----------------+-----------+---------------+-------------+-----------------+---------------+-------------------+-----------------+---------------------+-------------+-----------------+------------------+---------------------+---------------------+

Since it's not happening to you I'll do a reinstall and see if that helps!
 
Yes Keg 3 had a current weight added of 70. and Keg 2 of 60... but I never added that?
Those are should be set by the load cells.

Whats confusing me is that the tap screen shows the weight from the load cells but the other screens werent.

Try reinstalling and report back please.
 
Those are should be set by the load cells.

Whats confusing me is that the tap screen shows the weight from the load cells but the other screens werent.

Try reinstalling and report back please.
Ok after a reinstall and adding some of the mods to see if it reports weight this is the result.
Code:
LC-1: Updating 1 Weight=249916.0 kg
LC-2: Updating 2 Weight=40109.0 kg
So the load cells are clearly reporting data back but on the load cell page it doesn't show that
1614885645694.png

This time nothing is showing in the keg list either:
1614885498232.png

And the taps list just shows the empty weight as the current weight
1614885570922.png


Attached the DB and the latest logs
 

Attachments

  • db-raspberrypints-backup-2021-03-04 201149.txt
    1,000.1 KB · Views: 4
  • rpints.txt
    231.5 KB · Views: 6
  • 1614885439407.png
    1614885439407.png
    8.5 KB · Views: 4
Back
Top