core icon indicating copy to clipboard operation
core copied to clipboard

Error while setting up template platform for number

Open MonkeyTrunky opened this issue 1 year ago • 5 comments

The problem

I was trying to set up a helper -> template number. That didn't work despite the right coding and format. Error required key not provided occurs. I am not able to delete it via UI as the delete button does not show like usually with other helpers.

grafik

Thanks for taking a look at this.

What version of Home Assistant Core has the issue?

2024.10.0

What was the last working version of Home Assistant Core?

Not sure, but probably 2024.9

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.number
Quelle: helpers/entity_platform.py:361
Integration: Nummer (Dokumentation, Probleme)
Erstmals aufgetreten: 01:55:03 (1 Vorkommnisse)
Zuletzt protokolliert: 01:55:03

Error while setting up template platform for number
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/usr/src/homeassistant/homeassistant/components/template/number.py", line 129, in async_setup_entry
    validated_config = NUMBER_CONFIG_SCHEMA(_options)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/voluptuous/schema_builder.py", line 205, in __call__
    return self._compiled([], data)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/voluptuous/schema_builder.py", line 549, in validate_dict
    return base_validate(path, data.items(), out)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/voluptuous/schema_builder.py", line 382, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: required key not provided @ data['set_value']

Additional information

No response

MonkeyTrunky avatar Oct 04 '24 00:10 MonkeyTrunky

Can you share your template which caused this issue?

N3rdix avatar Oct 04 '24 05:10 N3rdix

Hey there @phracturedblue, @tetienne, @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (template) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of template can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign template Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


template documentation template source (message by IssueLinks)

home-assistant[bot] avatar Oct 04 '24 13:10 home-assistant[bot]

grafik

According to the template editor, the value should be 26.

grafik

Thanks a lot for the quick response.

Can you share your template which caused this issue?

MonkeyTrunky avatar Oct 05 '24 06:10 MonkeyTrunky

It's the action missing! What should happen when you change the value of your helper? Once you maintain that the error will vanish...

Remark: your min/max settings don't fit to the example of 26, I could imagine this will cause issues when as well.

N3rdix avatar Oct 05 '24 07:10 N3rdix

That did the trick.

Many thanks. 🙂👍

Von: Nerdix @.> Gesendet: Samstag, 5. Oktober 2024 09:05 An: home-assistant/core @.> Cc: MonkeyTrunky @.>; Author @.> Betreff: Re: [home-assistant/core] Error while setting up template platform for number (Issue #127509)

It's the action missing! What should happen when you change the value of your helper? Once you maintain that the error will vanish...

Remark: your min/max settings don't fit to the example of 26, I could imagine this will cause issues when as well.

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/127509#issuecomment-2394958253 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AWN5FHBJIVA5ZEQ5ZWU3J4LZZ6FTJAVCNFSM6AAAAABPK2IQLSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJUHE2TQMRVGM . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AWN5FHGMBZBNKRQT7ARP4BTZZ6FTJA5CNFSM6AAAAABPK2IQLSWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUOYAU22.gif Message ID: @.*** @.***> >

MonkeyTrunky avatar Oct 05 '24 17:10 MonkeyTrunky

It is not possible to delete a helper without an action:

  1. Create a new template helper (type number)
  2. Fill the name and a state template and submit
Screenshot 2024-11-19 at 13 09 30 Screenshot 2024-11-19 at 13 09 37
  1. Click "show settings"
  2. The strange error message required key not provided @ data['set_value']. Got None is still shown - and it is impossible to delete that helper without providing an action
  • Improve the error message required key not provided @ data['set_value']. Got None
  • Allow to delete a number helper without an action

klein0r avatar Nov 19 '24 12:11 klein0r

It is not possible to delete a helper without an action:

  1. Create a new template helper (type number)

  2. Fill the name and a state template and submit

Screenshot 2024-11-19 at 13 09 30 Screenshot 2024-11-19 at 13 09 37
  1. Click "show settings"

  2. The strange error message required key not provided @ data['set_value']. Got None is still shown - and it is impossible to delete that helper without providing an action

  • Improve the error message required key not provided @ data['set_value']. Got None

  • Allow to delete a number helper without an action

It is possible, also without an action. Make sure the state template is correct, save and refresh the UI. You can then delete the entity as usual:

image image

N3rdix avatar Nov 19 '24 12:11 N3rdix

Issue is still reproducible (fresh 2024.11.3 installation):

https://github.com/user-attachments/assets/446c751c-0806-41a7-9ff9-f4385e1c27a3

klein0r avatar Nov 23 '24 10:11 klein0r

@MonkeyTrunky Please reopen this issue

klein0r avatar Nov 25 '24 14:11 klein0r

This line should use vol.Required instead of vol.Optional: https://github.com/home-assistant/core/blob/3af751c129dc99ff02e293fe0bb6f027dd6385cc/homeassistant/components/template/config_flow.py#L160

MartinHjelmare avatar Nov 26 '24 11:11 MartinHjelmare