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

Ensure we always fire time pattern changes after microsecond 0 #39302

Merged

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Aug 27, 2020

2nd attempt at fixing #39012 (more desirable option)

Proposed change

Ensure we always fire time pattern changes after microsecond 0

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

# Example configuration.yaml

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@bdraco
Copy link
Member Author

bdraco commented Aug 27, 2020

Testing with this automation

- id: '1598489065877'
  alias: Time Pattern Test
  description: Time Pattern Test
  trigger:
  - platform: time_pattern
    hours: '*'
    minutes: '*'
    seconds: '*'
  condition: []
  action:
  - service: system_log.write
    data_template:
      level: error
      logger: homeassistant.components.mylogger
      message: 'The time is: {{ now() }}'
  mode: single
2020-08-27 00:52:10 ERROR (MainThread) [homeassistant.components.mylogger] The time is: 2020-08-26 19:52:10.002089-05:00
2020-08-27 00:52:11 ERROR (MainThread) [homeassistant.components.mylogger] The time is: 2020-08-26 19:52:11.004120-05:00
2020-08-27 00:52:12 ERROR (MainThread) [homeassistant.components.mylogger] The time is: 2020-08-26 19:52:12.002376-05:00
2020-08-27 00:52:13 ERROR (MainThread) [homeassistant.components.mylogger] The time is: 2020-08-26 19:52:13.004271-05:00
2020-08-27 00:52:14 ERROR (MainThread) [homeassistant.components.mylogger] The time is: 2020-08-26 19:52:14.002611-05:00
2020-08-27 00:52:15 ERROR (MainThread) [homeassistant.components.mylogger] The time is: 2020-08-26 19:52:15.003593-05:00
2020-08-27 00:52:16 ERROR (MainThread) [homeassistant.components.mylogger] The time is: 2020-08-26 19:52:16.003036-05:00
2020-08-27 00:52:17 ERROR (MainThread) [homeassistant.components.mylogger] The time is: 2020-08-26 19:52:17.003154-05:00
2020-08-27 00:52:18 ERROR (MainThread) [homeassistant.components.mylogger] The time is: 2020-08-26 19:52:18.002431-05:00
2020-08-27 00:52:19 ERROR (MainThread) [homeassistant.components.mylogger] The time is: 2020-08-26 19:52:19.004070-05:00
2020-08-27 00:52:20 ERROR (MainThread) [homeassistant.components.mylogger] The time is: 2020-08-26 19:52:20.004795-05:00
2020-08-27 00:52:21 ERROR (MainThread) [homeassistant.components.mylogger] The time is: 2020-08-26 19:52:21.003847-05:00
2020-08-27 00:52:22 ERROR (MainThread) [homeassistant.components.mylogger] The time is: 2020-08-26 19:52:22.002535-05:00

@bdraco bdraco force-pushed the time_pattern_fire_after_microsecond_zero branch from 829f65f to f288cfc Compare August 27, 2020 00:59
@bdraco bdraco force-pushed the time_pattern_fire_after_microsecond_zero branch from f288cfc to b78387f Compare August 27, 2020 13:44
Copy link
Member

@balloob balloob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. It's wild that it can cost so much.

@bdraco
Copy link
Member Author

bdraco commented Aug 28, 2020

I've been running it for a day now without any issues. My system is fast at getting time though so I'm not the best test here.

@bdraco bdraco marked this pull request as ready for review August 28, 2020 14:19
@balloob
Copy link
Member

balloob commented Aug 28, 2020

Let's get it running in dev/beta and see if we break something 👍

@balloob balloob merged commit f8704a2 into home-assistant:dev Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Platform time and time_pattern triggered automations are executed twice
3 participants