I see you have 2 times a delay in there … not sure if that works
another tip is try to evaluate your template in the developer tools under Templates. That will show you how the template renders the output as a common issue here with time is that you get one digit back and than your delay looks like 00:5:00 and that will not work.
Search in this forum on the topic alarm clock and you will find lot of entries how other have solved some of the issues with this
Hi Ronvl,
Suspect that Im getting the below errors due to the now function change.
Can you help identify which of the now statements need changing? Below is an example of a few instances I have found - unsure which examples need changing.
Currently getting a couple errors in the log file on 0.30.2.
16-10-14 23:55:44 homeassistant.components.sensor.template: UndefinedError: ‘function object’ has no attribute ‘weekday’
16-10-14 23:55:44 homeassistant.components.sensor.template: UndefinedError: ‘None’ has no attribute ‘last_changed’
I’m not near HASS at the moment but it looks like you have two times as_timestamp(now) that need to be changed to as_timestamp(now()) I believe. You can test it via the developer tools under Templates, just past it in there there … way easier than starting the HASS every time
Please be aware that the Status that shows how long the Valve is open is not working anymore since 29.5…
See:
If you follow the links to the PR you will find a work around that I haven’t tested yet… as it is authum here in Germany and getting below zero at night the sprinkler is currently not installed
I noticed that if i restart hass the parameters i set are not saved and rolls back to default.
For example the select sensor returns back to its default which is None.
Also the time and duration is reset to default.
Instead of automation with slide bars for,hour and minute and days, I moved my logic to be control with a google calendar with the latest release.
My sensor Based on the calendar searches for Bed 1, which is my sprinkler in one of my raised bed, it uses the state = on to turn it off, but I still set the off with a timer set with a slider and a Mqtt command
to create a sensor for when I last ran the sprinkler automation. The issue I’m having is the time here isn’t my “local” timezone it’s the UTC timezone that home assistant runs everything with in the background. How can i translate to my local time with the strftime?
@thejacko12354 that code is a bit old and now.weekday() is replaced by now().weekday(). have a search on the release notes as there were a few changes since
@ronvl yeah i found that error.
Now I’m stuck with the next one…
If I set a day, I get this error:
Traceback (most recent call last):
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/usr/lib/python3.5/site-packages/homeassistant-0.36.0.dev0-py3.5.egg/homeassistant/helpers/entity.py", line 212, in async_update_ha_state
yield from self.async_update()
File "/usr/lib/python3.5/asyncio/coroutines.py", line 206, in coro
res = func(*args, **kw)
File "/usr/lib/python3.5/site-packages/homeassistant-0.36.0.dev0-py3.5.egg/homeassistant/components/sensor/template.py", line 114, in async_update
self._state = self._template.async_render()
File "/usr/lib/python3.5/site-packages/homeassistant-0.36.0.dev0-py3.5.egg/homeassistant/helpers/template.py", line 99, in async_render
return self._compiled.render(kwargs).strip()
File "/usr/lib/python3.5/site-packages/jinja2/environment.py", line 989, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/lib/python3.5/site-packages/jinja2/environment.py", line 754, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python3.5/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "<template>", line 66, in top-level template code
File "/usr/lib/python3.5/site-packages/jinja2/sandbox.py", line 355, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/lib/python3.5/site-packages/homeassistant-0.36.0.dev0-py3.5.egg/homeassistant/util/dt.py", line 79, in as_timestamp
raise ValueError("not a valid date/time.")
ValueError: not a valid date/time.
Hi @ronvl, I copied some of your code a while back and was never able to get it to work properly. I read that home assistant does all of it’s time calculations at timezone +0 GMT and then converts it to your local time after when displaying on the UI. The problem I’m having is getting the following to not use the internal time and use my local time when displaying on the sensor. I’m in timezone +8 so it always displays 8 hours behind. If you can help that would be much appreciated!
I don’t know how to run those in developer tools, what Domain and Service do i use? I’m assuming that list is supposed to go under the Service Data (JSON, optional)?