Charge battery automation

I got this automation, which I thought will be easy, all I need to automate is when the voltage drops to a value turn the charger switch on.
I can see the voltage reading on “sensor.voltage reading” entity but its not operating the relay , am i missing anything here

id: ‘1695049958056’
alias: battery change below 12
description: ‘’
trigger:

  • platform: numeric_state
    entity_id: sensor.voltage_reading
    below: ‘12.5’
    attribute: unit_of_measurement
    condition: []
    action:
  • type: turn_on
    device_id: d9729e8f610ad8c2df1d2d70f8c90f0a
    entity_id: switch.autoturnoff
    domain: switch
    mode: single

https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

The obvious error is attribute: unit_of_measurement. That means you’re looking for 'V' to drop below 12.5.

Remove the attribute line. I suspect you were tricked by the UI into selecting something, but you want to compare the state of the sensor not any of its attributes.

There could be other errors lurking in there that we can’t see because of the formatting: see prior post.

- id: '1695998988276'
  alias: battery-auto
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.voltage_reading
    below: '12.9'
  condition: []
  action:
  - type: turn_on
    device_id: d9729e8f610ad8c2df1d2d70f8c90f0a
    entity_id: switch.battery_charge_relay
    domain: switch
  mode: single

Hi Troon, i think that helped and i re wrote the automation because , i can see in the log it was being triggered but it was not turning the light on
my realy config is this

switch:
  
  - platform: gpio
    name: "Battery-charge- Relay"
    pin: GPIO04
    id: relay
    
  - platform: template
    name: "Battery-charger-on"
    turn_on_action:
        - switch.turn_on: relay
        - delay: 7200s
        - switch.turn_off: relay

    turn_off_action:
      - then:
        - switch.turn_off: relay
        - switch.template.publish:
            id: relay
            state: OFF

i thought in my automation i will get an option to select “Battery-charger-on” or “Battery-charger-on” is valid
any thoughts

all working now , the relay entity was reloaded and everything started working
cheers