How to convert units of measurement in OpenWeatherMap integration?

I use the OpenWeatherMap integration for weather since Dark Sky is no longer available. It seems to be fairly reliable but the API reports most measurements in metric units and these units are not configurable in the integration. Is there some documentation on converting these entities to imperial units?

Template sensor

and use thenDeveloper Tools TEMPLATE to help with the Maths

here on that take the wind_bearing number and turn it into direction

- platform: template
  sensors:
    wind_direction_words:
      friendly_name: Wind direction Words
      value_template: >-
        {% set wind_dir = state_attr("weather.home","wind_bearing") %}
        {% if wind_dir | float<=11 %}'N'
        {% elif wind_dir | float>348 %}'N'
        {% elif 11 < (wind_dir|float) <=34 %}NNE
        {% elif 34 < (wind_dir|float) <=56 %}NE
        {% elif 56 < (wind_dir|float) <=79 %}}ENE
        {% elif 79 < (wind_dir|float) <=101 %}E
        {% elif 101 < (wind_dir|float) <=124 %}ESE
        {% elif 124 < (wind_dir|float) <=146 %}SE
        {% elif 146 < (wind_dir|float) <=169 %}SSE
        {% elif 169 < (wind_dir|float) <=191 %}S
        {% elif 191 < (wind_dir|float) <=214 %}SSW
        {% elif 214 < (wind_dir|float) <=236 %}SW
        {% elif 236 < (wind_dir|float) <=259 %}WSW
        {% elif 259 < (wind_dir|float) <=281 %}W
        {% elif 281 < (wind_dir|float) <=304 %}WWN
        {% elif 304 < (wind_dir|float) <=326 %}NW
        {% elif 326 < (wind_dir|float) <=348 %}NNW
        {% else %}
        CALM
        {% endif %}

also do a search in here and you find something c

Can I use this to modify an existing sensor or will I need to create a new one?

Create a new one.

I found this post and tried to follow it- https://community.home-assistant.io/t/change-yr-weather-units-of-measure/46917/9

Cant get the syntax right in configuration.yaml though.


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
#use ssl
#http:
#  ssl_certificate: /ssl/fullchain.pem
#  ssl_key: /ssl/privkey.pem

# Text to speech
tts:
  - platform: google_translate
  
# Includes
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
homeassistant:
  customize: !include customize.yaml
  packages: !include_dir_named packages
#mqtt:
  #broker: 10.0.1.50
  #username: genmon
  #password: genmon1234
sensor:
#OpenWeatherMap conversion
  - platform: template
    sensors:
      wind_speed_mph:
        friendly_name: "Weather Wind Speed"
        unit_of_measurement: "mph"
        value_template: "{{(states('sensor.openweathermap_wind_speed')| float * 2.23694) | round(1) }}"
      weather_pressure_inhg:
        friendly_name: "Weather Atmospheric Pressure"
        unit_of_measurement: "inHg"
        value template: "{{'{0:.2f}'.format(states('sensor.openweathermap_pressure')| float / 33.76895)}}"
# Hive 8 weight
#  - platform: scrape
#    name: Hive 8 Weight
#    resource: https://www.wifihivescale.com/index.php/graph
#    select: "#t01 > tbody:nth-child(1) > tr:nth-child(4) > td:nth-child(6)"
#    scan_interval: 3600
#    unit_of_measurement: lbs
#    authentication: basic
#    username: wgstarks
#    password: 366B4HVpWiWYtH
# World Clock
  - platform: worldclock
    time_zone: America/New_York
alarm_control_panel:
# Alarm Control Panel Manual
  - platform: manual
    name: shop alarm
    code_arm_required: false
    code: '1234'
    arming_time: 0
    delay_time: 0
    trigger_time: 4
    disarmed:
      trigger_time: 0
    armed_home:
      arming_time: 0
      delay_time: 0
# Prowl notification
  - name: prowl
    platform: prowl
    api_key: 7291d42ee46a66ae702dff515ec65afdb1f69040
    priority: 2
# Discovery
discovery:
  ignore:
    - sonos
    - samsung_printer

This gives me an error-

Invalid config for [template]: [value template] is an invalid option for [template]. Check: template->sensors->weather_pressure_inhg->value template. (See /config/configuration.yaml, line 78).

I’m not very good at yaml. :flushed:

I just pasted your stuff into mine

found it

then last value_template: "{{

delete the space after the : and put it back look some funny char there


after deleting and adding the space

That worked. Thanks. Had to re-type the whole line to fix it but no big deal.

How do you get the remarks shown in red in your screenshot? Are you using a file editor other than the builtin one?

using the vscode plugin and it f…kin alsum