Get Shabbat Times From Hebcal API Custom Sensor

Hi! I tried using your version of this but unfortunately I got the following errors: :frowning:
Thanks for looking into this!!

  1. Configuration invalidCHECK CONFIG
    Platform not found: sensor.shabbat_times

  2. Error loading custom_components.sensor.shabbat_times. Make sure all dependencies are installed
    Traceback (most recent call last): File “/usr/local/lib/python3.6/site-packages/homeassistant/loader.py”, line 92, in get_component module = importlib.import_module(path) File “/usr/local/lib/python3.6/importlib/init.py”, line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File “<frozen importlib._bootstrap>”, line 994, in _gcd_import File “<frozen importlib._bootstrap>”, line 971, in _find_and_load File “<frozen importlib._bootstrap>”, line 955, in _find_and_load_unlocked File “<frozen importlib._bootstrap>”, line 665, in _load_unlocked File “<frozen importlib._bootstrap_external>”, line 678, in exec_module File “<frozen importlib._bootstrap>”, line 219, in _call_with_frames_removed File “/config/custom_components/sensor/shabbat_times.py”, line 13, in <module> from homeassistant.helpers.restore_state import async_get_last_state ImportError: cannot import name ‘async_get_last_state’

Thanks for the comment. This broke in 0.84 but I just committed a fix to my github repo.

FYI though - coming in 0.86 I’ve added this functionality to the Jewish Calendar sensor, so you won’t need a custom component anymore.

2 Likes

@arigi

I’m really sorry for the delayed response, somehow I’ve missed this comment.
I’d love to help with the integration if needed.

wow, that was quick! works great now! Thank you! :smile: I made a few automations based on your excellent examples. I’m looking forward to this shabbat to see if it works!

Would you mind posting all your configuration/sensor files.
After it broke I have not been able to get it to work.
Shalom
cwb

Hi! There’s actually a slight error in the example on the github page (theres and extra “_”) here is the code that works for me. hope it helps!

  - platform: shabbat_times
    geonames: "US-Los Angeles-CA"
    candle_lighting_minutes_before_sunset: 30
    havdalah_minutes_after_sundown: 52
  - platform: template
    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")) %}
          {%- if not is_state("sensor.shabbat_times_shabbat_time", "Updated") -%}
            unknown
          {%- elif now_time >= as_timestamp(state_attr("sensor.shabbat_times_shabbat_time", "shabbat_start"))
             and now_time < as_timestamp(state_attr("sensor.shabbat_times_shabbat_time", "shabbat_end")) -%}
            on
          {%- else -%}
            off
          {%- endif -%}
  - platform: time_date
    display_options:
      - 'time'
      - 'date'
      - 'date_time'

Hi all!
I just found this useful plugin to home assistant that i think works pretty well and could be useful. I especially found the “issur_melacha” sensor to be very useful for making automations.
:slight_smile:

A bit off topic but hopefully will get the right people on board. I was looking to make a smart plug that has the jewish calendar hard coded so one can make shabbat and holiday based schedules.

If anyone can help I was thinking of either using tasmota or esphome, please reach out.

Sounds like a great idea. Since all the calculations are mathematically based and it already can handle location and sunset calculations, it should be doable. I’d be a user, but I lack the technical capability to do it. I already use Tasmota to do Shabbat schedules, but that’s done purely on day of week.

Upon further research it seems esphome is the preferable method.
I still need some help with creating a web ui scheduler, as well as the hebrew calendar implementation.

Hi All,

Does anyone have insight on my question?

I have an existing KNX Home Automation system with AMX as the Hub/Brain.

I’m replacing the AMX with HA. HA is already up and running with SSD and connected to all KNX devices.

I have the following capabilities in AMX and I want to replicate it in HA (and make it better, faster, stronger).

I’ve read about multiple ways to automate in HA; Automations, Code-Red, Schedule Cards (HACS). I’m not sure what would be the best architecture and set of technologies in HA to do this effectively (no coding and easy to maintain)

I have different scenarios. For example:

  • Regular Day

  • Vacation

  • Holiday

There is a set of default actions that will happen across all these scenarios, for example - outside lights going on at dusk and off at daybreak, Sensors, Shutters raising/lowering, etc.

Then each of the scenarios has a separate set of actions tied to that scenario. For example:

  • Lights or devices turning on and off

  • HVAC on/off or set to different temperatures

I also want to be able to change variables (time/entities) easily via LoveLace without having to change a script, automation or Code Red.

For example:

  • Changing the time a light goes on or off

  • Have HVAC go on in room or remove from scenario temporarily

Any Suggestions? Or things that are already pre-built and can be adapted.