Skip to content
This repository has been archived by the owner on Aug 29, 2019. It is now read-only.

Update import for HA Version 0.91+ #36

Closed
wants to merge 8 commits into from

Conversation

theChef613
Copy link

see breaking changes here: https://www.home-assistant.io/blog/2019/04/03/release-91/.
from custom_components.sensor import shabbat_times_util as shabbat
should be
from custom_components.shabbat_times import shabbat_times_util as shabbat

the "sensor" folder should be changed to "shabbat_times" and the "shabbat_times" file should change to "sensor.py", see attached file.
shabbat_times.zip

@TomerFi
Copy link
Owner

TomerFi commented Jul 4, 2019

@theChef613

First off... thank you for this PR.

I'm really sorry, I haven't had the time to keep this repository checked and updated, And I haven't noticed this PR until now.

I just came in now to mark this repository as Not maintained and on my way out I saw it.

Can you please elaborate on what this changes accomplish (if they are still relevant)?
Maybe we can merge one last time before my not maintained stuff kicks in.

@TomerFi TomerFi self-assigned this Jul 4, 2019
@theChef613
Copy link
Author

@theChef613

First off... thank you for this PR.

I'm really sorry, I haven't had the time to keep this repository checked and updated, And I haven't noticed this PR until now.

I just came in now to mark this repository as Not maintained and on my way out I saw it.

Can you please elaborate on what this changes accomplish (if they are still relevant)?
Maybe we can merge one last time before my not maintained stuff kicks in.

Hi TomerFi!
No worries :) The changes basically are all the commits @arigilder has done but makes some minor tweaks to file/folder names as well as references in order for it to be compatible with HA 0.91+ no changes to the code itself.

@TomerFi
Copy link
Owner

TomerFi commented Jul 4, 2019

I believe the same result using this custom component can be accomplished using the built in component Jewish Calendar.
That's why I decided to stop maintaining this custom component.

I still use it myself, as you can see in my ha configuration, but I plan on deleting it eventually.

@theChef613
Copy link
Author

I believe the same result using this custom component can be accomplished using the built in component Jewish Calendar.
That's why I decided to stop maintaining this custom component.

I still use it myself, as you can see in my ha configuration, but I plan on deleting it eventually.

You're totally right but for me, there's been an hour offset to Shabbat start and stop times ever since daylight savings time. See my the issue I posted about this here so in the meantime, I've been using this. (I hope they fix the Jewish calendar soon! :)

@TomerFi
Copy link
Owner

TomerFi commented Jul 4, 2019

Other then the offset, were you able to get the shabbat start and end time correctly?

I haven't tried Jewish Calendar yet, and I would love to retire the Shabbat Times custom component completely if getting the start and end time can be accomplished with Jewish Calendar.

@theChef613
Copy link
Author

Other then the offset, were you able to get the shabbat start and end time correctly?

I haven't tried Jewish Calendar yet, and I would love to retire the Shabbat Times custom component completely if getting the start and end time can be accomplished with Jewish Calendar.

Before daylight saving time, it worked perfectly! the "issue mleccha in effect" boolean is especially useful

@arigilder
Copy link

arigilder commented Jul 4, 2019 via email

@arigilder
Copy link

arigilder commented Jul 4, 2019 via email

@TomerFi
Copy link
Owner

TomerFi commented Jul 4, 2019

Hey guys, So I wrote a lot of the Shabbat start/end specific stuff for the Jewish Calendar component. There's still some differences, but largely I actually made the Jewish Calendar way better and more accurate. I haven't looked at the offset bug, but I can take a look when I get a chance. I've been running both my version of Shabbat Times and Jewish Calendar at the same time and I've basically migrated entirely to Jewish Calendar and would recommend you look into doing so.

On Thu, Jul 4, 2019, 1:20 PM Tomer Figenblat @.***> wrote: Other then the offset, were you able to get the shabbat start and end time correctly? I haven't tried Jewish Calendar yet, and I would love to retire the Shabbat Times custom component completely if getting the start and end time can be accomplished with Jewish Calendar. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#36?email_source=notifications&email_token=AKNQ4RADVCX4J64AOCWSBYLP5YWOJA5CNFSM4HFMVIM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZH4BFI#issuecomment-508543125>, or mute the thread https://github.com/notifications/unsubscribe-auth/AKNQ4RCIVBJIGQBZE56LXELP5YWOJANCNFSM4HFMVIMQ .

