Manually refresh rest sensor?

Hi,

is it possible to manually trigger a refresh of a restful sensor? According to the docs, there is no command for rest sensors. Only rest.refresh what I guess is to reload the configuration.

Background is: I have a template switch which is based on a rest sensor. If you toggle the switch, the command is sent. But the switch still shows the old state, until the next refresh of the rest sensor. This is confusing…

2 Likes

Add the following service to your template switch turn_on and turn_off actions:

- service: homeassistant.update_entity
  entity_id: sensor.your_rest_sensor

https://www.home-assistant.io/docs/scripts/service-calls/#homeassistant-services

2 Likes