Time & Temp Announcer Script

Start simple.

Try dialplan. If you can figure out the string manipulation, yay. It’s a great learning exercise, success or failure.

If dialplan gets too cumbersome, try a shell script. Another great learning exercise.

I wouldn’t suggest an AGI until you get more Asterisk experience.

If you get stuck, show your work and a log of where it breaks. If you include any dialplan snippets show what Asterisk thinks your dialplan is ('dialplan show <context-name>') instead of snippets copied from extensions.conf. No screen shots :slight_smile: Remember to wrap all snippets in pre-formatted text tags so the forum doesn’t eat special characters and formatting.

I don’t think you should be using that API Key. I think you should be using your own personal API key.

I also don’t understand the business model of the wttr.in site, and there is no IPR statement of any kind on the site, so I’d be wary of using that one.

Would this script work to get the temp?

;temperature.pl
curl -s ‘http://api.openweathermap.org/data/2.5/weather?zip=10001,&appid=21d1e5750e1026ff244a103630da8ad9&units=imperial’ | awk -F’temp_f data="’ ‘{ print $2 }’ | awk -F’"/> /tmp/temp.txt

I don’t know. What happens when you tried it?

You need to use preformatted text tags (the ‘</>’ thing in the icon bar when you enter a reply). Your snippet changed single quotes to whatever those funky quotes are called.

What does ‘;temperature.pl’ have to do with this?

What does 'awk -F’temp_f data="’ ‘{ print $2 }’' do?

What does 'awk -F’"/’ do?

It looks like you’re cutting and pasting random bits from other scripts without understanding what they do. If you stumble across something like rm --farce / please don’t do it.

The terms of use of most websites will forbid this. Even openweathermap has terms that forbid it when using their website, rather than their API.

Agreed. Although we don’t have clarity on whether this is a personal toy or a business enterprise.

same=n,Set(temp=${CURL(wttr.in?format=“%t”)})

Is this correct?

same=n,Set(temp=${CURL(api.openweathermap.org/data/2.5/weather?zip=10001,&appid=21d1e5750e1026ff244a103630da8ad9&units=imperial?format="%t")})

What happens when you run it?

What does the console log show? (Remember to set verbose and debug to something greater than 2 and wrap the snippet in preformatted text tags.)

What does Asterisk think that line looks like? (dialplan show <context-name> and wrap in preformatted tags.)

It seems that the OP has asked this on the FreePBX forum, as well: Time & Temp Announcer Script - Development - FreePBX Community Forums

And 3cx.com and sundance-communications.com and classicrotaryphones.com and … although the last 2 were looking to purchase an appliance.

“Not that there’s anything wrong with that…” :slight_smile:

A commercial offering, the Viking DVA-TNT, looks to be in the US$350 to $500 range. Wow.

A RaspberryPi ZeroW is only $10 ($30ish with case and wall wart – although who doesn’t have a box of phone charger blocks and micro-usb cables) and would be way more ‘featureful.’

Just in case anybody’s interested…

A RaspberryPi ZeroW handles 10 channels playing ‘demo-congrats’ in a loop yielding mid 80% CPU busy.

Seems weird to call an Asterisk server that isn’t connected to anything :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.