Skip to content

ajagnanan/lovelace-settings-sync

Repository files navigation

Home Assistant Settings Sync

A Custom Card that provides Browser Setting Sync for Home Assistant Users.

GitHub Release License hacs_badge

Project Maintenance GitHub Activity

Minimum Home Assistant Version

Home Assistant version 0.110.0 or higher is required as of release 1.0.0 of settings-sync

Installation

HACS

Settings Sync is available in HACS (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.
  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: SettingsDashboardsMore Options iconResourcesAdd 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.

      resources:
          - url: /local/settings-sync.js
            type: module

Options

Name Type Requirement Description
type string Required custom:settings-sync
enabled boolean Required Enable card
sensor sensor Required The Sensor that holds the User Settings JSON retrieved by the REST API
render_ui boolean Required If the UI should be rendered
username string Optional Optional Username or default is the Logged In User (this matches up with the JSON)

Configuration

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 and 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.

REST API

CloudFlare Workers offer a way to host the REST endpoint. See 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

type: custom:settings-sync
enabled: true
sensor: sensor.settings_sync
render_ui: true
username: admin

References