mathoudebine / homeassistant-browser-control-card

Control your browser from a Home Assistant lovelace card: full screen, disable screen lock, zoom, reload page...
MIT License
12 stars 0 forks source link

Control of functions directly from HA (creation of entity?) #17

Closed Alessiou78 closed 4 months ago

Alessiou78 commented 4 months ago

1st, TKS for your work. Is it possible to implement a "full screen button" control, and maybe other buttons, directly from HA? (perhaps through a creation of the related entities)

mathoudebine commented 4 months ago

Unfortunately it is not possible from a card to create sensors or services, but you can use Browser Mod to do this: https://github.com/thomasloven/hass-browser_mod

First install Browser Mod from HACS, and configure it by following the documentation here: https://github.com/thomasloven/hass-browser_mod?tab=readme-ov-file#quickstart

Once you have registered your web browser with Browser Mod, you can run javascript code to the browser from a Home Assistant service called browser_mod.javascript.

For example if you want your browser to go fullscreen, call this service with your browser as target:

browser-mod

Then you can call this service from automation, or from a button card...

There are some other javascript codes, e.g. to refresh the page the javascript code is document.location.reload();

Alessiou78 commented 4 months ago

TOP ! Thanks a lot

jouster1974 commented 2 days ago

Unfortunately it is not possible from a card to create sensors or services, but you can use Browser Mod to do this: https://github.com/thomasloven/hass-browser_mod

First install Browser Mod from HACS, and configure it by following the documentation here: https://github.com/thomasloven/hass-browser_mod?tab=readme-ov-file#quickstart

Once you have registered your web browser with Browser Mod, you can run javascript code to the browser from a Home Assistant service called browser_mod.javascript.

For example if you want your browser to go fullscreen, call this service with your browser as target:

browser-mod

Then you can call this service from automation, or from a button card...

There are some other javascript codes, e.g. to refresh the page the javascript code is document.location.reload();

did try this but didn't seem to work which is a shame..the command was sent and a green tick to state as much, but no change at the device itself. other than having browsermod in place, are there any other things that would stop this from working or would be required to ensure this works?

mathoudebine commented 2 days ago

Maybe a javascript blocker can be the cause. You can try to disable any adblocker / use a private browsing window. Under "Targets" > "Choose device" are you able to select your browser?

jouster1974 commented 2 days ago

i can choose the browser correctly...it sees it...but it just doesnt seem to do anything

image