Skip to content

Commit

Permalink
Make build and change a few inkplate6color references
Browse files Browse the repository at this point in the history
  • Loading branch information
brodykenrick committed Feb 24, 2024
1 parent bb9ceaa commit 50b9884
Show file tree
Hide file tree
Showing 13 changed files with 1,654 additions and 161 deletions.
Binary file added .DS_Store
Binary file not shown.
9 changes: 8 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "git config --global core.autocrlf true"
"postCreateCommand": "git config --global core.autocrlf true",

// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
Expand All @@ -34,4 +34,11 @@

// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"

"features": {
"node": {
"version": "lts",
"nodeGypDependencies": true
}
}
}
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
# Changes

This is fork of https://github.com/marciogranzotto/hass-lovelace-kindle-screensaver (original repository transfered to hassio add-on) merged with https://github.com/itobey/hass-lovelace-screenshotter (becuase it contains changes to inkplate 10). Thanks to both authors for their amazing work!
This is fork to target this screenshotter for rendering to an Inkplate6color

---

# Home Assistant Lovelace dashboard renderer
# Home Assistant Lovelace dashboard renderer for Imkplate6color

![ci](https://github.com/mkocus/hass-lovelace-kindle-screensaver/actions/workflows/publish.yml/badge.svg)
![ci](https://github.com/brodykenrick/hass-lovelace-kindle-screensaver/actions/workflows/publish.yml/badge.svg)

This tool can be used as Home Assistant addon to display a Lovelace view of your Home Assistant instance as an image. So it can be displayed on the eink panel or any screen connected to the network. It regularly takes a screenshot which can be polled.
This tool can be used as Home Assistant addon to display a Lovelace view of your Home Assistant instance as an image. So it can be displayed on the eink panel, like Inkplate6color, or any screen connected to the network. It regularly takes a screenshot which can be polled.

## Sample image

![Sample image](https://raw.githubusercontent.com/mkocus/hass-lovelace-kindle-screensaver/main/assets/sample.png)
![Sample image](https://raw.githubusercontent.com/mbrodykenrickkocus/hass-lovelace-kindle-screensaver/main/assets/sample.png)

## Features

This tool regularly takes a screenshot of a specific page of your home assistant setup. It converts it into the PNG with various options (color or grayscale).
This tool regularly takes a screenshot of a specific page of your home assistant setup. It converts it into the PNG with various options.

## Usage

Go to the Home Assistant options, addons, addon store, then using upper right menu add this as an repository. Then you should be able to install the addon using the install button on this page.
Go to the Home Assistant options, addons, addon store, then using upper right menu add this repository. Then you should be able to install the addon using the install button on this page.

After instaling go to the addon config and (minimally) setup two options:
- ha_base_url - base url of your home assistant instance (http://192.168.0.2:8123 for example)
- ha_access_token - go to your user profile and the bottom you will have an option to generate access token. Paste it there.

You can access the image by doing a simple GET request to e.g. `http://localhost:5000/` to receive the most recent image.
You can access the image by doing a simple GET request to e.g. `http://localhost:5006/` to receive the most recent image.

All options are the same as original addon and are listed below:

| Env Var | Sample value | Required | Array?\* | Description |
| ------------------------- | ------------------------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ha_base_ulr` | `https://your-hass-instance.com:8123` | yes | no | Base URL of your home assistant instance |
| `ha_base_urr` | `https://your-hass-instance.com:8123` | yes | no | Base URL of your home assistant instance |
| `ha_screenshot_url` | `/lovelace?kiosk` | no | yes | Relative URL to take screenshot of (btw, the `?kiosk` parameter hides the nav bar using the [kiosk mode](https://github.com/maykar/kiosk-mode) project) |
| `ha_access_token` | `eyJ0...` | yes | no | Long-lived access token from Home Assistant, see [official docs](https://developers.home-assistant.io/docs/auth_api/#long-lived-access-token) | |
| `language` | `en` | no | no | Language to set in browser and home assistant |
| `cron_job` | `* * * * *` | no | no | How often to take screenshot |
| `rendering_timeout` | `10000` | no | no | Timeout of render process, helpful if your HASS instance might be down |
| `rendering_delay` | `0` | no | yes | how long to wait between navigating to the page and taking the screenshot, in milliseconds |
| `rendering_screen_width` | `800` | no | yes | Height of your kindle screen resolution |
| `rendering_screen_width` | `600` | no | yes | Width of your kindle screen resolution |
| `rendering_screen_width` | `800` | no | yes | Height of your inkplate screen resolution |
| `rendering_screen_width` | `600` | no | yes | Width of your inkplate screen resolution |
| `rotation` | `0` | no | yes | Rotation of image in degrees, e.g. use 90 or 270 to render in landscape |
| `scaling` | `1` | no | yes | Scaling factor, e.g. `1.5` to zoom in or `0.75` to zoom out |
| `grayscale_depth` | `8` | no | yes | Ggrayscale bit depth your kindle supports |
| `grayscale_depth` | `8` | no | yes | Ggrayscale bit depth your inkplate supports |
| `color_mode` | `GrayScale` | no | yes | ColorMode to use, ex: `GrayScale`, or `TrueColor`. |
| `diter` | `false` | no | yes | Apply a dither to the images. |
| `dither` | `false` | no | yes | Apply a dither to the images. |

**\* Array** mode of original addon are **not currently supported**.

Expand Down
Binary file added lovelace-kindle-screensaver/.DS_Store
Binary file not shown.
10 changes: 5 additions & 5 deletions lovelace-kindle-screensaver/config.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "Lovelace dashboard renderer",
"version": "1.1.24",
"version": "1.1.25",
"slug": "lovelace-dashboard-renderer",
"description": "Renders any lovelace dashboard to image and hosts it",
"description": "Renders any lovelace dashboard to an image and hosts it",
"url": "https://github.com/brodykenrick/hass-lovelace-screenshotter/tree/master/lovelace-kindle-screensaver",
"webui": "http://[HOST]:[PORT:5000]",
"webui": "http://[HOST]:[PORT:5006]",
"image": "brodykenrick/addon-lovelace-kindle-screensaver-{arch}",
"startup": "application",
"arch": ["armv7", "aarch64", "amd64"],
Expand All @@ -16,10 +16,10 @@
],
"boot": "auto",
"ports": {
"5000/tcp": 5000
"5006/tcp": 5006
},
"ports_description": {
"5000/tcp": "Webserver that hosts the lovelace screenshot image"
"5006/tcp": "Webserver that hosts the lovelace screenshot image"
},
"privileged": [
"SYS_ADMIN","DAC_READ_SEARCH"
Expand Down
Binary file added lovelace-kindle-screensaver/rootfs/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion lovelace-kindle-screensaver/rootfs/app/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = {
cronJob: process.env.CRON_JOB || "* * * * *",
useImageMagick: process.env.USE_IMAGE_MAGICK === "true",
pages: getPagesConfig(),
port: process.env.PORT || 5000,
port: process.env.PORT || 5006,
renderingTimeout: process.env.RENDERING_TIMEOUT || 10000,
imageFormat: process.env.IMAGE_FORMAT || "png",
language: process.env.LANGUAGE || "en",
Expand Down
3 changes: 2 additions & 1 deletion lovelace-kindle-screensaver/rootfs/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const { CronJob } = require("cron");
const gm = require("gm");

// keep state of current battery level and whether the device is charging
//TODO: remove me
const batteryStore = {};

(async () => {
Expand Down Expand Up @@ -149,7 +150,7 @@ const batteryStore = {};
}
});

const port = config.port || 5000;
const port = config.port || 5006;
httpServer.listen(port, () => {
console.log(`Server is running at ${port}`);
});
Expand Down
Loading

0 comments on commit 50b9884

Please sign in to comment.