BrewBlox Tilt Service

Making the precision in legend configurable is on the backlog, but for now you’ll need the Metrics widget for that.

Awesome! Thanks. : D

@Elco,

A 4.8 minute load time for 2mb javascript files is very strange. That sounds like a pi that is not responsive (100% cpu) or a network issue.

The tilt thread may not be the best for this but I’ve experienced this on my rpi as well. I know there’s a lot of context out in the development wiki around what technologies were chosen and why, but I have had situations where I needed to reboot the rpi because of network responsiveness issues. In my case, I’m running the BCM2835 A02082 model (whatever that is, its been a while since I purchased this thing) 4-core 1GB RAM device. I know memory swapping in linux can be a bit of a can of worms, but it looks like influx is going a little crazy?

Docker stats shows:

Just wanted to throw that out there since slow load times of the web ui, as in 1-2 minutes, has been a problem I’ve seen probably around 50% of the time. That being said, the old farmhouse I live in does pose challenges for wifi networking in general.

Memory usage is pretty much as expected. We already tweaked Influx settings to be memory-efficient, but in the end it’s still a database built around the expectation of it running on a server with plenty of RAM, handling millions of data points per second.

The Raspberry Pi revision table suggests that yours is a Pi 3B.

1-2 minute load times are not normal. Depending on your computer/phone, the UI should load in 2-10 seconds.
Bad wifi connectivity could explain it, but we may as well look into it.

Could you please open the dev tools on your browser (ctrl+shift+i), navigate to the network tab, reload the page, and export the network requests as HAR? (right click on the page to get the option)

Sure enough when I followed your instructions to get a HAR file it all worked within a handful of seconds. Next time I see a repeatable performance issue with it I’ll be sure to grab that for informational purposes.

Just re-installed brewblox and tilt integration from scratch.
Is this error message in the traefik logs normal and something I can ignore?

**pi@rpi2**:**~/brewblox $** brewblox-ctl -v follow traefik
SHELL docker-compose logs --follow traefik
Attaching to brewblox_traefik_1
traefik_1 | time="2021-02-24T17:42:00Z" level=info msg="Configuration loaded from flags."
traefik_1 | time="2021-02-24T17:42:06Z" level=error msg="service \"tilt-brewblox\" error: port is missing" container=tilt-brewblox-fa02a7f8d9694db1ea475ae5d71c989cc18b44216b9c6f098119a35e7c10ef01 providerName=docker

The Tilt service has no REST API, and you can indeed ignore this error.

SYN/ACK
Mucho gracias.

Hi, I have a stupid question.
Where do I place the calibration files?
I can 't do it right.

In ~/brewblox/tilt/. Then restart the service to load the files.

1 Like

After getting the Tilt Service loaded and functioning, I’m having problems with calibration. I calibrated my Tilt to a floating glass hydrometer, and updated the SGCal.csv. That file looks like this:

image

As you can see, my Tilt is accurate at low gravity, and loses accuracy by up to 11 points as gravity increases. No big deal, that’s what calibration is for! However, when I reload the Tilt service, my Calibrated SG value in the UI is saying 1.004 when the Tilt is floating in a glass of water. Something doesn’t seem to be correct in the logic of reporting calibrated values. I dug through the python code to see if I could learn how calibration is performed, and found the cubic polynomial interpolation. I wrote a small python script to calculate my calibration coefficients and predict SG values based on a user-supplied raw value. This logic works and is not the issue. I get correct calibrated values out of this little model, which do not match what my Tilt service is reporting in the UI. That is far as I could get, since I understand numpy much better than how values are reported to the UI. Anyhow, here is the little model I made to test my calibration:

import numpy as np

# x = uncalibrated value, y = calibrated value 
x = np.array([1.00, 1.002, 1.007, 1.009, 1.017, 1.024, 1.027, 1.038, 1.044, 1.050, 1.056, 1.065, 1.076, 1.090])
y = np.array([1.00, 1.002, 1.011, 1.012, 1.022, 1.030, 1.034, 1.047, 1.055, 1.061, 1.067, 1.076, 1.087, 1.101])

# the cubic polynomial function:
z = np.polyfit(x,y,3)

while True:
    value = input("enter an uncalibrated SG value: ")
    if value == '':
        break
    # The calibrated value based on the raw value entered by the user:
    cal = round(np.poly1d(z)(float(value)), 3)
    print(f'Calibrated Value = {cal}')

I also did something similar in R:

range <- seq(from=0.99, to=1.110, by=0.001)

x <- c(1.00, 1.002, 1.007, 1.009, 1.017, 1.024, 1.027, 1.038, 1.044, 1.050, 1.056, 1.065, 1.076, 1.090)
y <- c(1.00, 1.002, 1.011, 1.012, 1.022, 1.030, 1.034, 1.047, 1.055, 1.061, 1.067, 1.076, 1.087, 1.101)

plot(range, range, type = 'n',xlab = "Uncalibrated", ylab = "Calibrated")
points(x, y)

model <- lm(y ~ poly(x, 3))
p <- predict(model, data.frame(x=range))

lines(range,p, col='red')

R output:

Could you please post the logs for the tilt service?
If convenient, we could also move the discussion to discord, as it is likely to involve quite some back and forth.

yes, discord is probably more appropriate.

EDIT: for anyone following along at home, I had a stupid misplaced comma in my csv :see_no_evil:

I just updated to the latest BrewBlox. I added the new Title names to my graph. However, the new SG tilt, is graphing as a straight line. The old is still on the graph, and the slight changes in SG are showing. The new, as I mouse along the graph, show the value a a tooltip, and it changes, but the graph line itself is straight. As you can see, the red line is the new Tilt SG, and the 2 tool tips 1.035 and 1.032 are a straight line.



Over the past few days I’ve been trying to integrate a few Tilts into my BrewPi system without much luck. For reference, I’ve attached a drawing to illustrate how my system is setup.

In short, Brewblox is hosted from a TrueNAS VM while the Tilts connect to an RPI. What I would like to do is view the Tilt data trends on my Brewblox dashboard. I have no issues connecting to the RPI web server to view their information so I know this is setup correctly. Just not too sure how to setup the messaging between the RPI and Brewblox.

So far:

  • Brewblox version is: 2021-11-29T16:59:47.708Z
  • Both the VM and RPI are up-to-date (apt-get update apt-get upgrade).
  • RPI has python, docker and docker-compose installed; no errors when running docker-compose up -d

Here is my docker-compose.yml file from the RPI:

version: ‘3.7’
services:
tilt:
image: brewblox/brewblox-tilt:${BREWBLOX_RELEASE:-edge}
restart: unless-stopped
privileged: true
network_mode: host
volumes: [’./tilt:/share’]
command: --mqtt-host=10.10.10.60

With this I have tried several variations of the --mqtt-port=<port> command. (used 80, 443, 1883). Not sure what to use here or if even need to specify a port? When I connect to my Brewblox dashboard I can use either http://10.10.10.60 or https://10.10.10.60 and both work.

Here is my docker-compose.yml from Brewblox:

services:
spark-left:
command: --name=spark-left --discovery=all --device-id=3C004D000851353532343835
image: brewblox/brewblox-devcon-spark:${BREWBLOX_RELEASE}
privileged: true
restart: unless-stopped
spark-right:
command: --name=spark-right --discovery=all --device-id=20002C001947383434353030
image: brewblox/brewblox-devcon-spark:${BREWBLOX_RELEASE}
privileged: true
restart: unless-stopped
tilt:
image: brewblox/brewblox-tilt:${BREWBLOX_RELEASE}
restart: unless-stopped
privileged: true
network_mode: host
volumes:
- type: bind
source: ./tilt
target: /share
labels:
- traefik.enable=false
version: ‘3.7’

Any thoughts on what I should do next?

Simple things first:

  • If you’re using the tilt service on a separate Pi, you don’t also need it on your brewblox install.
  • to paste code on the forum, you can put it between triple backticks. This preserves whitespace.
    ```
    (Code block)
    ```
  • by default, the tilt service uses websockets on port 443. You can change this to mqtt with command line flags (it will use 1883 by default)

I pushed a bugfix for the tilt service a few days ago. If you pull the service on your Pi, is it up to date?

What is the output from docker-compose logs tilt?

In another topic I posted instructions for checking host bluetooth settings: Brewblox release 2021/11/29 - #6 by Bob_Steers

  • I’ve removed the tilt service from the brewblox install and now the only service is on pi.
  • ran docker-compose pull tilt and it was up-to-date. “Pulling tilt … done”. Ran docker-compose up -d again just in case.
  • output from docker-compose logs tilt is rather short.
pi@tiltpi:~/tilt $ docker-compose logs -f -t tilt
Attaching to tilt_tilt_1
tilt_tilt_1 exited with code 139
  • from my understanding i am not having issues between the tilts and pi, i’m just not able to see the services on brewblox. in reviewing the topic you posted, the only real difference i noticed was that my HCI version was 4.1.
  • tried adding different ports again to docker-compose.yml example: command: --mqtt-host=10.10.10.60 --mqtt-port=1883 (used 443 also) then restarted everything. still no luck.

Your service appears to immediately exit with a segfault (the exit 139).
You can check service status with docker-compose ps.

I assume you’ve restarted your Pi after updating?
What is the output from docker version?
Does your Pi have enough disk space left?

If you run docker hello world, does that work?

docker run --rm hello-world

You can remove and redownload the image to fix any data corruption with:

docker-compose down
docker image rm brewblox/brewblox-tilt:edge
docker-compose up -d
pi@tiltpi:~ $ docker version
Client: Docker Engine - Community
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.16.12
 Git commit:        e91ed57
 Built:             Mon Dec 13 11:45:14 2021
 OS/Arch:           linux/arm
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.12
  Git commit:       459d0df
  Built:            Mon Dec 13 11:43:32 2021
  OS/Arch:          linux/arm
  Experimental:     false
 containerd:
  Version:          1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Hello world works and I’m only using 19% of a 16GB card.

pi@tiltpi:~/tilt $ docker-compose ps
   Name                  Command               State   Ports
------------------------------------------------------------
tilt_tilt_1   python3 -m brewblox_tilt - ...   Up           

I ran this command a few times… Sometimes State is Up, sometimes State is Restarting…

Logs still show a segfault after redownloading the image?