Update readme

This commit is contained in:
Thomas Lovén 2020-10-24 23:17:09 +02:00
parent 7d17efd961
commit b1e64c3b93
7 changed files with 19 additions and 11 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules/ node_modules/
**/__pycache__/ **/__pycache__/
.vscode .vscode
.env

View File

@ -72,10 +72,14 @@ This binds the *aliases* `arrakis` to `99980b13-dabc9563` and `dashboard` to `d2
Note: Aliases must be unique. 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. 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. 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 ### Prefix
You can add a custom prefix to all entity ids in `configuration.yaml`: You can add a custom prefix to all entity ids in `configuration.yaml`:
@ -137,6 +141,8 @@ The sensor also has the following attributes:
| `fullyKiosk` | True if the *device* is a Fully Kiosk browser. Undefined otherwise. | | `fullyKiosk` | True if the *device* is a Fully Kiosk browser. Undefined otherwise. |
| `width` | The current width of the browser window in pixels. | | `width` | The current width of the browser window in pixels. |
| `height` | The current height 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 ### media\_player
@ -150,7 +156,7 @@ The `light` can be used to blackout the screen.
For Fully Kiosk Browser, the screen will actually turn off. 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). 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. For security and UX reasons, the camera must be enabled manually on a device by device basis.
@ -199,8 +205,7 @@ Display a popup with the deviceID *and* a javascript alert with the deviceID on
``` ```
service: browser_mod.set_theme service: browser_mod.set_theme
service_data: service_data:
theme: theme: clear_light
theme: clear_light
``` ```
will set the current theme to `clear_light` on all devices. will set the current theme to `clear_light` on all devices.
@ -334,7 +339,7 @@ Second, there are a few more attributes available
| --- | --- | | --- | --- |
| `fullyKiosk` | True. | | `fullyKiosk` | True. |
| `brightness` | The current screen brightness. | | `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. | | `charging` | Whether the battery is currently charging. |
| `motion` | Whether the devices camera has detected any motion in the last five seconds. | | `motion` | Whether the devices camera has detected any motion in the last five seconds. |

File diff suppressed because one or more lines are too long

View File

@ -21,7 +21,7 @@ export const BrowserModBrowserMixin = (C) => class extends C {
fullyKiosk: this.isFully, fullyKiosk: this.isFully,
width: window.innerWidth, width: window.innerWidth,
height: window.innerHeight, 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, charging: this.isFully ? window.fully.isPlugged() : battery ? battery.charging : undefined,
}}); }});
}); });

View File

@ -77,7 +77,7 @@ class BrowserMod extends ext(BrowserModConnection, [
set_theme(msg){ set_theme(msg){
if(!msg.theme) msg.theme = "default"; 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) { lovelace_reload(msg) {
@ -107,5 +107,4 @@ class BrowserMod extends ext(BrowserModConnection, [
const bases = [customElements.whenDefined('home-assistant'), customElements.whenDefined('hc-main')]; const bases = [customElements.whenDefined('home-assistant'), customElements.whenDefined('hc-main')];
Promise.race(bases).then(() => { Promise.race(bases).then(() => {
window.browser_mod = window.browser_mod || new BrowserMod(); window.browser_mod = window.browser_mod || new BrowserMod();
window.bm = (cmd) => window.browser_mod.msg_callback(cmd);
}); });

View File

@ -23,6 +23,8 @@ lovelace:
frontend: frontend:
themes: themes:
red:
primary-color: red
test: test:
card-mod-theme: test card-mod-theme: test
card-mod-more-info-yaml: | card-mod-more-info-yaml: |
@ -33,8 +35,7 @@ frontend:
tts: tts:
- platform: google_translate - platform: google_translate
base_url: http://localhost:5001 base_url: !env_var OUT_ADDR
script: script:
cm_debug: cm_debug:

View File

@ -52,6 +52,8 @@ services:
volumes: *x-files volumes: *x-files
ports: ports:
- "5001:8123" - "5001:8123"
environment:
OUT_ADDR: "http://${DOCKER_GATEWAY_HOST:-localhost}:5001"
command: *x-command command: *x-command
dev: dev: