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

Add support for time entities #6399

Merged
merged 14 commits into from Apr 9, 2024
Merged

Add support for time entities #6399

merged 14 commits into from Apr 9, 2024

Conversation

jesserockz
Copy link
Member

@jesserockz jesserockz commented Mar 19, 2024

What does this implement/fix?

Adds support for time entities. This is pretty much the same as date entities with the obvious difference.

Related PRs:

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Related issue or feature (if applicable): fixes

Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#3748

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx

Example entry for config.yaml:

# Example config.yaml

datetime:
  - platform: template
    type: time
    optimistic: true
    name: Time
    id: my_time
    restore_value: true
    on_value:
      - logger.log:
          format: "The time is now: %02d:%02d:%02d"
          args:
            - x.hour
            - x.minute
            - x.second

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

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

@probot-esphome
Copy link

Hey there @RFDarter, mind taking a look at this pull request as it has been labeled with an integration (datetime) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-esphome
Copy link

Hey there @OttoWinter, mind taking a look at this pull request as it has been labeled with an integration (api) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@gabest11
Copy link
Contributor

gabest11 commented Mar 24, 2024

Can you take a look at #6424 ? I see you also used strptime. This function eliminates 1M devices from ESPHome because it uses std::regex... Smart plugs, etc. With OTA there is max 500k space and even a barebone config is nearly that big.

@gabest11
Copy link
Contributor

Then you need to call DateTimeBase::strptime instead, Which does not exists until this is merged. Can't you move it there in your PR? And this can be cancelled then.

@gabest11
Copy link
Contributor

Ignore my last comment, putting ifdefs in time.h. strptime will stay there.

@jesserockz jesserockz marked this pull request as draft March 25, 2024 22:53
@jesserockz
Copy link
Member Author

Converting to draft as I need to add the on_time trigger

@jesserockz
Copy link
Member Author

Depends on #6468

@jesserockz jesserockz marked this pull request as ready for review April 8, 2024 04:22
@probot-esphome
Copy link

probot-esphome bot commented Apr 8, 2024

Hey there @RFDarter, mind taking a look at this pull request as it has been labeled with an integration (datetime) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@jesserockz jesserockz added this to the 2024.4.0b1 milestone Apr 8, 2024
@kbx81 kbx81 merged commit 76c5337 into dev Apr 9, 2024
64 checks passed
@kbx81 kbx81 deleted the jesserockz-2024-060 branch April 9, 2024 01:46
This was referenced Apr 9, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants