How to connect to the Internet via USB modem from RPi with Hass.io?
As I understand, there is no ready solution. But is it possible in principle and where to look?
I do not know but you would likely find more solutions if you installed hassio on Raspian Lite. Raspian is a full OS with more options.
Wow! You’re taking me back a long way now contemplating if your solution could be the Unix suite called UUCP.
Does this help?
Have considered attaching the modem to a wifi router? That would also give your pi some more isolation/protection from the internet. I believe there are a number of routers that support that option.
I know about this opportunity and I’ll do it if I don’t find a more economical solution.
Thanks to everyone for the advices, after reading the documentation I came to the conclusion that the best solution would be to use ModemManager.
I create a custom addon with RUN apk --no-cache add bash dbus modemmanager
in Dockerfile
. Then I write commands in run.sh
and see results in addon’s log.
>mmcli -L
error: couldn't get bus: Could not connect: No such file or directory
Instead expected like a Linux Mint No modems were found
.
Probably, mmcli
cannot to find the file /var/run/dbus/system_bus_socket
. The file I can see only from root console, but from addon the /var/run/dbus/
is empty. I need somehow inform, by analogy with USB devices, that my addon needs a system d-bus. For example, in balena documentation there is a special setting in docker-compose.yml file.
The research continues.
UPD: adding "host_dbus": "True"
into config.json
give access to D-Bus.
Have you found any solutions?
Unfortunately not.
That’s where I stopped with addon - needs disabled protection mode.
Dockerfile
ARG BUILD_FROM
FROM $BUILD_FROM
ENV LANG C.UTF-8
# For parse options
RUN apk add --no-cache jq
# Install software
RUN apk --no-cache add usb-modeswitch modemmanager udev ppp
WORKDIR /data
COPY run.sh /
RUN chmod a+x /run.sh
CMD [ "/run.sh" ]
config.json
{
"name": "ModemManager",
"version": "1.05",
"slug": "modemmanager",
"description": "ModemManager - connect to the Internet via USB modems",
"arch": ["armhf", "armv7", "aarch64", "amd64", "i386"],
"devices1": ["/dev/bus/usb/001/007:/dev/bus/usb/001/007:rwm"],
"startup": "once",
"boot": "manual",
"host_dbus": "True",
"full_access": "True",
"host_network": "True",
"host_ipc": "True",
"host_pid": "False",
"docker_api": "True",
"kernel_modules": "True",
"options": {},
"schema": {},
"ports": {}
}
run.sh
CONFIG_PATH=/data/options.json
CMD_LINE="$(jq --raw-output '.cmd_line' $CONFIG_PATH)"
echo "Available USB devices before switching:"
echo ">lsusb"
lsusb
echo " "
export LIBUSB_DEBUG=3
echo ">usb_modeswitch -v 0x05c6 -p 0x1000 -KWR -C 0xff -s 12"
usb_modeswitch -v 0x05c6 -p 0x1000 -KWR -C 0xff -s 12
echo "Wait for 12 seconds before re-checking"
sleep 12
echo " "
echo "Available USB devices after switching:"
echo ">lsusb -v"
lsusb -v
echo " "
echo ">modprobe ppp_generic"
modprobe ppp_generic
echo " "
echo ">mmcli -L"
mmcli -L
echo " "
echo "Finished!"
ModemManager
should be started from the console before run the addon, how to run it in the background from run.sh could not find.
It successfully change USB-stick to Modem mode but there is no reaction from OS…
Please let me know if you find something interesting.
hi @ArtHome, did you managed to disabled protecion mode on local addon?
this needs to be disabled to pass devices, right?
I could not achieve success, support for the USB modem was cut at the OS level
Ah ok, my driver was included in HassOs, so I managed at the end