Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid time pattern passes checks #40269

Closed
DubhAd opened this issue Sep 18, 2020 · 10 comments
Closed

Invalid time pattern passes checks #40269

DubhAd opened this issue Sep 18, 2020 · 10 comments

Comments

@DubhAd
Copy link
Contributor

DubhAd commented Sep 18, 2020

The problem

An invalid time pattern trigger passes the config checks, but will throw errors at run time.

Environment

  • Home Assistant Core release with the issue: 0.115.0
  • Last working Home Assistant Core release (if known):
  • Operating environment (OS/Container/Supervised/Core): Core
  • Integration causing this issue: Automation
  • Link to integration documentation on our website: https://home-assistant.io/integrations/automation

Problem-relevant configuration.yaml

- id: '1572617131931'
  alias: New Automation
  description: ''
  trigger:
  - platform: time_pattern
    seconds: '/300'
  condition: []
  action:
  - data:
      message: "Test here"
    service: notify.file

Traceback/Error logs

Additional information

@DubhAd
Copy link
Contributor Author

DubhAd commented Sep 18, 2020

During startup you get the following from the above automation:

2020-09-18 20:54:01 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: must be a value between 0 and 59 for dictionary value @ data['seconds']. Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 63).

@probot-home-assistant
Copy link

automation documentation
automation source
(message by IssueLinks)

@probot-home-assistant
Copy link

Hey there @home-assistant/core, mind taking a look at this issue as its been labeled with an integration (automation) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@spacegaier
Copy link
Member

I can't reproduce that in the latest 0.116 dev branch. During attempted saving in the automation editor, it correctly raises the error that the value is not valid.

@DubhAd
Copy link
Contributor Author

DubhAd commented Sep 21, 2020

The automation editor may complain, but that doesn't help:

  1. Those who write them manually
  2. Those who already have invalid values ;)

See also this thread

@spacegaier
Copy link
Member

@DubhAd If I manually change the values of the automation in YAML and then reload from within HA then I get the same error logged as you. What would be the expected outcome? To me the error looks correct (would be better if instead of "None" it would show "300").

@DubhAd
Copy link
Contributor Author

DubhAd commented Oct 5, 2020

Sorry for the delay. The problem is there's no error from the config check, only at startup.

@balloob
Copy link
Member

balloob commented Oct 16, 2020

The problem is that "check config" was a hack bolted onto Home Assistant that we now have to maintain and hasn't kept up with the modernizing of config validation 😭

@balloob
Copy link
Member

balloob commented Oct 16, 2020

This will happen to anything that uses the modern config validation, which includes anything that has triggers, conditions or action/scripts. To fix this helpers/check_config.py should be changed to use async_process_component_config from homeassistant/config.py for validation.

@github-actions
Copy link

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 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants