Rest Command to send topic

Welcome everybody,
I would like to ask if anyone can help me with this problem. I start by saying I’m a bit new to the home assistant world and I’d like to understand how it works, but I’m missing some details from the official guide.
I try to explain my problem. On the netatmo denveloper site there is the possibility of sending instructions by sending curl commands to the home thermostats (via login), to set them in various ways.
I have the complete string to send in the curl command, but I don’t know how to insert it in the home assistant.
I would like to create a button(helpers), so that when I press it it sends this string to the thermostat.
end. The problem that I don’t know where to write this string curl…

Can anyone help me??
A thousand thanks.

first of all: Are you aware that there is a complete (cloud) integration for netatmo?

Secondly: You can use the RESTful command integration to add services that are then called by your button helper:

Yes,
i tried to use the netatmo integration, but i get errors when i go to use the devices. basically I can only read them.
i read all the guide for the restful command but i don’t understand how to do it. if i send the string through terminal with curl command, it works fine.

No worries :slight_smile:

  • Have you installed the fileeditor add-on? If not, go to settings, add-ons an do so.
  • After it is set up, open the file editor from the sidebar and start editing configuration.yaml
  • Insert this code, adjust the url to your needs and change example_request to a name you recognize. Remember that indentation is important.
rest_command:
  example_request:
    url: "http://example.com/"
  • Restart home-assistant
  • Add a button to your dashboard (A helper is not needed)
  • Set the tap-action of that button to “Call Service”
  • Select your new rest command from the service dropdown below the tap-action dropdown

thanks
I write this because I search online for something and I arrived at this point. but doesn’t work. anything succeed… I think I need to send a curl command…
‘’’
rest_command:
my_request:
url: https://api.netatmo.com/api/setstate
method: POST
headers:
authorization: Bearer 123456
accept: “application/json”
payload: ‘{“home”:{“id”:“6102d03ca2fdf66640410c26”,“rooms”:[{“id”:“4133547889”,“therm_setpoint_mode”:“manual”,“therm_setpoint_temperature”:25}]}}’
content_type: ‘application/json’

‘’’

If you need to send curl try here:

Yes, but if I write this command “shell_command:
call_remote: curl -X POST “https://api.netatmo.com/api/setstate” -H “accept: application/json” -H “Authorization: Bearer 610180d3bb250e48711f6a14|15ee83a0f7fad07bd1b966edda1c2170” -H “Content-Type: application/json” -d “{“home”:{“id”:“6102d03ca2fdf66640410c26”,“rooms”:[{“id”:“4133547889”,“therm_setpoint_mode”:“manual”,“therm_setpoint_temperature”:20}]}}””
the verify of configuration i recive an error “Error loading /config/configuration.yaml: mapping values are not allowed here”
what can i do?

Your rest command can be tested from a button or from the call-service panel in the dev-tools. The results will show inside the homeassistant logs. When I tried your code, I got a 403 permission denied from netatmo.

Also: Please don’t post authorization tokens on the forum

You will need to put single-quotes around the curl command.

sorry for post a token on the forum. Right now i put the single-quote around the command and thats is ok, but i can found any file about homessistant log. where i found a log file? i use Studio core editor for write in the configuration file.

It is in the webui in settings/system/logs

i found it, but i don’t have any message of log about shell command… nothing. but i can understand if the command works fine on my application about Control Home on my phone. if i try from netatmo site that’s work. here not.

if you want to help maybe is better to read here, Netatmo Connect | Legrand API Documentation
for example i don’t know where i found my o2auth to inser in application credential on home assistant for netatmo integration

Sorry, I don’t have any experience with oauth inside the restful components.
Actually, I was under the impression that you wanted to directly connect to the the thermostats locally, without the cloud app.

Yess, because the cloud integration doesn’t work correct…