question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Action to fire Javascript command

See original GitHub issue

Is your feature request related to a problem? Please describe. I use Fully Kiosk Browser on wall-mounted tablets for my Home Assistant UI. Fully has custom javascript functions (like fully.setScreenBrightness(123)) you can call to manipulate the device, such as setting screen brightness, turning the screen off, etc. I would like to make use of some of these functions from the HA UI.

Describe the solution you’d like A new type of action that will fire a specified javascript function when the button is tapped

Describe alternatives you’ve considered Have not seen any alternatives. Currently using TileBoard which has this capability, but am trying to migrate over to Lovelace for my wall-mounted tablets.

Additional context

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

10reactions
RomRidercommented, Apr 20, 2020

You could even call multiple services doing so:

tap_action:
  action: nothing
  multi_calls: |
    [[[
      hass.callService(
        "light",
        "turn_on",
        { entity_id: "light.my_light", brightness: 200 }
      );
      hass.callService(
        "switch",
        "turn_off",
        { entity_id: "switch.my_switch" }
      );
    ]]]
0reactions
MrThiemanncommented, Dec 19, 2022

@Hamsterman , @pioskala

you need type: custom:button-card

type: button doesn’t work for it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating a JavaScript action - GitHub Docs
In this guide, you'll learn how to build a JavaScript action using the actions toolkit.
Read more >
JavaScript Command Design Pattern - Dofactory
The Command pattern encapsulates actions as objects. Command objects allow for loosely coupled systems by separating the objects that issue a request from ......
Read more >
How can I execute JavaScript at the command prompt?
The below example demonstrates to run the JavaScript code at the Command Prompt. Enter every step in the terminal line by line. //...
Read more >
Execute JavaScript code stored as a string - Stack Overflow
You can execute it using a function. Example: var theInstructions = "alert('Hello World'); var x = 100"; var F=new Function (theInstructions); return(F());.
Read more >
How To Execute Javascript Commands in Cypress - DZone
With the help of the example in this article, you can modify and perform Javascript actions in Cypress like MovetoElement, Scroll, MouseMove, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found