thomasloven / hass-browser_mod

🔹 A Home Assistant integration to turn your browser into a controllable entity and media player
MIT License
1.32k stars 187 forks source link

Entities become "unavailable" after 5 minutes #452

Open ihaettypo opened 2 years ago

ihaettypo commented 2 years ago

My Home Assistant version: 2022.9.6

This is almost the exactly same problem as metioned here: #145.

For me, they become unavailable right after browser visibility sensor being "hidden" for exact 5 min. I use the Fully-Kiosk browser and has disabled system sleep. And yes I have disabled the "Automatically close connection" in HA. And yes I've checked the router, the device is still connected to wifi.

The motion detection for Fully-Kiosk browser does work. The screen will wake up, just that the HA page would then say "disconnected xxxx" and will reconnect.

andregoncalvespires commented 2 years ago

I have the same problem, and to get it working again I need to close the app and open it again.

T3chArmy commented 2 years ago

Having the same issue on 2022.10.1.

T3chArmy commented 2 years ago

From #145 add this code below in Inject JavaScript under Advanced Web Settings:

Second attempt:

var audio = new Audio('https://raw.githubusercontent.com/anars/blank-audio/master/45-seconds-of-silence.mp3');
audio.loop = true;
audio.play();

image

Going on 30 minutes and it is still reachable!

Note: second attempt was just to test if looping works as well, this allows us to have no time limit AND use a smaller mp3 file. I suspect that length of the mp3 file is a tradeoff between CPU usage and file size, but it is probably negligible as long as we're not looping 0.1 second mp3 files...

After spending all day trying to find a solution for this, this code mentioned above works perfectly to solve the issue!

One important note that I was fighting with all afternoon that I didn't realize I had on, make sure "Consider Device in Use while Audio Playing" is not turned on in Other Settings. It's working great now!

jrbecart commented 2 years ago

The problem with this is that anything playing in the media player will stop.

KentuckyMC commented 2 years ago

Got the same issue here. After 5 minutes everything becomes unavailable and my popups aren't generating anymore. Before in Browser Mod 1, the popups where generated even when the screen was off for longer time. Benefit here, was that if I walked by the tablet after say 30 minutes. The popup still shows (for example last ringer / trashcan pickups). I've set the Fully Kiosk Stay awake as well, no luck.

stefanschaedeli commented 2 years ago

Confirming the same issue

ppurice commented 2 years ago

Have a same problem !

funzie19 commented 1 year ago

Same issue. Also using Fully Kiosk.

shbatm commented 1 year ago

FWIW: Changing this setting and restarting the browser seems to have fixed my issue (not FK, using HADesktop): image

KentuckyMC commented 1 year ago

Got that one turned off already. no luck. image

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

funzie19 commented 1 year ago

Has anybody been successful with Fully Kiosk and this?

KentuckyMC commented 1 year ago

Nope, still same issue. Before I could trigger a popup even when the screen of the tablet was off. So when I wasn't home, I could send a popup for example when I received a postmail. So when I came in, and walked by, the tablet showed me the popup. Not sure why this isn't working anymore.

markmghali commented 1 year ago

same issue with my Asus TF700 showing unavailable. I have to restart Home Assistant Companion App for it to work again.

KentuckyMC commented 1 year ago

I thought I had the solution yesterday. But unfortunately not working. I set the always on when powered in the developer tools on my Android device. It seems that the timeout worked for more minutes. After some triggering of the screen on/off, suddenly after 5 minutes the browser mod became unavailable again.

The weird part is, that my Fully Kiosk itself (with the official integration in HA) isn't losing any connection. That one always stayed on and there I trigger my screen on/off (not in Browser mod). Browser mod isn't really putting the screen off, but just black background, when I use that, it works as expected and the browser mod stays active. But I want to really put my screen off instead of black. It's weird, because of browser mod 1 worked fine with this method.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

miguelangel-nubla commented 1 year ago

Still happening, not stale.

Bibouche commented 1 year ago

Same problem also here

Matz88 commented 1 year ago

Same here, all entities are getting unavailable after a while despite setting the connection to persistent. On the other side, popus still work fine

KentuckyMC commented 1 year ago

Same here, all entities are getting unavailable after a while despite setting the connection to persistent. On the other side, popus still work fine

Also popups when your screen is off and the entities are unavailable? I can't put a popup on the screen then.

Matz88 commented 1 year ago

no pupos at screen off, they appear then when I manually switch on the screen But if teh screen is kept on, then the popus are not an issue

KentuckyMC commented 1 year ago

Saw lately some updates on other posts. Hopefully this one will get some love as well. I believe it´s an easy one to reproduce. Get a combination working with Fully Kiosk Browser. Set the screen off with the toggle in Fully Kiosk Browser and wait for 5 minutes. All entities become unavailable till you toggle it back on. Same behaviour on just setting the tablet itself (Lenovo Tab M10 here) on/off.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

KentuckyMC commented 1 year ago

Got the workaround up with the on/off from the tablet.

So before I trigger the popup (when all entities are unavailable). I first use the fully kiosk browser switch to toggle on the screen. Then delay 2 seconds, put the popup up, and 2 seconds after dim the screen again.

iamnikv commented 1 year ago

Got the workaround up with the on/off from the tablet.

So before I trigger the popup (when all entities are unavailable). I first use the fully kiosk browser switch to toggle on the screen. Then delay 2 seconds, put the popup up, and 2 seconds after dim the screen again.

I have the same issue. After some time the BrowserMod devices become unavailable. I used to use the kiosk browser device to toggle the screen, but it is not as fast as BrowserMod. If only BrowserMod worked..

KentuckyMC commented 1 year ago

The weird thing is just that this worked all fine with the V1 from browser mod. So really don't know what is changed on this functionality.

PablaV commented 12 months ago

I was struggling with a similar issue where Browser Mod would become unavailable randomly on my Fire 10 wall tablets. What I found worked is not using the HA app but actually using a browser to access HA. Browser Mod still goes offline when the screen turns off but comes back up once it's woken up, waking the screen can be handled by Fully Kiosk.

Scoff123 commented 11 months ago

I'm struggling to identify what is causing this on my Windows 10 Surface Pro 5 device, using Edge browser in full screen mode. It takes longer than 5 minutes to appear offline - it can go for several hours or so, before appearing offline. Set all the power saving settings to off in windows, no sleep, no screensaver, leaving the browser fully visible and the tablet on overnight, yet the browser mod entities all show as unavailable the next day. Using HASS.Agent in windows to send the surface stats like battery level to HA, and those stats remain available throughout, being sent via MQTT.

Does anyone know if the solution mentioned above: https://github.com/thomasloven/hass-browser_mod/issues/452#issuecomment-1272747517 is still an option? Where would this be added?

PablaV commented 11 months ago

Have you tried another browser?

Scoff123 commented 11 months ago

I've tried both chrome and Firefox, however there are separate issues with both of those browsers in terms of my dashboard display - probably my older MS surface graphics drivers. Edge is the one browser that displays everything properly on my surface which is why I've stuck with it.

PablaV commented 11 months ago

Are you using Fully Kiosk? I had to tweak some settings to get things working consistently. If not then it may just be the fact your browser isn't supported or out of date

Scoff123 commented 11 months ago

I can't use Fully Kiosk as it isn't available for Windows. I'm using the Windows Hass.Agent to get the battery level and various other sensors, and running Edge in Kiosk mode fullscreen. I might try some automations like playing audio every so often on the tablet to try to keep it 'alive' or refresh the browser every so often via a keypress automation for F5.

pimpshiiiit commented 9 months ago

Any updates?

cedricdelecole commented 8 months ago

Hello There, I am posting here because I THINK I am having the same issue. I have a wall tablet with Fully Kiosk, and tablet's screen wakes up for 30 seconds after the front camera has detected a movement - that is ok.

I am using browser mod in the automation below so that when someone rings the door, the screen of the tablet goes OB, it plays a music, browser_mod pops up (or should ...) etc .... but for some reason, times to times the music is played but the browser_mod doesn't popup. I have ma de severa tests, but I can not figure out 100% what the issue is ... is it only popping up when the screen is already ON ? +Is browser_mod not working when the screen is OFF ? In ant case that is very annoying and I am not sure I can log what happens ?

