Ambient Weather Device

This is great!

one issue - nothing seems to be mapped to illuminance, so I can’t use it as an illuminance sensor in RM. other drivers seem to map the solar radiation to the illuminance value.

Fixed and uploaded to Github

One more upload. Added debug logging on/off. Confirmed that auto polling works.

1 Like

Working good, great job!

agreed! now i don’t have to rely on weather underground.

Deleted and Reinstalled and all is working well.. Thanks

Thank you so much. This is finally working for me. I really appreciate the effort.

Would it be possible to add a toggle switch for Celsius and km/hr ? My station also reports indoor temp and humidity from the sensor that provides barometric pressure. Not a critical reading because I have other devices that give that, but it's always nice to have that data for averaging in other apps.

The driver has been working fine, but just started getting this error below.

This is line 61 in the driver
temp = (weather.dewPoint - 35);

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 02:26:53.126 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 02:21:55.251 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 02:16:53.524 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 02:11:52.806 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 02:06:52.939 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 02:01:53.091 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 01:56:52.873 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 01:51:53.114 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 01:46:52.990 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 01:41:52.889 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 01:36:52.915 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 01:31:52.857 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 01:26:53.007 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 01:21:52.835 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 01:16:52.818 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 01:11:53.013 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 01:06:53.019 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 01:01:53.025 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 12:56:53.090 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 12:51:52.889 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 12:46:52.861 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 12:41:52.863 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 12:36:52.990 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 12:31:52.902 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 12:26:52.930 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 12:21:52.963 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 12:06:52.930 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 12:01:53.183 pm [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

[dev:2928](http://192.168.0.113/logs#dev2928)2019-03-25 10:06:52.920 am [error](http://192.168.0.113/device/edit/2928)java.lang.NullPointerException: Cannot invoke method minus() on null object on line 61 (setWeather)

I would respond to this but I am not going to because I will probably regret it. This forum sure has a lot of rude people!!!! If you don't like the way we do something or we are not doing it right then show or tell us the right way but you don't have to be rude about it.

1 Like

That was one of the many reasons I left Vera, because of a few in the forums, who would ALWAYS respond to any questions you posted because they narcissisticly believe they are brighter than reality, and almost always, rather than actually addressing what you posted they point you to irrelevant directions (especially if you are new and don't even know what they are talking about to begin with), or concerned about being the hall monitor of the forums.

FYI, to those who may fit into the category above.....You can just as easily TAG a developer using the @ (name) as you can criticizing those for not fitting into the proper placement of posts, or if this is to much, just don't respond at all, as the person having the problems is in the exact same spot without the frustrations you added to it.....

1 Like

You shouldn't quote my post to the developer referencing "I have no clue" when I'm not the one having any issues and my app is working fine, but merely trying to help the person who is having the issues..

People need to think before posting a new thread that can be dealt with in the original thread.

For those interested in this I added the attribute maxdailygust to the device driver.

metadata {
    definition(name: "Ambient Weather Device", namespace: "CordMaster", author: "Alden Howard") {
        capability "Temperature Measurement"
        capability "Relative Humidity Measurement"
        capability "Pressure Measurement"
        capability "Illuminance Measurement"
        capability "Refresh"
        capability "Sensor"
		capability "Actuator"
        
		//Current Conditions
        attribute "weather", "string"
        attribute "weatherIcon", "string"
        attribute "dewPoint", "number"
        attribute "comfort", "number"
        attribute "feelsLike", "number"
		attribute "pressure", "string"
		
		//Precipitation
        attribute "precip_today", "number"
		attribute "precip_1hr", "number"
		
        
		//Wind
		attribute "wind", "number"
        attribute "wind_gust", "number"
        attribute "maxdailygust", "number"
        attribute "wind_degree", "number"
        attribute "wind_dir", "string"
		attribute "wind_direction", "string"
		
		//Light
		attribute "solarradiation", "number"
        attribute "uv", "number"
    }
	preferences {
        section("Preferences") {
            input "showLogs", "bool", required: false, title: "Show Debug Logs?", defaultValue: false
        }
    }
}

def refresh() {
	parent.fetchNewWeather(); 
}

def setWeather(weather){
	logger("debug", "Weather: "+weather);
	
	//Set temperature
	sendEvent(name: "temperature", value: weather.tempf, unit: '°F', isStateChange: true);
	
	//Set Humidity
	sendEvent(name: "humidity", value: weather.humidity, unit: '%', isStateChange: true);
    
	//Set DewPoint
	sendEvent(name: "dewPoint", value: weather.dewPoint, unit:'°F', isStateChange: true);
	
	//Set Comfort Level 
	float temp = 0.0;
   
	temp = (weather.dewPoint - 35);
    if (temp <= 0) {
        temp = 0.0;
    } else if (temp >= 40.0) {
        temp = 100.0;
    } else {
        temp = (temp/40.0)*100.0;
    }
    temp = temp.round(1);
    sendEvent(name: "comfort", value: temp, isStateChange: true);
	
	//Set Barometric Pressure
	sendEvent(name: "pressure", value: weather.baromrelin, unit: 'in', isStateChange: true);
	
	//Set Feels Like Temperature
	sendEvent(name: "feelsLike", value: weather.feelsLike, unit: '°F', isStateChange: true);
    
    //Rain
	sendEvent(name: "precip_today", value: weather.dailyrainin, unit: 'in', isStateChange: true);  
	sendEvent(name: "precip_1hr", value: weather.hourlyrainin, unit: 'in', isStateChange: true); 
	
	//Wind
	sendEvent(name: "wind", value: weather.windspeedmph, unit: 'mph', isStateChange: true);
	sendEvent(name: "wind_gust", value: weather.windgustmph, unit: 'mph', isStateChange: true);
	sendEvent(name: "maxdailygust", value: weather.maxdailygust, unit: 'mph', isStateChange: true);
	sendEvent(name: "wind_degree", value: weather.winddir, unit: '°', isStateChange: true);
	
	temp = weather.winddir
	if (temp < 22.5) { 		sendEvent(name:  "wind_direction", value: "North", isStateChange: true);
					            sendEvent(name:  "wind_dir", value: "N", isStateChange: true);
	} else if (temp < 67.5) {  sendEvent(name:  "wind_direction", value: "Northeast", isStateChange: true);
					    		sendEvent(name:  "wind_dir", value: "NE", isStateChange: true);
	} else if (temp < 112.5) {  sendEvent(name: "wind_direction", value: "East", isStateChange: true);
					    		sendEvent(name:  "wind_dir", value: "E", isStateChange: true);
	} else if (temp < 157.5) {  sendEvent(name: "wind_direction", value: "Southeast", isStateChange: true);
					    		sendEvent(name:  "wind_dir", value: "SE", isStateChange: true);
	} else if (temp < 202.5) {  sendEvent(name: "wind_direction", value: "South", isStateChange: true);
					    		sendEvent(name:  "wind_dir", value: "S", isStateChange: true);
	} else if (temp < 247.5) {  sendEvent(name: "wind_direction", value: "Southwest", isStateChange: true);
					    		sendEvent(name:  "wind_dir", value: "SW", isStateChange: true);
	} else if (temp < 292.5) {  sendEvent(name: "wind_direction", value: "West", isStateChange: true);
					    		sendEvent(name:  "wind_dir", value: "W", isStateChange: true);
	} else if (temp < 337.5) {  sendEvent(name: "wind_direction", value: "Northwest", isStateChange: true);
					    		sendEvent(name:  "wind_dir", value: "NW", isStateChange: true);
	} else 					 {  sendEvent(name:  "wind_direction", value: "North", isStateChange: true);
					    		sendEvent(name:  "wind_dir", value: "N", isStateChange: true);
	}
	
	//UV and Light
	sendEvent(name: "solarradiation", value: weather.solarradiation, isStateChange: true);
	sendEvent(name: "illuminance", value: weather.solarradiation, isStateChange: true);
        sendEvent(name: "uv", value: weather.uv, isStateChange: true);
}

private logger(type, msg){
	 if(type && msg && settings?.showLogs) {
        log."${type}" "${msg}"
    }
}

I can add other attributes if you wish, this is the list the api spits out for me.

[
  {
    "macAddress": "84:F3:EB:21:92:2D",
    "lastData": {
      "dateutc": 1556933280000,
      "winddir": 196,
      "windspeedmph": 2,
      "windgustmph": 2.2,
      "maxdailygust": 10.3,
      "tempf": 65.5,
      "hourlyrainin": 0,
      "eventrainin": 0,
      "dailyrainin": 0,
      "weeklyrainin": 0,
      "monthlyrainin": 0,
      "totalrainin": 4.42,
      "baromrelin": 30.03,
      "baromabsin": 27.97,
      "humidity": 34,
      "tempinf": 70.3,
      "humidityin": 28,
      "uv": 0,
      "solarradiation": 61.17,
      "feelsLike": 65.5,
      "dewPoint": 36.38,
      "lastRain": "2019-04-26T16:37:00.000Z",
      "date": "2019-05-04T01:28:00.000Z"
    },
    "info": {
      "name": "Nettleton Weather Station",
      "location": "Home"
    }
  }
]```
1 Like

Indoor humidity please. I need a comparison humidity value for @Cobra 's Super Smart Fan, but don't want to add Ecobee back to my system. Everything's running so nicely now, I'd rather not introduce what I suspect to have been an issue previously.

Makes sense to also add indoor temp and barometric pressure since their on the same sensor unit, but humidity is really what I'm personally after.

Thank you so much for the offer.

Ok I added indoor temp/humidity. As for the indoor pressure I believe is device/software driven so it's not very accurate. Do you still want that ?

1 Like

I have added.....

  • indoor_temperature : 71.6
  • indoor_humidity : 30
  • indoor_pressure : 27.96
  • weekly_rain_in : 0
  • total_rain_in : 4.42
  • monthly_rain_in : 0
  • hourly_rain_in : 0
  • lastRain : 2019-04-26T16:37:00.000Z

Anything else ?

1 Like

That gets me exactly what I asked for. Thanks so much. :+1:t2: Appreciate the help.

Here you go.....

1 Like

I also created a pull request for @thomas.c.howard to merge my edits. Not sure if he will but at least the offer is there.

Glad I can help !

1 Like

It's not showing in the driver. Something I need to do? Refresh is giving an error in the log. I tried pasting over with the latest code. Will try fresh install.

dev:29282019-05-04 01:39:39.628 am errorjava.lang.IllegalArgumentException: null on line 54 (refresh)

dev:29282019-05-04 01:36:16.098 am errorjava.lang.IllegalArgumentException: null on line 54 (refresh)