Skip to content

Commit

Permalink
Merge branch 'master' of github.com:iobroker/iobroker.lovelace
Browse files Browse the repository at this point in the history
  • Loading branch information
Garfonso committed Mar 5, 2024
2 parents 0c55f05 + 0356dc9 commit d9304ed
Show file tree
Hide file tree
Showing 7 changed files with 333 additions and 356 deletions.
17 changes: 5 additions & 12 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,14 @@ jobs:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 18.x

- name: Install Dependencies
run: npm i
Expand Down Expand Up @@ -89,18 +85,15 @@ jobs:
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 18.x

- name: Extract the version and commit body from the tag
id: extract_release
Expand Down Expand Up @@ -129,6 +122,6 @@ jobs:
tag_name: ${{ github.ref }}
release_name: Release v${{ steps.extract_release.outputs.VERSION }}
draft: false
# Prerelease versions create prereleases on Github
# Prerelease versions create pre-releases on GitHub
prerelease: ${{ contains(steps.extract_release.outputs.VERSION, '-') }}
body: ${{ steps.extract_release.outputs.BODY }}
70 changes: 35 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

## lovelace adapter for ioBroker

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI.
With this adapter, you can build visualization for ioBroker with Home Assistant Lovelace UI.

[Deutsche Dokumentation](docs/de/README.md)

## Instance objects
In the folder instances there are some objects that can be used to control the UI. For every browser a new subfolder will
be created with a random ID. This ID is stored in the client browser's web storage. If you delete the web storage a new
In the folder instances, there are some objects that can be used to control the UI. For every browser, a new subfolder will
be created with a random ID. This ID is stored in the client browser's web storage. If you delete the web storage, a new
instance will be created. If you use Fully Kiosk Browser make sure the function `Delete webstorage on reload` is **disabled**.

This functionality uses browser_mod, which is installed and updated by the adapter. Do not add your own version of browser_mod as custom card.
This functionality uses browser_mod, which is installed and updated by the adapter. Do not add your own version of browser_mod as a custom card.

## Configuration
There are two ways how the entities could be configured:
Expand All @@ -35,7 +35,7 @@ In auto mode the similar process will be applied like for `google home` or `mate
You can define friendly names and this will be used in entities.

### Manual
The objects can be defined manually in object tree like sql or histroy. The type of entity must be provided and optionally the name of object.
The objects can be defined manually in an object tree like sql or histroy. The type of entity must be provided and optionally the name of object.
With this method only simple entities, like input_number, input_text or input_boolean could be created. It may not have more than one state or attribute.

## Panels
Expand Down Expand Up @@ -96,8 +96,8 @@ common: {
```

### Select input
This can be done manually if input_select entity type in custom dialog is selected.
The list of options to select from should be provide in standard commom.states object:
This can be done manually if `input_select` entity type in custom dialog is selected.
The list of options to select from should be provided in a standard `common.states` object:

```
"common": {
Expand All @@ -115,10 +115,10 @@ The list of options to select from should be provide in standard commom.states o
}
}
```
in other words in should also be input select in IoB.
in other words, there should also be select input in IoB.

### Timer
Timer could be simulated by following script:
Timer could be simulated by the following script:

```
createState(
Expand Down Expand Up @@ -202,11 +202,11 @@ createState(
```

### Weather
Tested with yr and daswetter. One or more of following objects must have `Function=Weather` and `Room=Any` set to be available in configuration:
- daswetter.0.NextDays.Location_1
- yr.0.forecast
Tested with `yr` and `daswetter`. One or more of the following objects must have `Function=Weather` and `Room=Any` set to be available in configuration:
- `daswetter.0.NextDays.Location_1`
- `yr.0.forecast`

Tested with AccuWeather driver v1.1.0 https://github.com/iobroker-community-adapters/ioBroker.accuweather.
Tested with `AccuWeather` driver v1.1.0 https://github.com/iobroker-community-adapters/ioBroker.accuweather.
Custom Lovelace card created in support of accuweather forecast - https://github.com/algar42/IoB.lovelace.accuweather-card

