Hello all,
I’ve been facing a problem recently where certain button that call services fail to action with the following error:
Failed to call service light/turn_on. sequence item 0: expected str instance, Optional found
This happens after a while that I navigate through the interface and is temporarily resolvable by reloading home assistant in my browser 3 times (which I believe drops the cache in Google Chrome).
I experienced the above on Google Chrome running on my Linux machine, however my android phone exhibits the same problem and is temporarily fixable in the same way.
Same, again, happens on the android app, however I don’t know of an easy way to drop the cache on that. I believe it uses the android web viewer as a backend anyway, so same difference really…
I’ve tried deleting the whole cache and cookies but unfortunately that didn’t help.
Here’s a visual example of this problem:
The home assistant logs report this error when it happens:
Logger: homeassistant.components.websocket_api.http.connection
Source: helpers/config_validation.py:132
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: May 2, 2021, 10:44:13 PM (62 occurrences)
Last logged: 11:15:37 PM
[2772796776] sequence item 0: expected str instance, Optional found
[2794859560] sequence item 0: expected str instance, Optional found
[2784769696] sequence item 0: expected str instance, Optional found
[2788180896] sequence item 0: expected str instance, Optional found
[2848991648] sequence item 0: expected str instance, Optional found
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 143, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1434, in async_call
processed_data = handler.schema(service_data)
File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 218, in __call__
return self._exec((Schema(val) for val in self.validators), v)
File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 337, in _exec
v = func(v)
File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
return self._compiled([], data)
File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable
return schema(data)
File "/usr/src/homeassistant/homeassistant/helpers/config_validation.py", line 132, in validate
raise vol.Invalid("must contain at least one of {}.".format(", ".join(keys)))
TypeError: sequence item 0: expected str instance, Optional found
Here’s the code of one of the buttons that triggers this error:
type: button
tap_action:
action: call-service
service: light.turn_on
service_data:
brightness_pct: 10
target:
entity_id:
- light.master_bedroom_lamp
show_name: false
icon: 'mdi:lightbulb-outline'
My installation is running the following:
- Home Assistant: 2021.4.6
- Frontend: 20210407.3 - latest
- Raspberry Pi 4B (4GB)
I’m not sure what’s causing this behaviour but I’d be very grateful if someone with more knowledge could help me figure our this problem, as it’s been driving me bonkers!
Happy to test any theories you might have.
Thank you,
Alex