PolarHacker
(Logan McGregor)
November 22, 2017, 12:38am
1
Hello all! Pretty new here and to Home Assistant in general. Recently, I have been interested in getting the weather integrated into my HA setup. I am using the Dark Sky plugin, and so far it seems good. I did have one problem though. I want to change the default unit of measurement from m/s to km/h. I see no documentation of this, and I tried to change it in the “customization” section of HA, but to no avail. Any suggestions would be appreciated.
Thanks!
RobDYI
November 22, 2017, 12:51am
2
You might want to create a template sensor and change the value for the conversion. Something like
value_template: {{ states.sensor.dark_sky_daily_wind_speed.state | float * 0.0010) | round(2) }}
1 Like
PolarHacker
(Logan McGregor)
November 23, 2017, 10:36pm
3
Thanks! That really helped. I am still having one problem however. This is what I got:
- platform: template
sensors:
darksky_wind_speed_km_h:
friendly_name: "Wind Speed km/h"
unit_of_measurement: 'km/h'
value_template: '{{ states.sensor.dark_sky_wind_speed.state | float * 18 / 5 | round(2) }}'
Basically I want the number rounded to 2 decimal places. However, the rounding part is not working at all. Any ideas?
Thanks!
RobDYI
November 23, 2017, 10:56pm
4
Try this (multiple by 100, make an integer, then divide by 100)
'{{ ((states.sensor.dark_sky_wind_speed.state | float) * 100 | int ) * 18 / 5 / 100 }}'
1 Like
PolarHacker
(Logan McGregor)
November 23, 2017, 11:02pm
5
Nope. Still shows the speed currently as 7.812.
Jer78
(Jeremy Percival)
November 24, 2017, 12:06am
6
@PolarHacker This should work… first do your calculations in brackets then round afterwards.
'{{ ((states.sensor.dark_sky_wind_speed.state | float) * 18 / 5 | int) | round(2) }}'
1 Like
PolarHacker
(Logan McGregor)
November 24, 2017, 2:26am
7
Hmmm. Still doesn’t work. Not too sure why
RobDYI
November 24, 2017, 2:44am
8
I got this to work
{{ (2.77 | float * 18 / 5 * 100 ) | int / 100 }}
1 Like
PolarHacker
(Logan McGregor)
November 24, 2017, 3:47am
9
Success! It worked! Thank you so very much!
value_template: '{{ (states.sensor.dark_sky_wind_speed.state | float * 18 / 5 * 100 ) | int / 100 }}'
Marius82
(Marius)
January 16, 2018, 9:25pm
10
You can use the Option Units:ca
platform: darksky
api_key: xxx
update_interval: 1800
units: ca
monitored_conditions:
…
4 Likes
kjwilso
(Ken)
January 21, 2019, 8:11pm
11
This totally worked for me. Fast and easy! Thanks!