I’m new to this forum (and home assistant) so I hope I’m asking I’m using the yr.no set of sensors, and it works well, but I doesn’t show wind chill (which is a contributing factor in Norway at the moment, with temperatures dropping below -40 some places). As far as I can see, the yr data doesn’t include wind chill, but it’s detailed here http://om.yr.no/symbol/effektiv-temperatur/ (article in Norwegian) among other places. Pyrhon3 code for converting this matches the wind chill reported on yr.no.
Any idea how to do this most easily?
roy
#!/usr/bin/env python3
T=-11 # Celsius
V=4 # m/s
Vkmh = V*3.6 # in kmh, since the formula wants that
W = 13.12 + 0.6215T - 11.37Vkmh0.16 + 0.3965TVkmh0.16
print("At " + str(T) + "°C with " + str(V) + "m/s wind, effective temperature is " + str(round(W,1)) + “°C”)
The formula should be right, but it’s probably something I’m doing wrong in the syntax, since it fails. Any ideas?
tail: /home/homeassistant/.homeassistant/home-assistant.log: file truncated
2018-02-28 19:44:58 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.windchill fails
Traceback (most recent call last):
File “/home/homeassistant/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 204, in async_update_ha_state
yield from self.async_device_update()
File “/home/homeassistant/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 325, in async_device_update
yield from self.async_update()
File “/usr/lib/python3.5/asyncio/coroutines.py”, line 210, in coro
res = func(*args, **kw)
File “/home/homeassistant/homeassistant/lib/python3.5/site-packages/homeassistant/components/sensor/template.py”, line 162, in async_update
self._state = self._template.async_render()
File “/home/homeassistant/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/template.py”, line 131, in async_render
return self._compiled.render(kwargs).strip()
File “/home/homeassistant/homeassistant/lib/python3.5/site-packages/jinja2/environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/home/homeassistant/homeassistant/lib/python3.5/site-packages/jinja2/environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “/home/homeassistant/homeassistant/lib/python3.5/site-packages/jinja2/_compat.py”, line 37, in reraise
raise value.with_traceback(tb)
File “”, line 1, in top-level template code
TypeError: can’t multiply sequence by non-int of type ‘float’
Have you checked if the darksky component figures in windchill? It has a “feels like” temperature that figures in the humidity, very important when you live in the tropics. It might factor in windchill also for colder temps, wouldn’t know though as wind chill isn’t really something that happens here
I haven’t no, and I’d like to use the data from Yr, since they are really accurate here (in Norway/Sweden), and as far as I know, the calculations of windchill and heat differ largely in that at lower temperatures, the humidity can be take out of the equation, whereas in high tempertures, it plays an importat role (note: I’m no meteorologist, I’ve just read up a bit about things)
I guess so and that’s why the hin using the template editor of HA UI is valid.I don’t use the yr component, but usually per entity there is (domain).(entity) and then either “state” or “attributes.(attribute name)”
Im really curious if @rkarlsba made it work since i want the chill effect as well
Now im using an sensor from Wunderground but it would be nice to avoid relying on other services when i hav my own sensors
Error rendering template: UndefinedError: ‘None’ has no attribute ‘precipitation’
For loop example:
{% for state in states.sensor -%}
{%- if loop.first %}The {% elif loop.last %} and the {% else %}, the {% endif -%}
{{ state.name | lower }} is {{state.state_with_unit}}
{%- endfor %}.
For loop example:
The cpu temperature is 46.54 °C, the hygrometer på pi is 23.8 %, the termometer på pi is 29.4 °C, the windchill is unknown, the yr humidity is 80.0 %, the yr precipitation is 0.0 mm, the yr pressure is 1009.2 hPa, the yr symbol is 2, the yr temperature is -2.2 °C and the yr wind speed is 0.7 m/s.