-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ For installation you need: | |
|
||
# How it Works | ||
|
||
## PM2 | ||
PM2 monitoring (Start -> Mic -> Detector -> Google Home Assist -> Audio -> Terminate) | ||
|
||
1. PM2 started the app | ||
|
@@ -23,6 +24,17 @@ PM2 monitoring (Start -> Mic -> Detector -> Google Home Assist -> Audio -> Termi | |
|
||
I don't know the efficient way to run this app. | ||
|
||
## systemd | ||
The logic with systemd is same as `pm2`. You can see on `gassist.service` file | ||
|
||
```ini | ||
StartLimitIntervalSec=1m | ||
StartLimitBurst=100 | ||
Restart=always | ||
RestartSec=1 | ||
``` | ||
I use `gassist.service` run on user instance because of when the armbian rebooted, `pm2` run before `pulseaudio` run, so it will got error `Connection refused` | ||
|
||
# How to Install | ||
## Understanding the Documentation | ||
This documentation is based on FreeBSD documentation (only documentation, not the apps). Shell user-prompt use `$` in codeblock and root-prompt use `#` in codeblock avoiding user confusion who directly use root account, using sudo instead of doas or vice versa. | ||
|
@@ -41,7 +53,7 @@ $ sudo nano or doas nano | |
## Configuration | ||
Add all of your configuration on .env file | ||
|
||
```console | ||
```ini | ||
DEVICE_ID=YOUR_DEVICE_ID // Obtained from GCP | ||
DEVICE_MODEL_ID=YOUR_DEVICE_MODEL_ID // Obtained from GCP | ||
LATITUDE=YOUR_LATITUDE // | ||
|
@@ -61,7 +73,15 @@ You can see is the card number is 1 and device is 0 so your plughw is `plughw:1, | |
|
||
## Installation | ||
|
||
### Audio backend | ||
Clone this repo | ||
```console | ||
$ git clone https://github.com/icaksh/armbian-gassist $HOME/.config/gassist | ||
``` | ||
|
||
Chdir to repo dir | ||
```console | ||
$ cd $HOME/.config/gassist | ||
``` | ||
|
||
Install audio dependencies | ||
```console | ||
|
@@ -78,20 +98,46 @@ Install `speaker-arm64` with your audio backend (example pulseaudio) | |
$ npm install speaker-arm64 --mpg123-backend=pulse/alsa | ||
``` | ||
|
||
### Gassist Armbian | ||
Install all dependencies | ||
|
||
```console | ||
$ npm install | ||
``` | ||
## Running Gassist | ||
### systemd | ||
|
||
Move the `gassist.service` file | ||
```console | ||
$ mv gassist.service $HOME/.config/systemd/user/gassist.service | ||
``` | ||
|
||
Enable the `gassist.service` | ||
```console | ||
$ systemctl --user daemon-reload | ||
$ systemctl --user enable gassist.service | ||
$ systemctl --user start gassist.service | ||
``` | ||
|
||
Check if `gassist.service` is running | ||
```console | ||
$ systemctl --user status gassist.service | ||
● gassist.service - Google Home Assistant | ||
Loaded: loaded (/home/icaksh/.config/systemd/user/gassist.service; enabled; vendor preset: enabled) | ||
Active: active (running) since Mon 2023-03-20 03:01:11 UTC; 16min ago | ||
Main PID: 10637 (node) | ||
CGroup: /user.slice/user-1000.slice/[email protected]/gassist.service | ||
├─10637 /usr/bin/node /home/icaksh/.config/gassist/index.js | ||
└─10645 arecord -q -r 16000 -c 1 -t wav -f S16_LE - | ||
``` | ||
### PM2 | ||
|
||
|
||
Install `pm2` | ||
|
||
```console | ||
# npm install -g pm2 | ||
``` | ||
|
||
## Run | ||
Run with `pm2` | ||
```js | ||
$ pm2 start index.js | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[Unit] | ||
Description=Google Home Assistant | ||
After=pulseaudio.socket | ||
|
||
[Service] | ||
Type=simple | ||
WorkingDirectory=%h/.config/gassist | ||
ExecStart=/usr/bin/node %h/.config/gassist/index.js | ||
StartLimitIntervalSec=1m | ||
StartLimitBurst=100 | ||
Restart=always | ||
RestartSec=1 | ||
|
||
[Install] | ||
WantedBy=default.target |