schnibli
(Roger Schneider)
August 23, 2021, 7:19am
1
Hi all
I need to call a http Request with a Button like this:
type: button
tap_action:
action: url
url_path: http://test.org:1111/on.php
entity: ''
name: Elektro Öffnen
hold_action:
action: url
url_path: ''
show_state: false
show_icon: false
The mistake is: Home Assist open a new Webpage (tab) to call this command.
Is it possible to make a request without open a tab?
Thanks for help.
tom_l
August 23, 2021, 7:26am
2
Create a restful command and call that from the button tap action.
1 Like
I used this configuration to call a url I made that talks to an esp32 and closes relays to open and close my garage door:
In your configuration.yaml file, add:
---------snip--------
Rest configuration.yaml entry
rest_command:
garage_up:
url: “http://192.168.1.22/garage_up ”
garage_down:
url: “http://192.168.1.22/garage_down ”
---------snip--------
Add a card from to the dashboard, scroll to the button where it says
Manual
Need to add a custom card or just want to manually write the YAML?
Replace the text with (this is an example, change the url and name):
Button Example (Garage Open). It calls it in the background and does not open the webpage.
---------snip--------
show_name: true
show_icon: true
type: button
name: Open Garage
tap_action:
action: call-service
service: rest_command.garage_up
icon: mdi:garage-open
---------snip--------
tom_l
April 23, 2024, 1:50am
5