I can create an input helper from a bash script like this:
#!/bin/bash
ha_url="https://ha.local"
ha_token="my_longlived_token"
# Create an input_boolean "foo" with friendly name "Foo helper" and sets the state to "on"
curl -X POST \
-H "Authorization: Bearer ${ha_token}" \
-H "Content-Type: application/json" \
-d '{"state": "on", "attributes": {"friendly_name": "Foo helper"}}' \
"$ha_url"/api/states/"input_boolean.foo"
I can then update the state using the same script by replacing āstateā: āonā with āstateā: āoffā.
However, I seem unable to change the state from within Home Assistant, I can see the toggle on my dashboard and within the āhelpersā page, but when I toggle it from its current state it reverts back again.
Is this expected behaviour? Is there a way to stop it?
If I create the input helper from within Home Assistant itself, rather than via the API, I can change it freely in the dashboard and via the API.