When the command is send, it replies in the browser with
anyurl processed
I used this in Domoticz to list my radio stations and Spotify playlists. When I create a switch or script in HA, the radio stations change every 10 seconds as HA assumes that the command was not received.
I tried Node-Red too, but the same issue arises.
Any help is much appreciated, I feel like a total noob
You need to post your HA YAML code. There are just too many RESTful components for us to guess which you used and how you used it. Given your comment it sounds like you’re using a RESTful sensor where maybe you should be using a RESTful command.
Understood. Currently, there are no sensors or switches related to the function that I am trying to use. Unfortunately I couldn’t make much sense from the example posted before
What I am trying to achieve is to create an execute button or script, which sends the URL listed below.
config.yaml
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
# Example configuration.yaml entry for USB/serial connected Smartmeter
sensor:
- platform: dsmr
port: /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AC2F1ATY-if00-port0
dsmr_version: 5
# Example configuration.yaml entry
discovery:
remote:
platform: harmony
name: N&N
host: 192.168.1.200
media_player:
- platform: squeezebox
host: 192.168.1.127
shelly:
input_text:
rest_cmd_url:
name: Q-Music
rest_command:
rest_cmd:
url: http://192.168.1.127:9000/plugins/Favorites/index.html?action=play&index=0
So you just “call” it by using the rest_command.rest_cmd service.
Have you tried running it, e.g., from the SERVICES tab of the Developer Tools page to see if it does what you expect?
Are you asking how to invoke that service from the UI?
Previously you said, “When I create a switch or script in HA, the radio stations change every 10 seconds.” Is that not a problem anymore? (I.e., did you remove the switch/script???)
What do you mean by that? Specifically, what do you mean by “and the http address”? To call the service it’s just rest_command.rst_cmd (based on the config you shared above.) I have no idea what you mean by what you said. You need to be more explicit. There are several ways to “call a service.”
But previously you said, “When I create a switch or script in HA, the radio stations change every 10 seconds.” Which is it?
Sorry, it’s kind of hard to follow you when you seem to contradict yourself on subsequent replies. Of course, I might just be me misunderstanding you.
Again, you didn’t show a script. The term “script” means something specific in HA, so it gets confusing when you use the term incorrectly. It seems you’re new to HA, so I’m just pointing this out to make helping you easier in the future.
So, back to basics. You invoked your rest_command.rst_cmd service, but I think you said there was no response from the device. Did you check HA’s logs to see if there were any warnings or errors?
Phil, I’m sorry, I have tried so many different options, that I can totally understand that my replies cause confusion.
At the moment I have a blank setup, no switches or scripts. What I try to do is to have a button named after a radio station which, when pressed, fires http://192.168.1.127:9000/plugins/Favorites/index.html?action=play&index=0
Nothing else. Perhaps you could guide me in the right direction on how to achieve this.
Using the rest_command you had defined earlier should be a part of a working solution. However, if it doesn’t work when you invoke it from the SERVICES tab of the Developer Tools page, then that needs to be addressed first.
You might try enabling debug for RESTful commands:
logger:
default: info
logs:
homeassistant.components.rest_command: debug
Add that and your RESTful command back to your config and restart HA. Then try invoking it again. Then check home-assistant.log for any related messages. There should be at least one. If it “works” (from HA’s perspective), then there should be a DEBUG message saying so. If there was some problem sending the request then there should be a WARNING or ERROR message.
If HA thinks it works, but the device still doesn’t respond, then it has to be some sort of networking issue.
I’ve got the same problem, running the commands thru my browser and everything works. Trying it via HA and nothing :-(. Do you have some more tips for me?