Team Tracker - MLB - On First Base Detection?

Newbie here. I am having issues running an automation when a player is on 1st base. Will you kindly let me know what I’m doing wrong? I created this through Settings, Automations. Thank you, Ross

Thank you, Tom_I for helping me with formatting this appropriately.

- id: '1773002200412'
  alias: Baseball - 09a 1st Base True testing!
  description: ''
  triggers:
  - trigger: state
    entity_id:
    - sensor.sd_team_tracker
    attribute: on_first
  conditions:
  - condition: state
    entity_id: sensor.sd_team_tracker
    state:
    - 'true'
    attribute: on_first
  actions:
  - action: number.set_value
    data:
      value: '1'
    target:
      entity_id:
      - number.ha_sdp1stbase
    continue_on_error: true

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

I appreciate your assistance. I have so far been unable to find “the </> button” nor “the editor toolbar.”

I assume the spacing isn’t an issue since it was created by using Settings, Automations. But, I could be wrong, of course.

Thank you again,
Ross

The toolbar is at the top of your post text box.

The </> button is sometimes under the cog icon on small displays.

You can also use the three backticks method as described in the link.

Unfortunately we cant see that because it is not formatted correctly for the forum, as described in the link.

Please edit your post and format it correctly.

The condition is messing you up most likely.
In this case the trigger should be enough I think.

Thank you for your suggestion; however, I’ve tried it with and without quotes around “true” and neither worked.

That’s your quote, I didn’t write that…
I suggested remove all the condition code and see what happens.

Your condition is no different than the trigger, so not needed.

I understand now. on_first returns either true or false. I’m trying to determine when it’s true. Thank you.

For those interested, this code works.

Thanks,
Ross

- id: '1773286599975'
  alias: z-Baseball - 09aa 1st Base - True - This might work - 14
  description: ''
  triggers:
  - trigger: state
    entity_id:
    - sensor.sd_team_tracker
    attribute: on_first
    from:
    - 'false'
    to:
    - 'true'
  conditions: []
  actions:
  - action: number.set_value
    data:
      value: '1'
    target:
      entity_id:
      - number.ha_sdp1stbase
    continue_on_error: true
  mode: single