Skip to content

Commit b55ca41

Browse files
committed
Merge branch 'future3/develop' into future3/feature/installation
2 parents 26c5143 + 07208e6 commit b55ca41

File tree

18 files changed

+738
-146
lines changed

18 files changed

+738
-146
lines changed

.github/workflows/bundle_webapp_and_release_v3.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
tar -czvf ${{ steps.vars.outputs.webapp_bundle_name }} build
102102
103103
- name: Artifact Upload
104-
uses: actions/upload-artifact@v3
104+
uses: actions/upload-artifact@v4
105105
with:
106106
name: ${{ steps.vars.outputs.webapp_bundle_name }}
107107
path: ${{ steps.build-webapp.outputs.webapp-root-path }}/${{ steps.vars.outputs.webapp_bundle_name }}
@@ -119,7 +119,7 @@ jobs:
119119

120120
steps:
121121
- name: Artifact Download
122-
uses: actions/download-artifact@v3
122+
uses: actions/download-artifact@v4
123123
with:
124124
name: ${{ needs.build.outputs.webapp_bundle_name }}
125125

.github/workflows/test_docker_debian_codename_sub_v3.yml

+14-14
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ jobs:
134134
BASE_TEST_IMAGE=${{ steps.vars.outputs.image_tag_name_local_base }}
135135
136136
- name: Artifact Upload Docker Image
137-
uses: actions/upload-artifact@v3
137+
uses: actions/upload-artifact@v4
138138
with:
139139
name: ${{ steps.vars.outputs.image_file_name }}
140140
path: ${{ steps.vars.outputs.image_file_path }}
@@ -159,7 +159,7 @@ jobs:
159159
uses: docker/[email protected]
160160

161161
- name: Artifact Download Docker Image
162-
uses: actions/download-artifact@v3
162+
uses: actions/download-artifact@v4
163163
with:
164164
name: ${{ needs.build.outputs.image_file_name }}
165165

@@ -177,15 +177,15 @@ jobs:
177177
args: |
178178
./${{ matrix.test_script }}
179179
180-
# cleanup after test execution
181-
cleanup:
182-
# run only if tests didn't fail: keep the artifact to make job reruns possible
183-
if: ${{ !failure() }}
184-
needs: [build, test]
185-
runs-on: ${{ inputs.runs_on }}
186-
187-
steps:
188-
- name: Artifact Delete Docker Image
189-
uses: geekyeggo/delete-artifact@v2
190-
with:
191-
name: ${{ needs.build.outputs.image_file_name }}
180+
## cleanup after test execution
181+
#cleanup:
182+
# # run only if tests didn't fail: keep the artifact to make job reruns possible
183+
# if: ${{ !failure() }}
184+
# needs: [build, test]
185+
# runs-on: ${{ inputs.runs_on }}
186+
#
187+
# steps:
188+
# - name: Artifact Delete Docker Image
189+
# uses: geekyeggo/delete-artifact@v4
190+
# with:
191+
# name: ${{ needs.build.outputs.image_file_name }}

docker/armv7/jukebox.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ WORKDIR ${HOME}
6565
COPY --chown=${USER}:${USER} . ${INSTALLATION_PATH}/
6666

6767
RUN pip install --no-cache-dir -r ${INSTALLATION_PATH}/requirements.txt
68-
RUN pip install --no-cache-dir --pre --no-binary pyzmq pyzmq
68+
RUN pip install --no-cache-dir --no-binary pyzmq pyzmq
6969

7070
EXPOSE 5555 5556
7171

docker/jukebox.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ RUN [ "$(uname -m)" = "aarch64" ] && ARCH="arm64" || ARCH="$(uname -m)"; \
5050
rm -f libzmq.tar.gz;
5151

5252
RUN export ZMQ_PREFIX=${PREFIX} && export ZMQ_DRAFT_API=1
53-
RUN pip install -v --no-binary pyzmq --pre pyzmq
53+
RUN pip install -v --no-binary pyzmq pyzmq
5454

5555
EXPOSE 5555 5556
5656

documentation/builders/README.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,32 @@
99
## Features
1010

1111
* Audio
12-
* [Audio Output](./audio.md)
13-
* [Bluetooth audio buttons](./bluetooth-audio-buttons.md)
12+
* [Audio Output](./audio.md)
13+
* [Bluetooth audio buttons](./bluetooth-audio-buttons.md)
1414
* [GPIO Recipes](./gpio.md)
1515
* [Card Database](./card-database.md)
16-
* [RFID Cards synchronisation](./components/synchronisation/rfidcards.md)
16+
* [RFID Cards synchronisation](./components/synchronisation/rfidcards.md)
1717
* [Auto Hotspot](./autohotspot.md)
1818
* File Management
19-
* [Network share / Samba](./samba.md)
19+
* [Network share / Samba](./samba.md)
2020

