richardeid
Regular Contributor
I've spent way too long on this now. I have a thermostat. It's a Radio Thermostat CT80. I like it.
I recently decided to finally take the plunge and use Merlin firmware on my AC88U. I'm on the latest, 380.66_2. I wanted to do this because I decided to finally take a dive into the API of this thermostat so I could accomplish at a minimum, this. And maybe after a while some other fun things. I'm really a novice at scripting so I'm having some trouble taking care of this. I think I've done what I needed, but clearly not.
Initially I installed Merlin to start using Transmission, so I have entware.ng installed. According to the second link I needed to also install curl and jq (luckily that was there). So I did that. I also needed to register to use the Weather Underground API, did that. And now I'm at a weird point.
I have always heard it's better to type out the code you're going to be using instead of copy/pasting it. That's what I did with this, and just to be sure I used Notepad++ to compare it. I made a lot of mistakes copying the code initially but I think I figured out most of it now. Or not...or something. Here's my current code for those two script files. This is a direct copy/paste:
OK so I obviously removed my API key. The zmw:XXXXX is where my zip code would go. And the pws:XXXXXXXXX is the weather station closest to my house. I've also assigned 192.168.1.3 as a static IP to that thermostat and I verified it by using the API to return some info to me through my browser. Currently, with all the "right" info in place, my thermostat display looks like this:
I've tinkered with both files for longer than I've wanted to and I think I'm ready to ask for help. The API for the thermostat and can be accessed here. The relevant bit relating to what I'm attempting is on the page numbered 8 within the PDF. The Wunderground API is here. Specifically this section and this section.
I feel like I'm right there but just don't have the knowledge to get myself the rest of the way. And at this point even if I did I wouldn't know why or how I did it because I'm pretty much playing hunt and peck with the code. Maybe one of you fine people can show me where I've gone astray.
Thanks for taking the time to read. I know this isn't a Merlin issue; It's more of a scripting issue.
I recently decided to finally take the plunge and use Merlin firmware on my AC88U. I'm on the latest, 380.66_2. I wanted to do this because I decided to finally take a dive into the API of this thermostat so I could accomplish at a minimum, this. And maybe after a while some other fun things. I'm really a novice at scripting so I'm having some trouble taking care of this. I think I've done what I needed, but clearly not.
Initially I installed Merlin to start using Transmission, so I have entware.ng installed. According to the second link I needed to also install curl and jq (luckily that was there). So I did that. I also needed to register to use the Weather Underground API, did that. And now I'm at a weird point.
I have always heard it's better to type out the code you're going to be using instead of copy/pasting it. That's what I did with this, and just to be sure I used Notepad++ to compare it. I made a lot of mistakes copying the code initially but I think I figured out most of it now. Or not...or something. Here's my current code for those two script files. This is a direct copy/paste:
Code:
#/bin/sh
/opt/bin/curl -o /tmp/cur-conditions.json http://api.wunderground.com/api/XXXAPIKEYXXX/conditions/q/zmw:XXXXX.0.99999.json
/opt/bin/curl -d \{\"line\"\:0,\"message\":\"\Outdoor\ Temp:\ 'cat /tmp/cur-conditions.json | jq -r .current_observation.temp_f'\ RH:\ 'cat /tmp/cur-conditions.json | jq -r .current_observation.relative_humidity'\"\} http://192.168.1.3/tstat/uma
Code:
#/bin/sh
/opt/bin/curl -o /tmp/cur-forcast.json http://api.wunderground.com/api/XXXAPIKEYXXX/forecast/q/pws:XXXXXXXXXX.json
/opt/bin/curl -d \{\"line\"\:1,\"message\":\"\Today\ Hi:'cat /tmp/cur-forcast.json | jq -r .forecast.simpleforecast.forecastday[1].high.fahrenheit'\ Lo:'cat /tmp/cur-forcast.json | jq -r .forecast.simpleforecast.forecastday[1].low.fahrenheit'\ POP:'cat /tmp/cur-forcast.json | jq -r .forecast.simpleforecast.forecastday[1].pop'\%\"\} http://192.168.1.3/tstat/uma
I've tinkered with both files for longer than I've wanted to and I think I'm ready to ask for help. The API for the thermostat and can be accessed here. The relevant bit relating to what I'm attempting is on the page numbered 8 within the PDF. The Wunderground API is here. Specifically this section and this section.
I feel like I'm right there but just don't have the knowledge to get myself the rest of the way. And at this point even if I did I wouldn't know why or how I did it because I'm pretty much playing hunt and peck with the code. Maybe one of you fine people can show me where I've gone astray.
Thanks for taking the time to read. I know this isn't a Merlin issue; It's more of a scripting issue.
Last edited: