Apixu.com worldwide weather data with outside lux. No PWS or server setup

community_driver

#255

that code is from @arnb so not in my github but in this post:

you are welcome.


#256

This is what I am curently using

def mytext =obs.location.name + ', ' + obs.location.region
if (isFahrenheit)
	{
	mytext+='<br>' + "${Math.round(obs.current.temp_f)}" + '&deg;F ' + obs.current.humidity + '%'
	mytext+='<br>' + localSunrise + ' <img style="height:1em" src=https:' + obs.current.condition.icon + '> ' + localSunset
	if (wind == "0 mph ")
		mytext+='<br> Wind is calm'
	else
		mytext+='<br>' + obs.current.wind_dir + ' ' + wind
	mytext+='<br>' + obs.current.condition.text
	}
else
	{
	mytext+='<br>' + obs.current.temp_c + '&deg;C ' + obs.current.humidity + '%'
	mytext+='<br>' + localSunrise + ' <img style="height:1.5em" src=https:' + obs.current.condition.icon + '> ' + localSunset
	if (wind == "0 kph ")
		mytext+='<br> Wind is calm'
	else
		mytext+='<br>' + obs.current.wind_dir + ' ' + wind
	mytext+='<br>' + obs.current.condition.text
	}

sendEvent(name: "mytile", value: mytext, isStateChange: true, displayed: true)

Also adjusted wind to round as follows (sorry i cant get it nicely formatted)

// sendEvent(name: "wind", value: (isFahrenheit ? obs.current.wind_mph : obs.current.wind_kph), unit: "${(isFahrenheit ? 'MPH' : 'KPH')}", isStateChange: true, displayed: true)

def wind=(isFahrenheit ? "${Math.round(obs.current.wind_mph)}" + " mph " : "${Math.round(obs.current.wind_kph)}" + " kph ")

sendEvent(name: "wind", value: wind, isStateChange: true, displayed: true)


#257

Excuse me but do you know if ‘Water temperature’ is made available in the weather data ?
It be great to have my local sea temp available :kissing_closed_eyes:


#258

dont think it does. you can check the data returned here:

https://www.apixu.com/doc/current.aspx
https://www.apixu.com/doc/forecast.aspx

if there is a piece of data that you need but the driver does not return it … just ping me.


#259

Yes, I think you’re right. I cannot find any reference to Water or Marine temperatures.

That would have been ‘the icing on the cake’


#260

hope you enjoy healthy cake :slight_smile:


#261

I enjoy ALL cake :birthday: :cake:


#262

Thanks @bangali. I will follow-up with @arnb as I'm still not understanding how to set-up mytile


#263

I'm new to home automation and setting up things in Hubitat and also confused how to set-up the mytile. Can you or @arnb please provide steps how to set this tile up in Hubitat. I've got @bangali code installed bangali/apixu-weather.groovy at master · adey/bangali · GitHub and it works great but I really like the Dashboard tile that "mytile" has but can't figure out where to get all the code and where to place it. Greatly appreciate any help you can provide.


#264

Hello @bangali
I submitted a Github Pull Request that combines the "Mytile" code with the latest version of your Apixu code. If you are OK merging the Pull Request to the your apixu driver, I feel that would make it easier for other users looking to use mytile on their dashboards.

Thank You
Arn B


#265

This device sends a lot of unnecessary events to apps.

I have sent a pull request for this.

It also is missing definitions for items. I like this device, but it is current running and causing other things on HE to run to much...


#266

@arnb merged. thank you for the PR.

made some formatting changes for future easier maintenance but its all your code. :slight_smile:


#267

if isStateChange:true is not part of the send event … do any apps subscribed to that attribute get notified of the event?

not sure what you mean … which items are missing definitions?


#268

sendEvent will automatically only notify if the variable changed. forcing isStateChange forces notifications even when nothing changed (and forces the DB to store more values for events).

I'll send another pull request for all the overhead I have fixed. The above is the biggest hog of resources needlessly.


#269

ok. happy to merge the PR if isStateChange:true is unnecessary. though this would actually use resources if another app was subscribed to all of the events published by the driver?

what was the missing definitions?


#270

@arnb + @bangali
Merging the work you've both done will be awesome.
Thank you, thank you.


#271

the merged version is already on github :slight_smile:


#272

and now it's loaded, configured and running in Sydney, Australia. :+1:

Cheers guys.


#273

Thank you for the driver and MyTile.

I think in MyTile it's better to change obs.location.name to (cityName ?: obs.location.name) so it can be overridden in case actual city it's not correct (like mine).


#274

the mytile should be using the attribute "city"