Currently not, which is very unfortunate for the usecase where a specific point in time should be tracked. While having lights in mind I didn’t care too much about persistence, but reading this thread it came to my mind. I’ll have a look at that over the weekend.
On top of that I’m still unsure if what this custom component is doing can be replicated 100%. The timer is like an egg-timer where you set a (modifiable) duration where the finished event fires after a specific duration from now. In case of a wedding you actually provide a fixed date, much like an alarm clock. So my component is in comparison more like the egg-timer. It does a similar thing, but in a different way.
I’ll see how my component evolves. Right now I think there should be a second component for tracking fixed dates, and my timer for variable ending times which can easily be extended.
@danielperna84 As your PR was merged recently does that mean my question here could be solved with your component easily in the next Home Assistant (probably 0.57) release?
Yes, that would be a usecase. Currently it is only controlled via services. But using these it would be very simple. You’d set up the timer with the doze time, and then use the state of the timer (active) as a trigger for the automation that mutes the sound. To start the timer, all you have to do is call the timer.start service. Afterwards you unmute either by monitoring the timers state (idle) or you use the timer.finished event as the trigger.
I had set this up in a previous installation of hass.io and it worked great. I’m working on fresh install and can’t seem to get to be recognized. I created the custom_components folder and copied the same exact files I used before. But now I’m getting an “Integration date_countdown not found when trying to verify its sensor platform.” error message. I’ve updated the folder structure so it’s now ‘\config\custom_component\countdown\sensor.py’ but still get the same error message. I do have an empty ‘init.py’ & ‘mainifest.json’
I just re-added the component to my config and ran into the same issue. After messing around a bit, this seems to be what fixed it: Stopping HASS, touching __init__.py, and deleting the __pycache__ folder (if present),
Here’s what I have after it’s running again:
ls /homeassistant/custom_components/date_countdown
__init__.py __pycache__ sensor.py
It needs to be called sensor.py, I’m not sure about permissions of init, mine are 664, owned by my user. Yes, you can have your sensor config in configuration.yaml in your sensors section, no requirement to split out the files.
Anyone knows how to create a countdown timer from a dynamic duration. I have 3 buttons each has a diff time (30mins, 45mins, and 60mins). So my timer duration depends which one was clicked but when I do the following code Hassio gives me an error:
Error: Invalid config for [script]: expected a dictionary for dictionary value @ data[‘script’][‘irrigation_counter’]. Got None expected a dictionary for dictionary value @ data[‘script’][‘sequence’]. Got [OrderedDict([(‘service’, ‘timer.start’), (‘data_template’, OrderedDict([(‘entity_id’, ‘timer.irrigation_timer’), (‘duration’, ‘{{ states.sensor.irrigation_time.state | int }}’)]))])]. (See /config/configuration.yaml, line 390).