2121
## Hardware Components
2222

2323
* [Power](./components/power/)
24-
* [OnOff SHIM for safe power on/off](./components/power/onoff-shim.md)
24+
* [OnOff SHIM for safe power on/off](./components/power/onoff-shim.md)
25+
* [Battery Monitor based on a ADS1015](./components/power/batterymonitor.md)
2526
* [Soundcards](./components/soundcards/)
26-
* [HiFiBerry Boards](./components/soundcards/hifiberry.md)
27+
* [HiFiBerry Boards](./components/soundcards/hifiberry.md)
2728
* [RFID Readers](./../developers/rfid/README.md)
29+
* [Event devices (USB and other buttons)](./event-devices.md)
2830

2931
## Web Application
3032

3133
* Music
32-
* [Playlists, Livestreams and Podcasts](./webapp/playlists-livestreams-podcasts.md)
34+
* [Playlists, Livestreams and Podcasts](./webapp/playlists-livestreams-podcasts.md)
3335

3436
## Advanced
37+
3538
* [Troubleshooting](./troubleshooting.md)
3639
* [Concepts](./concepts.md)
3740
* [System](./system.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Battery Monitor based on a ADS1015
2+
3+
> [!CAUTION]
4+
> Lithium and other batteries are dangerous and must be treated with care.
5+
> Rechargeable Lithium Ion batteries are potentially hazardous and can
6+
> present a serious **FIRE HAZARD** if damaged, defective or improperly used.
7+
> Do not use this circuit to a lithium ion battery without expertise and
8+
> training in handling and use of batteries of this type.
9+
> Use appropriate test equipment and safety protocols during development.
10+
> There is no warranty, this may not work as expected or at all!
11+
12+
The script in [src/jukebox/components/battery_monitor/batt_mon_i2c_ads1015/\_\_init\_\_.py](../../../../src/jukebox/components/battery_monitor/batt_mon_i2c_ads1015/__init__.py) is intended to read out the voltage of a single Cell LiIon Battery using a [CY-ADS1015 Board](https://www.adafruit.com/product/1083):
13+
14+
```text
15+
3.3V
16+
+
17+
|
18+
.----o----.
19+
___ | | SDA
20+
.--------|___|---o----o---------o AIN0 o------
21+
| 2MΩ | | | | SCL
22+
| .-. | | ADS1015 o------
23+
--- | | --- | |
24+
Battery - 1.5MΩ| | ---100nF '----o----'
25+
2.9V-4.2V| '-' | |
26+
| | | |
27+
=== === === ===
28+
```
29+
30+
> [!WARNING]
31+
>
32+
> * the circuit is constantly draining the battery! (leak current up to: 2.1µA)
33+
> * the time between sample needs to be a minimum 1sec with this high impedance voltage divider don't use the continuous conversion method!
+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Event devices
2+
3+
## Background
4+
Event devices are generic input devices that are exposed in `/dev/input`.
5+
This includes USB peripherals (Keyboards, Controllers, Joysticks or Mouse) as well as potentially bluetooth devices.
6+
7+
A specific usecase for this could be, if a Zero Delay Arcade USB Encoder is used to wire arcade buttons instead of using GPIO pins.
8+
9+
These device interface support various kinds of input events, such as press, movements and potentially also outputs (eg. rumble, led lights, ...). Currently only the usage of button presses as input is supported.
10+
11+
This functionality was previously implemented under the name of [USB buttons](https://github.com/MiczFlor/RPi-Jukebox-RFID/blob/develop/components/controls/buttons_usb_encoder/README.md).
12+
13+
The devices and their button mappings need to be mapped in the configuration file.
14+
15+
## Configuration
16+
17+
To configure event devices, first add the plugin as an entry to the module list of your main configuration file ``shared/settings/jukebox.yaml``:
18+
19+
``` yaml
20+
modules:
21+
named:
22+
event_devices: controls.event_devices
23+
```
24+
25+
And add the following section with the plugin specific configuration:
26+
``` yaml
27+
evdev:
28+
enabled: true
29+
config_file: ../../shared/settings/evdev.yaml
30+
```
31+
32+
The actual configuration itself is stored in a separate file. In this case in ``../../shared/settings/evdev.yaml``.
33+
34+
The configuration is structured akin to the configuration of the [GPIO devices](./gpio.md).
35+
36+
In contrast to `gpio`, multiple devices (eg arcade controllser, keyboards, joysticks, mice, ...) are supported, each with their own `input_devices` (=buttons). `output_devices` or actions other than `on_press` are currently not yet supported.
37+
38+
``` yaml
39+
devices: # list of devices to listen for
40+
{device nickname}: # config for a specific device
41+
device_name: {device_name} # name of the device
42+
exact: False/True # optional to require exact match. Otherwise it is sufficient that a part of the name matches
43+
input_devices: # list of buttons to listen for for this device
44+
{button nickname}:
45+
type: Button
46+
kwargs:
47+
key_code: {key-code}: # evdev event id
48+
actions:
49+
on_press: # Currently only the on_press action is supported
50+
{rpc_command_definition} # eg `alias: toggle`
51+
```
52+
The `{device nickname}` is only for your own orientation and can be choosen freely.
53+
For each device you need to figure out the `{device_name}` and the `{event_id}` corresponding to key strokes, as indicated in the sections below.
54+
55+
### Identifying the `{device_name}`
56+
57+
The `{device_name}` can be identified using the following Python snippet:
58+
59+
``` Python
60+
import evdev
61+
devices = [evdev.InputDevice(path) for path in evdev.list_devices()]
62+
for device in devices:
63+
print(device.path, device.name, device.phys)
64+
```
65+
66+
The output could be in the style of:
67+
68+
```
69+
/dev/input/event1 Dell Dell USB Keyboard usb-0000:00:12.1-2/input0
70+
/dev/input/event0 Dell USB Optical Mouse usb-0000:00:12.0-2/input0
71+
```
72+
73+
In this example, the `{device_name}` could be `DELL USB Optical Mouse`.
74+
Note that if you use the option `exact: False`, it would be sufficient to add a substring such as `USB Keyboard`.
75+
76+
### Identifying the `{key-code}`
77+
78+
The key code for a button press can be determined using the following code snippet:
79+
80+
``` Python
81+
import evdev
82+
device = evdev.InputDevice('/dev/input/event0')
83+
device.capabilities(verbose=True)[('EV_KEY', evdev.ecodes.EV_KEY)]
84+
```
85+
86+
With the `InputDevice` corresponding to the path from the output of the section `{device_name}` (eg. in the example `/dev/input/event0`
87+
would correspond to `Dell Dell USB Keyboard`).
88+
89+
If the naming is not clear, it is also possible to empirically check for the key code by listening for events:
90+
91+
``` Python
92+
from evdev import InputDevice, categorize, ecodes
93+
dev = InputDevice('/dev/input/event1')
94+
print(dev)
95+
for event in dev.read_loop():
96+
if event.type == ecodes.EV_KEY:
97+
print(categorize(event))
98+
```
99+
The output could be of the form:
100+
```
101+
device /dev/input/event1, name "DragonRise Inc. Generic USB Joystick ", phys "usb-3f980000.usb-1.2/input0"
102+
key event at 1672569673.124168, 297 (BTN_BASE4), down
103+
key event at 1672569673.385170, 297 (BTN_BASE4), up
104+
```
105+
106+
In this example output, the `{key-code}` would be `297`
107+
108+
Alternatively, the device could also be setup without a mapping.
109+
Afterwards, when pressing keys, the key codes can be found in the log files. Press various buttons on your device,
110+
while watching the logs with `tail -f shared/logs/app.log`.
111+
Look for entries like `No callback registered for button ...`.
112+
113+
### Specifying the `{rpc_command_definition}`
114+
115+
The RPC command follows the regular RPC command rules as defined in the [following documentation](./rpc-commands.md).
116+
117+
118+
## Full example config
119+
120+
A complete configuration example for a USB Joystick controller can be found in the [examples](../../resources/default-settings/evdev.example.yaml).

documentation/developers/docker.md

+14
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,20 @@ $ docker run -it --rm \
291291
--name jukebox jukebox
292292
```
293293

294+
## Testing EVDEV devices in Linux
295+
To test the [event device capabilities](../builders/event-devices.md) in docker, the device needs to be made available to the container.
296+
297+
### Linux
298+
Mount the device into the container by configuring the appropriate device in a `devices` section of the `jukebox` service in the docker compose file. For example:
299+
300+
```yaml
301+
jukebox:
302+
...
303+
devices:
304+
- /dev/input/event3:/dev/input/event3
305+
```
306+
307+
294308
### Resources
295309

296310
#### Mac

0 commit comments

Comments
 (0)