### Shopping list
Expand Down Expand Up @@ -235,7 +235,7 @@ createState('location', '39.5681295;2.6432632', false, {
});
```

or this two objects:
or these two objects:

```
createState('location.longitude', 2.6432632, false, {
Expand All @@ -257,7 +257,7 @@ createState('location.latitude', 39.5681295, false, {
```

### Picture entity
You can use static picture for it or use any state that delivers URL as state.
You can use static picture for it or use any state that delivers URL as a state.
E.g.:

```
Expand All @@ -275,45 +275,45 @@ E.g.:
}
```

or just set manually the entity type to `camera` and write URL into it.
or just manually set the entity type to `camera` and write URL into it.

### Markdown
You can use bindings in markdown like in [iobroker.vis](https://github.com/ioBroker/ioBroker.vis#bindings-of-objects).

E.g. Text `Admin adapter is {a:system.adapter.admin.0.alive;a === true || a === 'true' ? ' ' : 'not '} *alive*.` will produce text `Admin adapter is alive` in markdown panel.
E.g., Text `Admin adapter is {a:system.adapter.admin.0.alive;a === true || a === 'true' ? ' ' : 'not '} *alive*.` will produce text `Admin adapter is alive` in a markdown panel.

## Custom cards
### Upload of custom cards
To upload the custom card write following:
To upload the custom card, write the following:

```iobroker file write PATH_TO_FILE\bignumber-card.js /lovelace.0/cards/```

After restart of lovelace adapter it will include all files from the `cards` directory automatically.

Following custom cards could be tested successfully:
- bignumber-card: https://github.com/custom-cards/bignumber-card/blob/master/bignumber-card.js
- simple-thermostat: https://github.com/nervetattoo/simple-thermostat/releases (take the latest release)
- thermostat: https://github.com/ciotlosm/custom-lovelace/tree/master/thermostat-card (both files .js and .lib.js are required)
The following custom cards could be tested successfully:
- `bignumber-card`: https://github.com/custom-cards/bignumber-card/blob/master/bignumber-card.js
- `simple-thermostat`: https://github.com/nervetattoo/simple-thermostat/releases (take the latest release)
- `thermostat`: https://github.com/ciotlosm/custom-lovelace/tree/master/thermostat-card (both files .js and .lib.js are required)

I found this link https://github.com/jimz011/homeassistant as an interesting resource for custom cards.

Often the custom cards are stored on github as sources and must be compiled before use.
You should check the `Releases` menu on github and try to find compiled files there.
Often the custom cards are stored on GitHub as sources and must be compiled before use.
You should check the `Releases` menu on GitHub and try to find compiled files there.
Like this one: [https://github.com/kalkih/mini-graph-card/releases](https://github.com/kalkih/mini-graph-card/releases) (Look for the file `mini-graph-card-bundle.js`)

## Own images
The custom images (e.g. for background) could be loaded via the same configuration dialog like the custom cards. And use it like this:
The custom images (e.g., for a background) could be loaded via the same configuration dialog like the custom cards. And use it like this:

`background: center / cover no-repeat url("/cards/background.jpg") fixed`

or

`background: center / cover no-repeat url("/local/custom_ui/background.jpg") fixed`

in lovelace configuration file. Read more about background in lovelace [here](https://www.home-assistant.io/lovelace/views/#background).
in lovelace configuration file. Read more about the background in lovelace [here](https://www.home-assistant.io/lovelace/views/#background).

## Themes
The themes can be defined in configuration dialog of ioBroker.
The themes can be defined in the configuration dialog of ioBroker.
Paste something like:
```
midnight:
Expand Down Expand Up @@ -386,7 +386,7 @@ midnight:
taken from [here](https://community.home-assistant.io/t/midnight-theme/28598/2).

## Icons
Use icons in form `mdi:NAME`, like 'mdi:play-network'. Names can be taken from here: https://materialdesignicons.com/
Use icons in form `mdi:NAME`, like `mdi:play-network`. Names can be taken from here: https://materialdesignicons.com/

## Notifications
You can add notifications via `sendTo` functionality or by writing the state into `lovelace.X.notifications.add`:
Expand Down Expand Up @@ -419,22 +419,22 @@ on({id: 'lovelace.0.conversation', ack: false, change: 'any'}, obj => {

## Trouble Shooting
If you messed up the YAML Code and see a blank page but still have the top menu, you can enable edit mode (if not already enabled) from the menu and then open the menu again to access the "RAW Yaml Editor" in which you see the complete YAML code and can clean it up.
If that does not help, you can open the object lovelace.*.configuration in raw-editor in ioBroker and have a look there.
If that does not help, you can open the object `lovelace.*.configuration` in raw-editor in ioBroker and have a look there.
You can also restore that object from a backup. It contains the complete configuration of your visualization.

## Original sources for lovelace
Used sources are here https://github.com/GermanBluefox/home-assistant-polymer .

## Todo
Security must be taken from current user and not from default_user
Security must be taken from the current user and not from default_user

## Development
### Version
Used version of [email protected]
Version of Browser Mod: 2.3.0

### How to build the new Lovelace version
First of all the actual https://github.com/home-assistant/frontend (dev branch) must be **manually** merged into https://github.com/GermanBluefox/home-assistant-polymer.git (***iob*** branch!).
First of all, the actual https://github.com/home-assistant/frontend (dev branch) must be **manually** merged into https://github.com/GermanBluefox/home-assistant-polymer.git (***iob*** branch!).

All changes for ioBroker are marked with comment `// IoB`.
For now (20231208.2) following files were modified:
Expand All @@ -443,14 +443,14 @@ For now (20231208.2) following files were modified:
- `src/data/weather.ts` - add support to display weather icon from url.
- `src/dialogs/more-info/const.ts` - remove weather state & history
- `src/dialogs/more-info/ha-more-info-dialog.ts` - remove entity settings button and tab
- `src/dialogs/more-info/ha-more-info-history.ts` - remove 'show more' link in history
- `src/dialogs/more-info/ha-more-info-history.ts` - remove `show more` link in history
- `src/dialogs/more-info/controls/more-info-weather.ts` - add support to display weather icon from url.
- `src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts` - disable configuration of voice assistants
- `src/entrypoints/core.ts` - modified authentication process
- `src/panels/lovelace/cards/hui-weather-forecast-card.ts` - add support to display weather icon from url.
- `src/panels/lovelace/entity-rows/hui-weather-entity-row.ts` - add support to display weather icon from url with auth.
- `src/panels/lovelace/hui-root.ts` - added notifications and voice control
- `src/util/documentation-url.ts` - for link to iobroker help instead of homeassistant.
- `src/util/documentation-url.ts` - for link to iobroker help instead of home assistant.
- `.gitignore` - add `.idea` ignore
- `.husky/pre-commit` - remove git commit hooks.
- `package.json` - remove husky commit hook
Expand All @@ -465,12 +465,12 @@ After that checkout modified version in `./build` folder. Then.
6. `gulp build-app` for release or `gulp develop-iob` for the debugging version. To build web after changes you can call `webpack-dev-app` for faster build, but you need to call `build-app` anyway after the version is ready for use.
7. copy all files from `./build/home-assistant-polymer/hass_frontend` into `./hass_frontend` in this repo
8. Run `gulp rename` task multiple times (until no changes happen).
9. Update Version in Readme and also in server.js VERSION constant.
9. Update version in `README.md` and also in `server.js` the `VERSION` constant.

## Changelog

<!--
PLACEHOLDER for next version:
PLACEHOLDER for the next version:
### **WORK IN PROGRESS**
-->
### **WORK IN PROGRESS**
Expand Down
Loading

0 comments on commit d9304ed

Please sign in to comment.