@arigilder
That's great, Thank you very much!
I'll try it this weekend!

I'm looking forward to retire my custom component!
I'm trying to keep my configuration custom-component-free lately.

@arigilder
Copy link

@theChef613 Just went to look at it - looks like @tsvi updated py-libhdate to include a fix for this. See if you can pull the latest version down and check if it works.

@theChef613
Copy link
Author

@theChef613 Just went to look at it - looks like @tsvi updated py-libhdate to include a fix for this. See if you can pull the latest version down and check if it works.

Hi! Thank you! I'm still relatively new to HA so i'm not sure how to specifically pull a version of it... I just added it to my config.yaml

@arigilder
Copy link

arigilder commented Jul 5, 2019

In the meanwhile, if you want, I have a template sensor you can use that doesn't depend on issur melacha in effect:

sensors:
    shabbat_mode:
      friendly_name: Shabbat Mode
      value_template: >-
        {%- set now_time = as_timestamp(strptime(states.sensor.date_time.state, "%Y-%m-%d, %H:%M")) %}
        {%- set shabbat_start = as_timestamp(strptime(states.sensor.shabbat_mode_start_time.state, "%a %b %d %Y, %I:%M %p")) %}
        {%- set shabbat_end = as_timestamp(strptime(states.sensor.shabbat_mode_end_time.state, "%a %b %d %Y, %I:%M %p")) %}
        {%- if now_time >= shabbat_start and now_time < shabbat_end -%}
          on
        {%- elif states.input_boolean.test_shabbat_mode.state == 'on' -%}
          on
        {%- else -%}
          off
        {%- endif -%}

    shabbat_mode_start_time:
      friendly_name: "Shabbat Mode Start Time"
      value_template: >-
        {%- if is_state("input_boolean.early_shabbat", "on") -%}
        {%set tt = strptime(states.input_datetime.early_shabbat_start.state, "%H:%M:%S")%}
        {{strptime(states.sensor.jewish_calendar_upcoming_candle_lighting.state, "%Y-%m-%d %H:%M:%S%z").replace(hour=tt.hour, minute=tt.minute).strftime("%a %b %d %Y, %-I:%M %p")}}
        {%- else -%}
        {{as_timestamp(states.sensor.jewish_calendar_upcoming_candle_lighting.state) 
          | timestamp_custom("%a %b %d %Y, %-I:%M %p")}}
        {%- endif -%}

    shabbat_mode_end_time:
      friendly_name: "Shabbat Mode End Time"
      value_template: >-
        {{as_timestamp(states.sensor.jewish_calendar_upcoming_havdalah.state) 
          | timestamp_custom("%a %b %d %Y, %-I:%M %p")}}


Hope that helps get you working with the Jewish Calendar component while you wait for the other fix to hit HA.

@TomerFi
Copy link
Owner

TomerFi commented Jul 5, 2019

Amazing!
I will use these templates!
Thank you very much!

@theChef613
Copy link
Author

Hi! @arigilder when I try to implement your template sensor I get the following error:
Invalid config for [sensor.template]: [shabbat_mode] is an invalid option for [sensor.template]. Check: sensor.template->shabbat_mode. (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.template/
I'm also attaching my configuration.yaml for reference.. (sorry about all the commented out stuff in advance..
configuration.zip

@arigilder
Copy link

@theChef613 Take out the following lines:

        {%- elif states.input_boolean.test_shabbat_mode.state == 'on' -%}
          on

That's just a testing mechanism I have.

@theChef613
Copy link
Author

@theChef613 Take out the following lines:

        {%- elif states.input_boolean.test_shabbat_mode.state == 'on' -%}
          on

That's just a testing mechanism I have.

Works now, thanks!

@mikeage
Copy link

mikeage commented Jul 10, 2019

Thanks, @arigilder . That's also a useful sensor to use as a basis for those of us who make "early shabbos" (at plag hamincha) in the summer!

@arigilder
Copy link

arigilder commented Jul 10, 2019 via email

@mikeage
Copy link

mikeage commented Jul 10, 2019

I did :-)

@TomerFi TomerFi closed this Aug 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants