input_text: name not optional
@BioSehnsucht docs say it's optional: https://home-assistant.io/components/input_text/
Home Assistant release (hass --version):
0.55
Python release (python3 --version):
3.6
Component/platform: input_text
Description of problem: (friendly)name required
Expected: (friendly)name not required
Problem-relevant configuration.yaml entries and steps to reproduce:
input_text:
ok:
name: ok
not_ok:
I can reproduce this error - in the config schema of input_text.py all values are with vol.Optional, but currently I don't know where this error comes from...
Here all keys are set to required: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/input_text.py#L68
I'm not sure of the background for this though.
As I understand that, only the CONFIG_SCHEMA is required, I would guess that "name" shall be something like vol.Required(CONF_NAME): cv.string but I did not find this way in other sources
I suspect the problem is if your configuration is verbatim, you can't give an empty dict by just leaving an empty hanging configuration, you have to specify empty dict with {}. There's probably an error message being output by HASS somewhere about an empty Dict. We should probably update the documentation to make it clear this is how to handle adding an input_text that has no configuration ...
Ex:
input_text:
ok1:
name: works1
ok2:
min: 0
ok3: {}
bad1:
but here both are ok for example
input_boolean:
switch1:
switch2:
name: Switch 2
Interesting. Perhaps YAML "knows" that following with another same-level entry means that switch1 should be an empty Dict {} automatically, but when it's the last thing at that level it doesn't know if it was malformed or not?
Can you test whether using {} solves the problem as originally posted ? (i.e. as follows, does not_ok actually work?):
input_text:
ok:
name: ok
not_ok: {}
Using {} works for me.
@BioSehnsucht
input_boolean:
switch1:
switch2:
is also working
yes
input_text:
ok: {}
is working but if you see the syntax for input_boolean it still looks broken for me
Might be a difference in using cv.slug: vol.All({ vs cv.slug: vol.Any({, only difference in how they handle configuration that I can see. I'm not sure what the reasoning for picking one over the other would be, I am by no means an expert here.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:
This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