OpenHAB: How To Transform m/s into miles per hour (mph)

This how to helps you to transform wind values of m/s into miles per hour (mph) with OpenHAB. It provides an example of a rule as well as the maths behind. This might be helpful for any sort of mathematical transformation that you like to do with your weather and wind data.

OpenHAB: How To Transform m/s into miles per hour (mph)

OpenHAB: How To Transform m/s into miles per hour (mph)

Index Of OpenHAB: How To Transform m/s into miles per hour (mph)

Background of OpenHAB: How To Transform m/s into miles per hour (mph)

I have a weather station that measures the wind speed in meters per second (m/s). This however is very difficult to understand, as generally we are far more used to Miles per Hour (mph). Therefore, I was wondering how this can be calculated into mph. After some research in the internet, I found a way that works quite well for me. It might be useful for you too.

My environment:

  • Raspberry Pi 4
  • OpenHAB 4
  • KNX
  • MDT Weather Station 

OpenHAB: How To Transform m/s into miles per hour (mph)

First of all we need to create the necessary items in the .items file. In my case the items looks like this:

Number Weatherstation_Wind_Speed                            "Current Wind [%.1f m/s]"                                <wind>                  (All, gWetter, gSQLAllChanges)          { channel="knx:device:bridge:MDT_1_1_3:MDT_1_1_3_Wind" }
Number Windspeed_mph                                        "Current Wind [%.1f mph]"                                <wind>                  (All, gWetter, gSQLAllChanges)

After I have done this, I have created a rule which basically calculates the wind in Miles per Hour (mph). For this it is important to know that transforming from m/s into mph there is the factor 2.23693629 to be used.

m/s multiplied by 2.23693629 = mph 

This is the rule I have created and that works very well for me:

rule "Calculate Wind in mph"
when
    Item Weatherstation_Wind_Speed changed
then
    logInfo("Weatherstation_mph.rules", "Rule execution started. Reason: Changed Item to Value of Weatherstation_Wind_Speed {}", Weatherstation_Wind_Speed.state) 
    Windspeed_mph.sendCommand((Weatherstation_Wind_Speed.state as Number) * 2.23693629)
end

Additional Information

OpenHAB is a fantastic free open source software framework that allows you to do amazing stuff with your home and beyond! To find out how to install OpenHAB (which is very simple) check out the How To Setup a New OpenHAB.

To find out more about the great OpenHAB project, check out the official project Website.

Follow me

It would be amazing if you follow my myhowto.blog. To my blog is actually easy! You can leverage on

  • Click to follow me on Twitter
  • Bookmark this page and comeback from time to time

Help and Comments

I am really looking forward for you to contact me if for example you found a better option or other idea then in this how to. Also, please touch base if you found an error or anything not working or if you have something that you would love to be added to the myhowto.blog. Simply click this link to touch base with me.

Linking Or Recommending The How To Or The myhowto.blog

I would love to see you are recommending this how to or link it to your website. Also, I would love if you link or recommend the whole myhowto.blog. Please feel free to do so! In case you like to touch base regarding this topic with me, then simply click this link. I look forward!