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

Helper size reduction #378

Merged
merged 5 commits into from
Aug 7, 2022
Merged

Conversation

Azrael-Kun
Copy link
Contributor

This pull request reworks the helper_last_controller_event entity to use less characters (see #333).

I tested the e2001/e2002 blueprint with custom actions and once confirmed working went through and updated all the other blueprints.

Breaking change

There should not be any breaking changes as the new regex_match should cause existing entities to be updated to the new format on first use.

Proposed change*

  • Replace current value: {"trigger_action": "off", "last_triggered": "2022-05-05 09:58:25.740583+02:00"} with {"a": "off", "t": <unix time>}
    • In this format the max size without event should be 33 characters ({"a": "", "t": 1658511756.518805})
    • The longest current event I could find was 25 characters (move_to_level_with_on_off)
  • Stores last triggered time as float instead of string to avoid multiple conversions back and forth
  • Updated regex_match to look for "a": ".*" or "t": \d+.\d+ in either order
    • This will cause the old format to be overridden by the new format on first run

Closes #333

Checklist*

  • I followed sections of the Contribution Guidelines relevant to changes I'm proposing.
  • I properly tested proposed changes on my system and confirm that they are working as expected.
  • I formatted files with Prettier using the command npm run format before submitting my Pull Request.

@github-actions
Copy link
Contributor

Hey @Azrael-Kun, thank you so much for your contribution! 🚀

🔄 We're currently running a few checks to make sure that everything is great with your contribution.
If further actions need to be performed before your contribution can be reviewed, additional guidance will be provided to you in the next comment.

Results are coming soon, stay tuned!

@github-actions
Copy link
Contributor

github-actions bot commented Jul 22, 2022

Hey @Azrael-Kun,

✅ Your contribution passed all the checks, awesome!
A maintainer will soon review your submission and provide additional feedback regarding your changes.

Thanks again for dedicating your precious time to this project. 🔥

📝 Updated blueprints included in this PR can be tested by importing them in Home Assistant via the following links.

https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/ikea_e1524_e1810/ikea_e1524_e1810.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/ikea_e1743/ikea_e1743.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/ikea_e1744/ikea_e1744.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/ikea_e1766/ikea_e1766.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/ikea_e1812/ikea_e1812.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/ikea_e2001_e2002/ikea_e2001_e2002.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/ikea_ictc_g_1/ikea_ictc_g_1.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/osram_ac025xx00nj/osram_ac025xx00nj.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/philips_324131092621/philips_324131092621.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/philips_8718699693985/philips_8718699693985.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/philips_929002398602/philips_929002398602.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/xiaomi_wxcjkg11lm/xiaomi_wxcjkg11lm.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/xiaomi_wxcjkg12lm/xiaomi_wxcjkg12lm.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/xiaomi_wxcjkg13lm/xiaomi_wxcjkg13lm.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/xiaomi_wxkg11lm/xiaomi_wxkg11lm.yaml

@EPMatt EPMatt force-pushed the helper-size-reduction branch from 191dfd2 to 3c8ed8e Compare August 7, 2022 22:06
@github-actions
Copy link
Contributor

github-actions bot commented Aug 7, 2022

Hey @EPMatt, thank you so much for your contribution! 🚀

🔄 We're currently running a few checks to make sure that everything is great with your contribution.
If further actions need to be performed before your contribution can be reviewed, additional guidance will be provided to you in the next comment.

Results are coming soon, stay tuned!

@github-actions
Copy link
Contributor

github-actions bot commented Aug 7, 2022

Hey @EPMatt,

✅ Your contribution passed all the checks, awesome!
A maintainer will soon review your submission and provide additional feedback regarding your changes.

Thanks again for dedicating your precious time to this project. 🔥

📝 Updated blueprints included in this PR can be tested by importing them in Home Assistant via the following links.

https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/ikea_e1524_e1810/ikea_e1524_e1810.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/ikea_e1743/ikea_e1743.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/ikea_e1744/ikea_e1744.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/ikea_e1766/ikea_e1766.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/ikea_e1812/ikea_e1812.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/ikea_e2001_e2002/ikea_e2001_e2002.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/ikea_ictc_g_1/ikea_ictc_g_1.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/osram_ac025xx00nj/osram_ac025xx00nj.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/philips_324131092621/philips_324131092621.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/philips_8718699693985/philips_8718699693985.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/philips_929002398602/philips_929002398602.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/sonoff_snzb01/sonoff_snzb01.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/xiaomi_wxcjkg11lm/xiaomi_wxcjkg11lm.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/xiaomi_wxcjkg12lm/xiaomi_wxcjkg12lm.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/xiaomi_wxcjkg13lm/xiaomi_wxcjkg13lm.yaml
https://github.com/Azrael-Kun/awesome-ha-blueprints/blob/helper-size-reduction/blueprints/controllers/xiaomi_wxkg11lm/xiaomi_wxkg11lm.yaml

@EPMatt
Copy link
Owner

EPMatt commented Aug 7, 2022

Hi @Azrael-Kun,

thank you so much for your kind contribution. I've added a few minor changes to your submission:

  • Implemented the helper reduction for the SONOFF SNZB-01 controller you recently submitted as a new blueprint (Add support for SONOFF SNZB-01 #376).
  • Bumped blueprint version to 2022.08.08.
  • Updated version and changelogs in the docs.
  • Updated a couple of YAML comments in the IKEA E1524 and E1743 blueprints.

Since my changes do not introduce any functionality change and you've already performed tests successfully, I'm now proceeding to merge this PR into main and make the updates available to the public.

Thank you so much for such a great contribution! You're really helping the project grow with your work. 🔥
Happy automating!

@EPMatt EPMatt merged commit 9ee5920 into EPMatt:main Aug 7, 2022
github-actions bot pushed a commit that referenced this pull request Aug 7, 2022
* Add helper reduction to e2001/e2002

* Update all controllers with new helper

* helper size reduction for sonoff_snzb01

* fix blueprint comments

* bump versions to 2022.08.08, update changelogs

Co-authored-by: Matteo Agnoletto <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2022

Hi there,

🔒 This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. If you want to submit a contribution to the project, you can open a new PR.

Thanks!

@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement - Overcome 100 chars limit in input_text helpers
2 participants