-- + lua / device script local sensorx = 'BME_280' --name of the sensor that has a problem with weather prediction (Temp+Hum+Baro virtual sensor), you put your sensor name commandArray = {} if (devicechanged[sensorx]) then WeatherTemp, WeatherHumidity, HumFeelsLike, WeatherPressure, WeatherPressureForecast = otherdevices_svalues[sensorx]:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)") WeatherTemp = tonumber(WeatherTemp) WeatherHumidity = tonumber(WeatherHumidity) HumFeelsLike = tonumber(HumFeelsLike) WeatherPressure = tonumber(WeatherPressure) -- hPa --SeaLevel = tonumber(WeatherPressure) SeaLevel = math.floor(WeatherPressure + 73.19) WeatherPressureForecast = tonumber(WeatherPressureForecast) if (SeaLevel == 0) then WeatherPressureForecast = 0 elseif (SeaLevel > 1030) then WeatherPressureForecast = 1 elseif ((SeaLevel > 1010) and (SeaLevel <= 1030)) then WeatherPressureForecast = 2 elseif ((SeaLevel > 990) and (SeaLevel <= 1010)) then WeatherPressureForecast = 3 elseif ((SeaLevel > 970) and (SeaLevel <= 990)) then WeatherPressureForecast = 4 end --[[ Forecast: 0 - No Info 1 - Sunny 2 - Partly Cloudy 3 - Cloudy 4 - Rain 5 - Unknown --]] commandArray['UpdateDevice'] = '16|0|' .. WeatherTemp ..';'.. WeatherHumidity ..';'.. HumFeelsLike ..';' .. SeaLevel.. ';'.. WeatherPressureForecast -- 16 is the idx of a virtual sensor that is going to be fixed, in this case it is the idx of the "ESP Outside" virtual sensor. You put your idx number end return commandArray