Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Responsive map #155

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ Then use map_scale and crop to make it fit.
| vacuum_color | string | '--primary-text-color' | The color to use for the vacuum icon
| map_scale | number | 1 | Scale the map by this value
| icon_scale | number | 1 | Scale the icons (vacuum & dock) by this value
| full_width | boolean | false | Scale the map to fit the whole card
| rotate | number | 0 | Value to rotate the map by (default is in deg, but a value like `2rad` is valid too)
| left_padding | number | 0 | Value that moves the map `number` pixels from left to right
| crop | Object | {top: 0, bottom: 0, left: 0, right: 0} | Crop the map
Expand All @@ -138,6 +139,21 @@ Custom buttons can be added to this card when vacuum_entity is set. Each custom
| icon | string | mdi:radiobox-blank | The icon that will represent the custom button
| text | string | "" | Optional text to display next to the icon

## Development

1. Run Rollup in watch mode

```sh
npm run dev
```

2. Enable **Advanced Mode** in your Home Assistant profile

3. Add the bundle as a Lovelace resource in Home Assistant (**Settings > Dashboards > ⋮ > Resources > + Add Resource**)
```
http://localhost:5000/valetudo-map-card.js
```

## License

Lovelace Valetudo Map Card is licensed under the MIT license.
54 changes: 54 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"lint": "eslint -c .automated.eslintrc.json .",
"lint_fix": "eslint -c .automated.eslintrc.json . --fix",

"build": "rollup -c"
"build": "rollup -c",
"dev": "rollup -c -w"
},
"repository": {
"type": "git",
Expand All @@ -34,6 +35,7 @@
"rollup-plugin-node-resolve": "5.2.0",
"rollup-plugin-terser": "7.0.2",
"rollup-plugin-typescript2": "0.33.0",
"rollup-plugin-serve": "1.1.1",
"typescript": "4.8.2",
"@rollup/plugin-json": "4.1.0",
"babel-plugin-inline-json-import": "0.3.2",
Expand Down
16 changes: 15 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ import nodeResolve from "rollup-plugin-node-resolve";
import babel from "rollup-plugin-babel";
import { terser } from "rollup-plugin-terser";
import json from "@rollup/plugin-json";
import serve from 'rollup-plugin-serve';

const dev = process.env.ROLLUP_WATCH;

/** @type {import("rollup-plugin-serve").ServeOptions} */
const serveOpts = {
contentBase: ['./dist'],
host: '0.0.0.0',
port: 5000,
headers: {
'Access-Control-Allow-Origin': '*'
}
};

const plugins = [
nodeResolve({}),
Expand All @@ -16,7 +29,8 @@ const plugins = [
["inline-json-import", {}]
]
}),
terser(),
dev && serve(serveOpts),
!dev && terser(),
];

export default [
Expand Down
Loading