[SOLVED] Open Weather Map Current Temp?

Hello,

My Yahoo Weather quit working so I switched to Open Weather Map which is up and running.
I am using the following:
Raspberry Pi with the latest 2.4 openHabian snapshot.

The issue I’m having is my R_Heater switch is not responding to the OutdoorTemp change using Open Weather Map but it worked with Yahoo Weather? Now no matter if the temperature changes R_Heaters is turned off.

Number:Temperature OutdoorTemp "Outside Temperature"  {channel="openweathermap:weather-and-forecast:XXXXXXX:local:current#temperature"}

Switch R_Heaters "Roof Heaters" ["lighting"] {channel="zwave:device:41ac03b3:node43:switch_binary"}

rule "Roof Heaters Snow and Ice"
    when
        Item OutdoorTemp changed    
    then
        if ((OutdoorTemp.state >= 15) && (OutdoorTemp.state <= 35)) {
           R_Heaters.sendCommand(ON)   
    }
      else
          R_Heaters.sendCommand(OFF) 
end 

end
I modified the code as shown below thinking that "Temperature:Number is not being read by openhab as a number so I added “var ost”

rule "Roof Heaters Snow and Ice"
    when
        Item OutdoorTemp changed    
    then
        var Number ost = OutdoorTemp.state as Number
        if ((ost >= 15) && (ost <= 35)) {
           R_Heaters.sendCommand(ON)   
    }
      else
          R_Heaters.sendCommand(OFF) 
end 

Log displays the following:

2019-01-13 17:56:45.098 [vent.ItemStateChangedEvent] - openweathermap_weather_and_forecast_xxxxxxxxxx_local_current_time_stamp changed from 2019-01-13T17:15:00.000-0600 to 2019-01-13T17:35:00.000-0600

2019-01-13 17:56:45.123 [vent.ItemStateChangedEvent] - OutdoorTemp changed from 26.654 °F to 26.564 °F

2019-01-13 17:56:45.153 [vent.ItemStateChangedEvent] - PressurePSI changed from 30.35682857368972486318756149620185 inHg to 30.38635856257463704690661554434991 inHg

2019-01-13 17:56:45.158 [vent.ItemStateChangedEvent] - Humidity changed from 66 % to 76 %

2019-01-13 17:56:45.163 [vent.ItemStateChangedEvent] - openweathermap_weather_and_forecast_xxxxxxxxxx_local_current_wind_speed changed from 3.355401753760200243080410403245049 mph to 6.934496957771080502366181500039768 mph

2019-01-13 17:56:45.181 [vent.ItemStateChangedEvent] - zwave_serial_zstick_41ac03b3_serial_sof changed from 896132 to 896133

2019-01-13 17:56:45.189 [ome.event.ItemCommandEvent] - Item 'R_Heaters' received command OFF

2019-01-13 17:56:45.222 [vent.ItemStateChangedEvent] - openweathermap_weather_and_forecast_xxxxxxxxxx_local_forecastHours03_temperature changed from 23.378 °F to 23.306 °F

2019-01-13 17:56:45.229 [nt.ItemStatePredictedEvent] - R_Heaters predicted to become OFF

Any Ideas will be appreciated!

Thanks,
Mike

rossko57 needs a hug!
Thank you so much for the link!!!

2019-01-13 19:16:52.438 [vent.ItemStateChangedEvent] - OutdoorTemp changed from 23.36 °F to 22.46 °F

2019-01-13 19:16:52.448 [vent.ItemStateChangedEvent] - PressurePSI changed from 30.38635856257463704690661554434991 inHg to 30.35682857368972486318756149620185 inHg

2019-01-13 19:16:52.459 [vent.ItemStateChangedEvent] - Humidity changed from 73 % to 87 %

2019-01-13 19:16:52.523 [ome.event.ItemCommandEvent] - Item 'R_Heaters' received command ON

2019-01-13 19:16:52.647 [nt.ItemStatePredictedEvent] - R_Heaters predicted to become ON

2019-01-13 19:16:52.674 [vent.ItemStateChangedEvent] - openweathermap_weather_and_forecast_xxxxxxx_local_forecastHours03_temperature changed from 15.206 °F to 14.486 °F

2019-01-13 19:16:52.678 [vent.ItemStateChangedEvent] - R_Heaters changed from OFF to ON

Here is my code change:

rule "Roof Heaters Snow and Ice"
    when
        Item OutdoorTemp changed    
    then
        var Number ost = (OutdoorTemp.state as QuantityType<Number>).doubleValue
        if ((ost >= 15) && (ost <= 35)) {
           R_Heaters.sendCommand(ON)   
    }
      else { R_Heaters.sendCommand(OFF)
      }
end 

Thank you very much!
Mike

Seems a clumsy thing to me, but it works which is the important part :slight_smile:

1 Like