Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasloven committed Oct 24, 2020
1 parent 7d17efd commit b1e64c3
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
**/__pycache__/
.vscode
.env
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ This binds the *aliases* `arrakis` to `99980b13-dabc9563` and `dashboard` to `d2
Note: Aliases must be unique.


#### Experimental: Custom deviceID
#### Changing deviceID
You can change the deviceID of your device by adding a `browser-player` card to your lovelace interface and clicking the deviceID at the bottom of the card. Set it to `clear` to generate a new random one.

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.

**Take care to avoid deviceID collissions. There's no telling what could happen if more devices share the same ID.**

### Prefix
You can add a custom prefix to all entity ids in `configuration.yaml`:

Expand Down Expand Up @@ -137,6 +141,8 @@ The sensor also has the following attributes:
| `fullyKiosk` | True if the *device* is a Fully Kiosk browser. Undefined otherwise. |
| `width` | The current width of the browser window in pixels. |
| `height` | The current height of the browser window in pixels. |
| `battery_level` | The current battery level of your device - if supported |
| `charging` | The current charging state of your device - if supported |

### media\_player

Expand All @@ -150,7 +156,7 @@ The `light` can be used to blackout the screen.
For Fully Kiosk Browser, the screen will actually turn off.
For other browsers, the interface will just be covered with black (the screen is still on, will have a visible glow in the dark, and you won't save any battery).

### camera (EXPERIMENTAL)
### camera

For security and UX reasons, the camera must be enabled manually on a device by device basis.

Expand Down Expand Up @@ -199,8 +205,7 @@ Display a popup with the deviceID *and* a javascript alert with the deviceID on
```
service: browser_mod.set_theme
service_data:
theme:
theme: clear_light
theme: clear_light
```
will set the current theme to `clear_light` on all devices.
Expand Down Expand Up @@ -334,7 +339,7 @@ Second, there are a few more attributes available
| --- | --- |
| `fullyKiosk` | True. |
| `brightness` | The current screen brightness. |
| `battery` | The current charge percentage of the devices battery. |
| `battery_level` | The current charge percentage of the devices battery. |
| `charging` | Whether the battery is currently charging. |
| `motion` | Whether the devices camera has detected any motion in the last five seconds. |

Expand Down
2 changes: 1 addition & 1 deletion custom_components/browser_mod/browser_mod.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const BrowserModBrowserMixin = (C) => class extends C {
fullyKiosk: this.isFully,
width: window.innerWidth,
height: window.innerHeight,
battery: this.isFully ? window.fully.getBatteryLevel() : battery ? battery.level*100 : undefined,
battery_level: this.isFully ? window.fully.getBatteryLevel() : battery ? battery.level*100 : undefined,
charging: this.isFully ? window.fully.isPlugged() : battery ? battery.charging : undefined,
}});
});
Expand Down
3 changes: 1 addition & 2 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class BrowserMod extends ext(BrowserModConnection, [

set_theme(msg){
if(!msg.theme) msg.theme = "default";
fireEvent("settheme", msg.theme, document.querySelector("home-assistant"));
fireEvent("settheme", {theme: msg.theme}, document.querySelector("home-assistant"));
}

lovelace_reload(msg) {
Expand Down Expand Up @@ -107,5 +107,4 @@ class BrowserMod extends ext(BrowserModConnection, [
const bases = [customElements.whenDefined('home-assistant'), customElements.whenDefined('hc-main')];
Promise.race(bases).then(() => {
window.browser_mod = window.browser_mod || new BrowserMod();
window.bm = (cmd) => window.browser_mod.msg_callback(cmd);
});
5 changes: 3 additions & 2 deletions test/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ lovelace:

frontend:
themes:
red:
primary-color: red
test:
card-mod-theme: test
card-mod-more-info-yaml: |
Expand All @@ -33,8 +35,7 @@ frontend:
tts:
- platform: google_translate
base_url: http://localhost:5001

base_url: !env_var OUT_ADDR

script:
cm_debug:
Expand Down
2 changes: 2 additions & 0 deletions test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ services:
volumes: *x-files
ports:
- "5001:8123"
environment:
OUT_ADDR: "http://${DOCKER_GATEWAY_HOST:-localhost}:5001"
command: *x-command

dev:
Expand Down

0 comments on commit b1e64c3

Please sign in to comment.