Now when i try to change its value via service call i get this in my log and it won’t change:
[548150746752] sequence item 0: expected str instance, Optional found
[548014179280] sequence item 0: expected str instance, Optional found
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1445, in async_call
processed_data = handler.schema(service_data)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__
return self._compiled([], data)
File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 215, in _run
return self._exec(self._compiled, value, path)
File "/usr/local/lib/python3.9/site-packages/voluptuous/validators.py", line 339, in _exec
v = func(path, v)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable
return schema(data)
File "/usr/src/homeassistant/homeassistant/helpers/config_validation.py", line 134, in validate
raise vol.Invalid("must contain at least one of {}.".format(", ".join(keys)))
TypeError: sequence item 0: expected str instance, Optional found
I have already found another solution (post edited) a workaround , deleted the button and replaced it with an automation, a helper entity, and a button card with toggle action on the helper entity
This does the job of setting the state but avoiding the service call
A true Solution would solve the original problem you experienced with the Button Card. What you have proposed avoids using a Button Card and employs a slightly more complex arrangement depending on an additional entity and automation. Effectively, your solution is “don’t use a Button card”.
The fact two other people were unable to duplicate the failure you experienced, implies something else is (was) responsible for the problem. Unless you investigate and resolve it, you may not be able to ever use a Button Card on your system (or the Button card you had created was uniquely corrupted and maybe now other Button cards you create will work properly).
Yes, that’s right, I have only found a workaround, but the ‘workaround’ also uses a button card, just without the service call that is the problem, but with the toggle action
However, if I create another button card with another (different) service call (alarm disarm),
That works, but not if I create a new card using the code from the my first post
Except it’s not a problem for two other people who tested it using the same code. That implies there is something your instance is doing that is different.
That’s a useful clue.
One simple experiment is to create a script that sets input_text.pin_eingabe to 000000.
I would still consider my suggestion to be a workaround because it doesn’t explain why your Button Card doesn’t like calling the input_text.set_value command directly but is happy to call a script containing the same command.
Just to satisfy my curiosity, which version of Home Assistant are you using? I performed my test using 2021.7.4.