Fork sync

This commit is contained in:
SBado 2020-10-28 09:26:37 +01:00
commit 7256f16346
7 changed files with 44 additions and 11 deletions

View File

@ -432,5 +432,19 @@ Some of [my lovelace plugins](https://github.com/thomasloven/hass-config/wiki/My
Basically, just replace `service_data` with `data` or `data_template`, whichever fits your needs. Basically, just replace `service_data` with `data` or `data_template`, whichever fits your needs.
### My Fully Kiosk Browser device goes unavailable after the screen has been turned off for five minutes
This seems to be a problem with Android, and not much to do about it.
As a workaround you can add the following to your configuration:
```yaml
browser_mod:
devices:
d2fc860c-16379d23: # DeviceID of your FKB device
force_stay_awake: true
```
That will make the screen turn on and off again for a second regularly to stop the five minute timer from running out.
--- ---
<a href="https://www.buymeacoffee.com/uqD6KHCdJ" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/white_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a> <a href="https://www.buymeacoffee.com/uqD6KHCdJ" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/white_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>

View File

@ -11,15 +11,33 @@ export const FullyKioskMixin = (C) => class extends C {
this._fullyMotion = false; this._fullyMotion = false;
this._motionTimeout = undefined; this._motionTimeout = undefined;
for (const event of ["screenOn", "screenOff", "pluggedAC", "pluggedUSB", "onBatteryLevelChanged", "unplugged", "networkReconnect"]) { for (const ev of ["screenOn", "screenOff", "pluggedAC", "pluggedUSB", "onBatteryLevelChanged", "unplugged", "networkReconnect", "onMotion"]) {
fully.bind(event, "window.browser_mod.fully_update();"); window.fully.bind(ev, `window.browser_mod.fully_update("${ev}");`);
} }
window.fully.bind("onMotion", "window.browser_mod.fullyMotionTriggered();"); this._keepingAlive = false;
} }
fully_update() { fully_update(event) {
if(!this.isFully) return if(!this.isFully) return
if(event === "screenOn") {
window.clearTimeout(this._keepAliveTimer);
if(!this._keepingAlive)
this.screen_update();
} else if (event === "screenOff") {
this.screen_update();
this._keepingAlive = false;
if(this.config.force_stay_awake) {
this._keepAliveTimer = window.setTimeout(() => {
this._keepingAlive = true;
window.fully.turnScreenOn();
window.fully.turnScreenOff();
}, 270000);
}
} else if (event === "onMotion") {
this.fullyMotionTriggered();
}
this.sendUpdate({fully: { this.sendUpdate({fully: {
battery: window.fully.getBatteryLevel(), battery: window.fully.getBatteryLevel(),
charging: window.fully.isPlugged(), charging: window.fully.isPlugged(),

View File

@ -95,6 +95,7 @@ class BrowserMod extends ext(BrowserModConnection, [
if(msg.camera) { if(msg.camera) {
this.setup_camera(); this.setup_camera();
} }
this.config = {...this.config, ...msg};
} }
this.player_update(); this.player_update();
this.fully_update(); this.fully_update();

View File

@ -42,7 +42,7 @@ export const BrowserModPopupsMixin = (C) => class extends C {
const open = () => { const open = () => {
popUp( popUp(
cfg.tile, cfg.title,
cfg.card, cfg.card,
cfg.large, cfg.large,
cfg.style, cfg.style,

View File

@ -29,10 +29,6 @@ export const BrowserModScreensaverMixin = (C) => class extends C {
`; `;
document.body.appendChild(this._blackout_panel); document.body.appendChild(this._blackout_panel);
if(this.isFully) {
window.fully.bind("screenOn", "window.browser_mod.screen_update();");
window.fully.bind("screenOff", "window.browser_mod.screen_update();");
}
} }
screensaver_set(fn, clearfn, time) { screensaver_set(fn, clearfn, time) {
@ -92,7 +88,7 @@ export const BrowserModScreensaverMixin = (C) => class extends C {
this.screensaver_set( this.screensaver_set(
() => { () => {
if(this.isFully) if(this.isFully)
window.fully.turnScreenOff(); window.fully.turnScreenOff(true);
else else
this._blackout_panel.style.display = "block"; this._blackout_panel.style.display = "block";
this.screen_update(); this.screen_update();
@ -109,6 +105,8 @@ export const BrowserModScreensaverMixin = (C) => class extends C {
} }
no_blackout() { no_blackout() {
if(this.isFully)
window.fully.turnScreenOn();
this.screensaver_stop(); this.screensaver_stop();
} }

View File

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

View File

@ -8,6 +8,8 @@ browser_mod:
camera: true camera: true
testdevice: testdevice:
alias: test alias: test
fully:
force_stay_awake: true
lovelace: lovelace: