Error when not connected via USB intially


#1

Yesterday I upgraded my BrewPi (v2) to the latest software along with setting up a docker install on my RPi3 and everything appeared to go relatively smoothly. The BrewPi was updated to 0.5.4 via DFU mode and was put on the WiFi network.
Today I went to boot everything up and found that the BrewPi docker was not running and attempting to run it thorough the Portainer dashboard resulted in the following error:

…error gathering device information while adding custom device “/dev/ttyACM0”: lstat /dev/ttyACM0: no such file or directory"

My config.cfg file on the Pi reads:

# port = auto
port = socket://192.168.0.72:6666

The strange thing is that if I connect the BrewPi and RPi via USB I am then able to run the container but if I then disconnect the USB cable I am able to communicate with the BrewPi via the RPI’s web interface tools e.g. put it in and out of test mode etc.
You can see form the log below when it was generating errors and then after I connected the USB cable between the devices, any idea of what is going on?
NB I am running the vanilla Raspberry Stretch image which I then updated the docker on.

Mar 08 2018 14:03:38 Notification: Script started for beer 'My First BrewPi Run'
Mar 08 2018 14:03:38 Connecting to controller...
Mar 08 2018 14:03:38 Opening serial port
Mar 08 2018 14:03:49 Errors while opening serial port: 
[Errno 13] could not open port /dev/ttyACM0: [Errno 13] Permission denied: '/dev/ttyACM0'

Mar 08 2018 14:04:20 Notification: Script started for beer 'My First BrewPi Run'
Mar 08 2018 14:04:20 Connecting to controller...
Mar 08 2018 14:04:20 Opening serial port
Mar 08 2018 14:05:20 Errors while opening serial port: 
Could not open port socket://192.168.1.100:6666: timed out

Mar 08 2018 14:18:59 Notification: Script started for beer 'My First BrewPi Run'
Mar 08 2018 14:18:59 Connecting to controller...
Mar 08 2018 14:18:59 Opening serial port
Mar 08 2018 14:18:59 Checking software version on controller... 
Mar 08 2018 14:18:59 Found BrewPi v0.5.4 build 0.5.3-rc.3-19-gb18a0ebdf, running on a Particle Photon with a V2 shield on port socket://192.168.0.72:6666

#2

I see a difference in IP address.
After that last line, found BrewPI… bla bla. Could you not connect? Was the script running?


#3

Out of the three error messages the first one is when I have no USB cable connected, the second is as I am connecting it and the third after it has been connected for a second or two.

I am not sure why on the second bit it is looking for 192.168.1.100:6666 as this is not what I have in my config file (I have 192.168.0.72).
It does then connect and I am able to disconnect the USB cable and control it over WiFi but if I reboot the RPi it means it refuses to connect again and the container gets automatically shut down The only way I can get it to reconnect is to reattach the USB cable between the two devices, restart the container and then after that connection has been established I can pull the cable and control through WiFi. I ONLY see the error containing the 192.168.1.100 IP as I connect the USB cable before it recognises the device. If I do not connect it I just get the Errno 13 message in my log.

EDIT: When it gets connected through the USB cable does it pass through the Photon’s IP address to the RPi? This could account for it then getting the right address, meaning that it is not reading the initial configuration file correctly (I did just edit this in the standard text editor on the RPi so not sure if this has messed it up and it is therefore falling back to the 192.168.1.100 IP).

From the log:

Mar 08 2018 14:18:59   Notification: Script started for beer 'My First BrewPi Run'
 Mar 08 2018 14:18:59   Connecting to controller...
 Mar 08 2018 14:18:59   Opening serial port
 Mar 08 2018 14:18:59   Checking software version on controller... 
 Mar 08 2018 14:18:59   Found BrewPi v0.5.4 build 0.5.3-rc.3-19-gb18a0ebdf, running on a Particle Photon with a V2 shield on port socket://192.168.0.72:6666

 Mar 08 2018 14:19:21   Installed devices received: [{"a": "28ACBE43070000C0", "c": 1, "b": 0, "d": 0, "f": 5, "i": 0, "h": 2, "j": 0.0, "p": 0, "t": 1}, {"a": "28DE183507000038", "c": 1, "b": 1, "d": 0, "f": 9, "i": 1, "h": 2, "j": 0.0, "p": 0, "t": 1}, {"c": 1, "b": 0, "d": 0, "f": 2, "i": 2, "h": 1, "p": 17, "t": 3, "x": 0}, {"c": 1, "b": 0, "d": 0, "f": 3, "i": 3, "h": 1, "p": 16, "t": 3, "x": 0}, {"a": "285D7F5E070000CF", "c": 1, "b": 0, "d": 0, "f": 6, "i": 4, "h": 2, "j": 0.0, "p": 0, "t": 1}]
 Mar 08 2018 14:19:22   Available devices received: [{"c": 1, "b": 0, "d": 0, "f": 0, "i": -1, "h": 1, "p": 11, "t": 0, "x": 0}, {"c": 1, "b": 0, "d": 0, "f": 0, "i": -1, "h": 1, "p": 10, "t": 0, "x": 0}]
 Mar 08 2018 14:22:26   Controller debug message: INFO MESSAGE 12: Received new setting: mode = t
 Mar 08 2018 14:22:34   Controller debug message: INFO MESSAGE 12: Received new setting: mode = b
 Mar 08 2018 14:31:48   Notification: Script started for beer 'My First BrewPi Run'
 Mar 08 2018 14:31:48   Connecting to controller...
 Mar 08 2018 14:31:48   Opening serial port
 Mar 08 2018 14:31:48   Checking software version on controller... 
 Mar 08 2018 14:31:48   Found BrewPi v0.5.4 build 0.5.3-rc.3-19-gb18a0ebdf, running on a Particle Photon with a V2 shield on port socket://192.168.0.72:6666

#4

There is no default IP address. So I don’t get why that is happening.

But, if you choose to forward /dev/ttyACM0 to the docker container, it will not start if that device is unavailable.

When you plan to run on WiFi, you should not include --device=/dev/ttyACM0:/dev/ttyACM0.


#5

Okay issue resolved. The problem was that I had initially setup the BrewPi docker container to connect via USB before flashing the latest firmware and then changing the config file to point to the BrewPi’s IP address. Unfortunately, as you mention Elco, this does not remove the initial forwarding so I had to destroy the container and pull down a new one without the “–device=/dev/ttyACM0:/dev/ttyACM0” command being present.
It might be worth putting a note on the wiki around this as I can imagine others running into this either from moving from older software versions or those who are waiting to move to WiFi when all the issues are fixed.
Thanks for your help.