`- id: 4cf62087-4164-4685-be6d-2ede8401d5fa alias: Dahua VTO trigger:

If someone can please confirm he has the same issue ?

cedricdelecole commented 8 months ago

What I do not get is that from my automation, I am switching the screen ON before launching the browser_mod.popup, but STILL it doesn't popup ?!? Why ?!?

If I wake up the tablet screen using the from camera "Enable Visual Motion Detection" in FKB, then the screen is ON and If I launch the automation, the browser_mod pop's up ....

I really do not understand

Scoff123 commented 7 months ago

Strangely, my tablet has been working fine with browser_mod for a couple of months since my post further up. It just started staying 'available' through HA reboots, updates etc. Then probably a couple of HA Core updates ago, it started going 'unavailable' again frequently. I've tried deleting and registering the device in browser_mod a few times, but I can't get it to stay available for more than a day before it becomes unavailable again.

pmharris77 commented 6 months ago

2 years on and still not fixed? I'm having this exact issue...

Loic691 commented 5 months ago

same

RedDragon1990 commented 5 months ago

hey everyone,

i might have a fix for this isssue, i have an automation running that is closing a popup every 5 minutes. so far this automation is working for me and preventing the "sleep" status.

alias: refresh browserMod description: "" trigger:

Rico81 commented 5 months ago

Strangely, my tablet has been working fine with browser_mod for a couple of months since my post further up. It just started staying 'available' through HA reboots, updates etc. Then probably a couple of HA Core updates ago, it started going 'unavailable' again frequently. I've tried deleting and registering the device in browser_mod a few times, but I can't get it to stay available for more than a day before it becomes unavailable again.

Same here. At least sort of. After struggling quite some time I eventually got it working stable last year. However as I had to replace my router two weeks ago I also had to update some ip's of course. And so I ended up again with disabled browser_mod devices.

Can I show hope of seeing this fixed one day?

projectdimpreza commented 4 months ago

Anyone know a fix for this issue? I always missed the video feed of my doorbell because browser mod is not pop ping out.. every 5 mins the screen is off.. browser mod entities became unavailable 😤

Jpsy commented 4 months ago

The workaround of @RedDragon1990 is working for me.

RedDragon1990 commented 4 months ago

hey everyone,

i might have a fix for this isssue, i have an automation running that is closing a popup every 5 minutes. so far this automation is working for me and preventing the "sleep" status.

alias: refresh browserMod description: "" trigger:

  • platform: time_pattern minutes: /5 condition:
  • type: is_no_motion condition: device device_id: 5a184238aabf9d4463219b177706c177 entity_id: d998888bac39c0f135fbb959e22096fa domain: binary_sensor for: hours: 0 minutes: 0 seconds: 35 action:
  • service: browser_mod.close_popup data: {} mode: single

I've been using this for a month now, entities havent been unavailable since. Seems like this workaround is working.

cedricdelecole commented 4 months ago

Wait guys ... I need to re-read this thread to know what it was about, and I remember I had the exact same issue with entities (I do not recall which ones) were not updated, but I know have a perfectly working automation which when someone rings the bell, there browser_mod pops up on my dashboard displaying the camera feed with a "ring bell" ....

But I just need to understand again what the issue was and what I did to solve it Which entities were we talking about here going to "sleep" ? Was there the browser_mod entities with that red icon on the right ?

image

... because again, if this is the issue, it means it is not solved for me but my doorbell automation works like a charm !

projectdimpreza commented 4 months ago

hey everyone, i might have a fix for this isssue, i have an automation running that is closing a popup every 5 minutes. so far this automation is working for me and preventing the "sleep" status. alias: refresh browserMod description: "" trigger:

  • platform: time_pattern minutes: /5 condition:
  • type: is_no_motion condition: device device_id: 5a184238aabf9d4463219b177706c177 entity_id: d998888bac39c0f135fbb959e22096fa domain: binary_sensor for: hours: 0 minutes: 0 seconds: 35 action:
  • service: browser_mod.close_popup data: {} mode: single

I've been using this for a month now, entities havent been unavailable since. Seems like this workaround is working.

do i need to specify the browser mod entity to target? i notice in your code that you just call the service browser_mod.close_popoup but you never specify the device or entity.

cedricdelecole commented 4 months ago

anyway as no answer on my question above and it looks like I also STILL have this issue with sleeping entities, I am sharing my code here for the doorbell - it works as a charm :

What it does :

  1. detects someone rings the Dahua doorbell
  2. Create a notification in HA
  3. Takes camera snapshot
  4. Create notification on mobile phone 1
  5. Create notification on mobile phone 2
  6. switches on the tablet screen
  7. Wait 3 seconds
  8. Plays a music on the tablet
  9. Sets tablet screen off to 5 minutes
  10. Pops up camera feed with options to hang up or relaunch camera feed for some time
  11. Sets tablet screen off back to 30 seconds
  12. Creates some more notification in HA

I believe hat makes it work and workaround the entity sleeping issue is point 6 above

`alias: Dahua VTO trigger:

Jpsy commented 4 months ago

I've been using this for a month now, entities havent been unavailable since. Seems like this workaround is working.

do i need to specify the browser mod entity to target? i notice in your code that you just call the service browser_mod.close_popoup but you never specify the device or entity.

In fact I use a device id. Example:

service: browser_mod.close_popup
target:
  device_id: 503a14aac9e9a19050df5b0123456789
data: {}
projectdimpreza commented 4 months ago

I've been using this for a month now, entities havent been unavailable since. Seems like this workaround is working.

do i need to specify the browser mod entity to target? i notice in your code that you just call the service browser_mod.close_popoup but you never specify the device or entity.

In fact I use a device id. Example:

service: browser_mod.close_popup
target:
  device_id: 503a14aac9e9a19050df5b0123456789
data: {}

i did this.. on automation browser_mod.close_popup every 5mins also declare the entity to close.. still getting unavailable browsermod entity after 5mins screen is off.

by the way im using a fire tablet.. if that matters... seems like this have nothing to do with browser mod being active or idle.. if my screen goes off for 5mins the fire tablet sleeps therefore browser mod entity goes unavailable.

cedricdelecole commented 4 months ago

but why don't you do like I do and powering the tablet just before calling the browser_mod ? See my code above ... For me it works like a charm

projectdimpreza commented 4 months ago

but why don't you do like I do and powering the tablet just before calling the browser_mod ? See my code above ... For me it works like a charm

Tried turning ON screen before calling browser mod.. sometime browser mod entity becomes available sometime not.. its very unreliable.. the only thing that guaranty to wake browser mod is to trigger fully kiosk start URL..