Skip to content

Commit

Permalink
Allow changing deviceID.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasloven committed Aug 7, 2020
1 parent 678d56e commit 7743e29
Show file tree
Hide file tree
Showing 6 changed files with 260 additions and 98 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:

Expand Down
10 changes: 5 additions & 5 deletions custom_components/browser_mod/browser_mod.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "browser_mod",
"private": true,
"version": "1.1.5",
"version": "1.1.6",
"description": "",
"scripts": {
"build": "webpack",
Expand Down
105 changes: 15 additions & 90 deletions test/lovelace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
- 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!
top: 50%
left: 50%
animation: spin 4s linear infinite
style: |
@keyframes spin {
100% {
transform: rotate(360deg);
}
}
- 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 changes: 232 additions & 0 deletions test/views/popup.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7743e29

Please sign in to comment.