Setting status of sensor?

I’ve created a simple automation to alert for low power of the host of my HA setup, and I’d like to test that it works.

If I simply run the automation an alert doesn’t occur - because there isn’t low power. I’ve tried setting the state to ‘on’ for the entity binary_sensor.rpi_power_status, but the automation still isn’t triggered. Is this the correct way to force a change of state to test an automation?

Jim

That would depend on your triggers. Which we can’t see. Please share the automation.

- I’d put ‘cmd’ in the MQTT publish line instead of ‘cmnd’. It’s working OK now I’ve corrected it!

It’s to save having to look at the computer to see if I’ve got low power on the Pi. I’ve got a Tasmotised NodeMCU with several LEDs for immediate visual alerts. The automation is pathetically simple:

alias: Low Power Warning
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.rpi_power_status
condition: []
action:
  - service: mqtt.publish
    data:
      qos: "0"
      retain: false
      topic: cmnd/NodeMCU/Power4
      payload: "on"
mode: single

Jim