Skip to content

Commit

Permalink
fix: speed up heatmap generation
Browse files Browse the repository at this point in the history
This re-introduces the native cairo image dependencies for performance
reasons. Will be especially visibile on low-powered hardware such as Pi
Zero Ws. More info at #721.
  • Loading branch information
mKeRix committed May 24, 2021
1 parent 91b7cc1 commit 0da4ff6
Show file tree
Hide file tree
Showing 18 changed files with 529 additions and 323 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM node:14-alpine as build
ARG ROOM_ASSISTANT_VERSION=latest

RUN apk add --no-cache python make g++ libusb-dev eudev-dev avahi-dev
RUN apk add --no-cache python make g++ libusb-dev eudev-dev avahi-dev cairo-dev jpeg-dev pango-dev giflib-dev
RUN npm install -g --unsafe-perm room-assistant@$ROOM_ASSISTANT_VERSION

FROM node:14-alpine
Expand Down
2 changes: 1 addition & 1 deletion dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM node:14-alpine as build
WORKDIR /room-assistant

RUN apk add --no-cache python make g++ libusb-dev eudev-dev avahi-dev
RUN apk add --no-cache python make g++ libusb-dev eudev-dev avahi-dev cairo-dev jpeg-dev pango-dev giflib-dev
COPY ./*.tgz /room-assistant/
RUN npm install -g --unsafe-perm *.tgz

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/quickstart-pi-zero-w.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ This page will guide you through setting up a Pi Zero W to run room-assistant.

2. To make the commands we install with npm available the $PATH environment variable needs to be extended as well. Edit the file `~/.profile` (e.g. with `nano ~/.profile`) and add the `PATH="$PATH:/opt/nodejs/bin"` to the end of the file. Save, then run `source ~/.profile`.

3. We need to install some other dependencies as well, do so by running `sudo apt-get update && sudo apt-get install build-essential libavahi-compat-libdnssd-dev bluetooth libbluetooth-dev libudev-dev`.
3. We need to install some other dependencies as well, do so by running `sudo apt-get update && sudo apt-get install build-essential libavahi-compat-libdnssd-dev bluetooth libbluetooth-dev libudev-dev libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev`.

4. Now let's get install room-assistant! Run `sudo npm i --global --unsafe-perm room-assistant`. You will see messages like the one shown below during the installation process. Don't worry about them - they're not errors!
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/quickstart-pi.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This page will guide you through setting up a Raspberry Pi 3 or 4 to run room-as
sudo apt-get install -y nodejs
```

2. We need to install some other dependencies as well, do so by running `sudo apt-get update && sudo apt-get install build-essential libavahi-compat-libdnssd-dev bluetooth libbluetooth-dev libudev-dev`.
2. We need to install some other dependencies as well, do so by running `sudo apt-get update && sudo apt-get install build-essential libavahi-compat-libdnssd-dev bluetooth libbluetooth-dev libudev-dev libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev`.

3. Now let's get install room-assistant! Run `sudo npm i --global --unsafe-perm room-assistant`. You will see messages like the one shown below during the installation process. Don't worry about them - they're not errors!
Expand Down
9 changes: 8 additions & 1 deletion docs/integrations/grid-eye.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ The sensor needs to be connected to the I<sup>2</sup>C pins on your machine.

### Running with NodeJS

For Raspberry Pi devices the I<sup>2</sup>C interface needs to be enabled using `sudo raspi-config` and then enabling the I<sup>2</sup>C option under Advanced Options.
To enable heatmap generation you may be required to install some [additional system packages](https://github.com/Automattic/node-canvas#compiling) for compilation:

```shell
sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
sudo npm i --global --unsafe-perm room-assistant
```

For Raspberry Pi devices the I<sup>2</sup>C interface also needs to be enabled using `sudo raspi-config` and then enabling the I<sup>2</sup>C option under Advanced Options.

### Running with Docker

Expand Down
9 changes: 8 additions & 1 deletion docs/integrations/omron-d6t.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ This integration only supports the D6T-44L-06 sensor at the moment. You will nee

### Running with NodeJS

On Raspberry Pi devices the I<sup>2</sup>C interface needs to be enabled using `sudo raspi-config` and then enabling the I<sup>2</sup>C option under Advanced Options.
To enable heatmap generation you may be required to install some [additional system packages](https://github.com/Automattic/node-canvas#compiling) for compilation:

```shell
sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
sudo npm i --global --unsafe-perm room-assistant
```

On Raspberry Pi devices the I<sup>2</sup>C interface also needs to be enabled using `sudo raspi-config` and then enabling the I<sup>2</sup>C option under Advanced Options.

### Running with Docker

Expand Down
3 changes: 1 addition & 2 deletions nest-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"plugins": ["@nestjs/swagger/plugin"],
"assets": ["**/*.ttf"]
"plugins": ["@nestjs/swagger/plugin"]
}
}
Loading

0 comments on commit 0da4ff6

Please sign in to comment.