Http get request as entity?

Sometimes I get so proud of myself for some of the stuff I manage to do in HA and sometimes I just want to jump off my roof.

So I managed to build some nodes out in Node-Red and through those nodes I can trigger an HTTP request (get) to an endpoint on the WebRelay and thereby open by front gates (relay still sitting on my desk/lab). Yay.

But now I cannot figure out how in the world to get “buttons” in Lovelace for these http requests. I did build a card and used a button and set the tap action to URL but the problem is it will open a new tab with the response from the url when I click it.

Then I started thinking that I really need these actions as entities (I think) so that I can use them throughout HA. I searched for some code samples to do that but kept getting config errors when modifying configuration.yaml.

Any pointers or tutorials on how to go about doing this?

You probably need to create a shell command and call that from the button, the navigate and url actions do what you found, opens the resource.

You could probably skip Node Red altogether using this.

Assuming I figure out how to do this, will this also then expose the shell script to node-red and the rest of HA for other things?

I don’t use Node Red, so no idea. It will be available for use anywhere in Home Assistant (Lovelace, automations, scripts).

You should not need node red. You should be able to just use the shell command to control your webrelay directly.