Skip to content

Commit

Permalink
Update install instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
ajagnanan committed Apr 22, 2023
1 parent a34896c commit 51079e8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
39 changes: 30 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,31 @@ Home Assistant version 0.110.0 or higher is required as of release 1.0.0 of sett

## Installation

Use [HACS](https://hacs.xyz) or follow this [guide](https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins)

```yaml
resources:
url: /local/settings-sync.js
type: module
```
### HACS

Settings Sync is available in [HACS](https://hacs.xyz) (Home Assistant Community Store).

1. Install HACS if you don't have it already
2. Open HACS in Home Assistant
3. Go to "Frontend" section
4. Click 3 dots on top right and custom repository
5. Add `https://github.com/ajagnanan/lovelace-settings-sync` with catagory `Lovelace`
6. Search for "Settings Sync" and install

### Manual

1. Download `settings-sync.js` file from the [`latest release`](https://github.com/ajagnanan/lovelace-settings-sync/releases).
2. Put `settings-sync.js` file into your `config/www` folder.
3. Add reference to `settings-sync.js` in Dashboard. There's two way to do that:
- **Using UI:** _Settings__Dashboards__More Options icon__Resources__Add Resource_ → Set _Url_ as `/local/settings-sync.js` → Set _Resource type_ as `JavaScript Module`.
**Note:** If you do not see the Resources menu, you will need to enable _Advanced Mode_ in your _User Profile_
- **Using YAML:** Add following code to `lovelace` section.

```yaml
resources:
- url: /local/settings-sync.js
type: module
```
## Options
Expand All @@ -44,10 +62,13 @@ resources:

### Sensor

This card requires a REST endpoint which will serve the Settings JSON. A REST Sensor will be needed that will then retrieve these settings into Home Assistant. An example of the [rest sensor](samples/rest_sensor.yaml) and [settings.json](samples/settings.json) are provided. The "Key" is the Username of the Setting.
This card requires a REST endpoint which will serve the Settings JSON. A REST Sensor will be needed that will then retrieve these settings into Home Assistant. An example of the [rest sensor](samples/rest_sensor.yaml) and [settings.json](samples/settings.json) are provided. The `Key` is the `Name` (all lowercase) of the User for whom the Setting is for.

**The REST Sensor is needed because Attributes allow a String lenght greater than 255, which is the limit of the State value.**

CloudFlare Workers offer a way to host the REST endpoint. See [cf_worker.js](samples/cf_worker.js) for a basic example of the worker code.
#### REST API

CloudFlare Workers offer a way to host the REST endpoint. See [cf_worker.js](samples/cf_worker.js) for a basic example of the worker code. **This can be hosted anywhere though, whether on a Cloud or Local service**.

### Card

Expand Down
4 changes: 4 additions & 0 deletions samples/cf_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export default {
'["lovelace","dwains-dashboard","wall-dashboard","a0d7b954_vscode","e4641267_portainer","a0d7b954_ssh","hacs"]',
suspendWhenHidden: 'true',
vibrate: 'true',
},
"user2": {
defaultPanel: "\"lovelace\"",
dockedSidebar: "\"always_hidden\"",
}
};

Expand Down

0 comments on commit 51079e8

Please sign in to comment.