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)?
I’m starting to think about a garden project ready for the summer. At the moment I have no hardware for the garden at all but I have experience with ESP8266/Arduino (currently using some for PIR/Temp Sensors in HASS).
If you were to start from scratch, what hardware would you use? At the moment I have an outside tap and a water butt and NOTHING else. Would be interested to hear what people would recommend.
What I’d like to do is… water my veg patch, borders and grass.
I’m using Dark Sky to predict weather in HASS today. And I have a weather station linked to Wunderground which is then imported into HASS for live weather of my garden also (temp, wind direction, speed and rain)
Working on same. Got a LinkNode R4 controlled by HA/MQTT but would like to see HA code for nice UI to set and run an irrigation schedule.
Did you finish your project?
Any chance of sharing on GitHub?