PiotrMachowski / lovelace-html-card

This card displays provided data as an HTML content of a card.
MIT License
52 stars 7 forks source link

Way to call HA service?? #6

Open i00 opened 4 years ago

i00 commented 4 years ago

Hi ... just wondering if you could make it so you can call a HA service from js (maybe some more actions to)? e.g.

<a href='#' onClick="HA_Service('androidtv.adb_command', 'entity_id: media_player.living_room_tv_adb\ncommand: PLAY')">

Thanks

Sylchauf commented 10 months ago

I have found a solution using the browser_mod

Don't forget to register your device in the left menu, then you have access to the hass object in the window

Example

<div  onClick="window.browser_mod.hass.callService('browser_mod', 'more_info', { entity: 'sensor.cuve_meter'})">
your content
</div>