Is it possible to do so that Home Assistant make an http put every 5min with temperature from one of my temperature sensors?
Example post from my z-wave sensor to an url (see below) with a hash and temperatur from the sensor.
https://www.example.com/report.php?hash=personalhash&t=$tempfromthesensor
freshcoast
(Z-Wave AI Bot)
August 8, 2019, 10:23pm
2
How about using an automation with the RESTful command component? Seems like you can use the sensor state in a payload template.
I do this with a shell command and use curl to send the info.
Then use an automation to do it every so often.
Sounds great. As I’m new to this and have no clue how to do it, can you send any example how to do it?
I’m not where I can copy from my config right now, but a look at how the shell command works will give you the structure of it.
Okay I had a second in front of the PC so here is what I have.
There may be other ways to do it, but this works for me.
In configuration.yaml
shell_command:
temptourl: 'curl "the URL you want to hit goes here"'
In automations.yaml
- id: '12345'
alias: Temp to URL
trigger:
- minutes: /5
platform: time_pattern
condition: []
action:
- service: shell_command.temptourl
Hope that helps some.
-------edit---------
Oh I forgot to mention that the url I’m hitting does NOT require authentication. If yours does you’ll have to read up on curl and the switches you can use with it. Also I run hassio.
thank you.
for a beginner, how do I get the temp from the sensor X at the end of the url?
If you use darksky for weather it would look like this:
'curl "http://YOURURL={{ states.sensor.dark_sky_temperature.state }}°F"'
Note that if you want the degree symbol it has to be tacked on the end. You can copy it or hold Alt and type 0176 at the same time if using windows.