Shell command with cURL and sensor variables

Hello!

Im trying to send messages to my android AutoRemote app via the “official” URL

This works:
curl "https://autoremotejoaomgcd.appspot.com/sendmessage?key=_apikey_&message=hello world"

This not so much:
curl "https://autoremotejoaomgcd.appspot.com/sendmessage?key=_apikey_&message={{ states.sensor.weather.attributes.temp }}"

Im pretty sure the quotes making it fail. Whats the correct way to insert sensor states into the actual URL?

Thanks!

did u find a way it do it? even im trying to send autoremote message from HA

Yes! I will get back to you tonight.

1 Like

ok thank you

using https://home-assistant.io/components/rest_command/ it should be something like:

rest_command:
  sendmessage:
    url: 'https://autoremotejoaomgcd.appspot.com/sendmessage?key=_apikey_&message={{ states.sensor.weather.attributes.temp }}'

how can i do it in automation?

- alias: 'Something something'
  hide_entity: False
  trigger:
    platform: state
    entity_id: 'switch.sonoff_4'
    from: 'off'
    to: 'on'
  action:
    service: rest_command.sendmessage
1 Like

I see yllar already helped you and his solution is actually more up-to-date to current hass version then mine.

You can also do a shell_command.yaml:

tasker_alarm: curl -k "https://autoremotejoaomgcd.appspot.com/sendmessage?key=KEY&message={{ as_timestamp(states.calendar.work.attributes.start_time}}"

1 Like