Allow changing deviceID.

This commit is contained in:
Thomas Lovén 2020-08-07 16:10:52 +02:00
parent 678d56e864
commit 7743e29bf2
6 changed files with 260 additions and 98 deletions

View File

@ -71,6 +71,11 @@ This binds the *aliases* `arrakis` to `99980b13-dabc9563` and `dashboard` to `d2
Note: Aliases must be unique.
#### Experimental: Custom deviceID
You can also set a deviceID by adding `?deviceID=mydeviceID` to the end of the URL you're using to access Home Assistant. Be careful - I have no idea what could happen if several devices were to have the same ID.
Use `?deviceID=clear` to generate a new random one.
### Prefix
You can add a custom prefix to all entity ids in `configuration.yaml`:

File diff suppressed because one or more lines are too long

4
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "browser_mod",
"version": "1.1.4",
"version": "1.1.6",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -655,7 +655,7 @@
"dev": true
},
"card-tools": {
"version": "github:thomasloven/lovelace-card-tools#951759b56acfcfb5d1aa8222bf410a9a36712182",
"version": "github:thomasloven/lovelace-card-tools#6d5ae3800e4937aa424edc17108f43b964aecce7",
"from": "github:thomasloven/lovelace-card-tools"
},
"chalk": {

View File

@ -1,7 +1,7 @@
{
"name": "browser_mod",
"private": true,
"version": "1.1.5",
"version": "1.1.6",
"description": "",
"scripts": {
"build": "webpack",

View File

@ -9,95 +9,20 @@ views:
- title: Player
cards:
- type: custom:browser-player
- type: button
class: border
entity: sun.sun
name: popup
tap_action:
action: call-service
service: browser_mod.popup
service_data:
deviceID: this
title: Test
card:
type: markdown
content: Hello!
- type: button
entity: sun.sun
name: large
tap_action:
action: call-service
service: browser_mod.popup
service_data:
deviceID: this
title: Test
large: true
card:
type: markdown
content: Hello!
- type: button
entity: sun.sun
name: Style
tap_action:
action: call-service
service: browser_mod.popup
service_data:
deviceID: this
title: Test
- type: picture-elements
image: https://placekitten.com/g/800/600
elements:
- type: state-icon
entity: light.bed_light
style:
.: |
app-toolbar {
background: rgba(0,0,0,0.5) !important;
}
$: |
.mdc-dialog .mdc-dialog__container .mdc-dialog__surface {
border-radius: 20px;
background: rgba(0,0,0,0);
}
card:
type: vertical-stack
cards:
- type: markdown
content: Hello!
style: |
ha-card {
--ha-card-background: rgba(0,0,0,0.5);
color: white;
}
- type: markdown
content: Hello!
style: |
ha-card {
--ha-card-background: rgba(0,0,0,0.5);
color: red;
}
top: 50%
left: 50%
animation: spin 4s linear infinite
style: |
@keyframes spin {
100% {
transform: rotate(360deg);
}
}
- type: button
entity: sun.sun
name: Auto Close
tap_action:
action: call-service
service: browser_mod.popup
service_data:
deviceID: this
title: Test
auto_close: true
card:
type: markdown
content: Hello!
- type: button
entity: sun.sun
name: Hide Header
tap_action:
action: call-service
service: browser_mod.popup
service_data:
deviceID: this
title: Test
hide_header: true
card:
type: markdown
content: Hello!
- !include views/popup.yaml

232
test/views/popup.yaml Normal file
View File

@ -0,0 +1,232 @@
x-anchors:
default: &default
type: button
entity: light.bed_light
icon: mdi:settings
desc: &desc
type: markdown
style: |
code {
font-size: 8pt;
line-height: normal;
white-space: pre-wrap;
}
title: Popup
cards:
- type: vertical-stack
cards:
- <<: *desc
content: |
```
service: browser_mod.popup
service_data:
title: Default
card:
type: markdown
content: Popup!
```
- <<: *default
name: Default
tap_action:
action: call-service
service: browser_mod.popup
service_data:
title: Default
card:
type: markdown
content: Popup!
- type: vertical-stack
cards:
- <<: *desc
content: |
```
service: browser_mod.popup
service_data:
title: Large
large: true
card:
type: markdown
content: Popup!
```
- <<: *default
name: Large
tap_action:
action: call-service
service: browser_mod.popup
service_data:
title: Large
large: true
card:
type: markdown
content: Popup!
- type: vertical-stack
cards:
- <<: *desc
content: |
```
service: browser_mod.popup
service_data:
title: Hide Header
hide_header: true
card:
type: markdown
content: Popup!
```
- <<: *default
name: Hide header
tap_action:
action: call-service
service: browser_mod.popup
service_data:
title: Hide Header
hide_header: true
card:
type: markdown
content: Popup!
- type: vertical-stack
cards:
- <<: *desc
content: |
```
service: browser_mod.popup
service_data:
title: Auto close
auto_close: true
card:
type: markdown
content: Popup!
```
- <<: *default
name: Auto close
tap_action:
action: call-service
service: browser_mod.popup
service_data:
title: Auto close
auto_close: true
card:
type: markdown
content: Popup!
- type: vertical-stack
cards:
- <<: *desc
content: |
```
service: browser_mod.popup
service_data:
title: Popup 1
card:
<<: *default
tap_action:
action: call-service
service: browser_mod.popup
service_data:
title: Popup 2
card:
type: markdown
content: Popup!
```
- <<: *default
name: Nested popup
tap_action:
action: call-service
service: browser_mod.popup
service_data:
title: Popup 1
card:
<<: *default
tap_action:
action: call-service
service: browser_mod.popup
service_data:
title: Popup 2
card:
type: markdown
content: Popup!
- type: vertical-stack
cards:
- <<: *desc
content: |
More info in popup.
May have different behavior depending on whether a more-info dialog
has ever been opened before a popup.
- type: entities
entities: [light.bed_light]
- <<: *default
name: More info in popup
tap_action:
action: call-service
service: browser_mod.popup
service_data:
title: More info in popup
card:
type: entities
entities: [light.bed_light]
- type: vertical-stack
cards:
- <<: *desc
content: |
```
style:
$: |
.mdc-dialog {
backdrop-filter: blur(17px);
-webkit-backdrop-filter: blur(17px);
}
.mdc-dialog .mdc-dialog__container .mdc-dialog__surface {
border-radius: 25px;
}
.: |
:host {
--mdc-theme-surface: rgba(0,0,0,0);
--secondary-background-color: rgba(0,0,0,0.5);
--ha-card-background: rgba(0,0,0,0.5);
}
:host .content {
width: 90vw;
height: 90vh;
}
```
- <<: *default
name: Styled
tap_action:
action: call-service
service: browser_mod.popup
service_data:
title: Styled popup
card:
type: markdown
content: Popup!
style:
$: |
.mdc-dialog {
backdrop-filter: blur(17px);
-webkit-backdrop-filter: blur(17px);
}
.mdc-dialog .mdc-dialog__container .mdc-dialog__surface {
border-radius: 25px;
}
.: |
:host {
--mdc-theme-surface: rgba(0,0,0,0);
--secondary-background-color: rgba(0,0,0,0.5);
--ha-card-background: rgba(0,0,0,0.5);
}
:host .content {
width: 90vw;
height: 90vh;
}
- <<: *default
name: Close popup
tap_action:
action: call-service
service: browser_mod.close_popup