[OBSOLETE] My very quick and dirty integration with myacurite / smart hub / ST / Webcore

Hello all, so it seems like for years people have looked to figure out a way to integrate the myacurite smarthub + smarthings - I decided to poke around and realized that their web portal spits back all the info I needed
I figure I would post this and I am sure there is enough tech savvy around to make this into either a native smartapp or in concert with webcore

I run this on a linux VM/Pi in house and send the results to a webcore piston

I think it should be clear that this is no way “hacking” or circumventing the security of myacurite, I am simply scraping their dashboard where they already have the relevent data in JSON

you will have to monitor your web traffic via a https parser of your choice to get your Hub’s URL for the sensor data below:

first you need your authentication token:

token=$(curl -s -H ‘Host: marapi.myacurite.com’ -H ‘Content-Type: application/json;charset=UTF-8’ -H ‘Origin: https://www.myacurite.com’ -H ‘Accept-Language: en-us’ -H ‘Accept: application/json’ -H ‘User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8’ -H ‘Referer: https://www.myacurite.com/’ -H ‘DNT: 1’ --data-binary ‘{“remember”:true,“email”:“XXXX Email Login for MY Acurite XXXX”,“password”:“xxxx your password xxxx”}’ --compressed ‘https://marapi.myacurite.com/users/login’ | jq . | grep token_id | awk -F":" ‘{print $2}’ | sed ‘s/"//g’ | sed ‘s/ //g’ | sed ‘s/,//g’)

the following dumps the current reading of all your sensors into as json into a variable called $sensors (be sure to find your accountID/HubID first):

sensors=$(curl -s -H ‘Host: marapi.myacurite.com’ -H ‘Accept: application/json’ -H “x-one-vue-token: $token” -H ‘Origin: https://www.myacurite.com’ -H ‘User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8’ -H ‘Referer: https://www.myacurite.com/’ -H ‘DNT: 1’ -H ‘Accept-Language: en-us’ --compressed ‘https://marapi.myacurite.com/accounts/XXXXXX/dashboard/hubs/XXXXXXX’)

the data looks like so:

“devices”: [
{
“id”: XXXXX,
“name”: “Small Bath”,
“model_code”: “2in1T”,
“placement_code”: “IN”,
“status_code”: “green”,
“battery_level”: “Normal”,
“signal_strength”: 3,
“last_check_in_at”: “2017-09-03T18:05:29.794+00:00”,
“timezone”: “America/New_York”,
“summary_files”: [
https://xxxxxx
],
“temp_high_value”: “71.5”,
“temp_high_at”: “12:25 AM”,
“temp_low_value”: “64.4”,
“temp_low_at”: “10:00 AM”,
“sensors”: [
{
“id”: XXXXX,
“sensor_code”: “Temperature”,
“sensor_name”: “Temperature”,
“last_reading_value”: “66.3”,
“channel”: 1,
“chart_unit”: “F”,
“show_tenths”: true
},
{
“id”: XXXXX,
“sensor_code”: “Humidity”,
“sensor_name”: “Humidity”,
“last_reading_value”: “70”,
“display_unit”: “%”,
“channel”: 2,
“chart_unit”: “%RH”
},
{
“id”: XXXXX,
“sensor_code”: “Dew Point”,
“sensor_name”: “Dew Point”,
“last_reading_value”: “56”,
“channel”: 3,
“chart_unit”: “F”
},
{
“id”: XXXXXX,
“sensor_code”: “Barometric Pressure”,
“sensor_name”: “Pressure”,
“last_reading_value”: “29.44”,
“channel”: 9,
“chart_unit”: “inHg”
}
],

each sensor comes back via json like so, the sensors are unique so you just need to find the room and value you are intersted in:
so for my various rooms:

dadBR=$(echo $sensors | jq . | grep -A 3 XXXXXX | grep last | awk -F":" ‘{print $2}’ | sed ‘s/"//g’ | sed ‘s/ //g’ | sed ‘s/,//g’)
LR=$(echo $sensors | jq . | grep -A 3 XXXXX | grep last | awk -F":" ‘{print $2}’ | sed ‘s/"//g’ | sed ‘s/ //g’ | sed ‘s/,//g’)
kitchen=$(echo $sensors | jq . | grep -A 3 XXXX | grep last | awk -F":" ‘{print $2}’ | sed ‘s/"//g’ | sed ‘s/ //g’ | sed ‘s/,//g’)
masterBR=$(echo $sensors | jq . | grep -A 3 XXXXX | grep last | awk -F":" ‘{print $2}’ | sed ‘s/"//g’ | sed ‘s/ //g’ | sed ‘s/,//g’)

send the results to a webcore piston:

curl -s “https://graph-na02-useast1.api.smartthings.com/api/token/XXXXXXXXXsmartapps/installations/XXXXXXXXX7/execute/:XXXXXXXXX:?dadBR=$dadBR&LR=$LR&kitchen=$kitchen&masterBR=$masterBR

with the piston below (dimmer should really be simulated temprature sensors)

2 Likes

It is giving an HTTP error 400 in header response for token request

Thanks! This is just the information I was looking for so I can extract and store my temperature readings from my newly purchased Acurite devices.

A few notes…

  1. if you could possibly re-format the code sections (token= and sensors= ) to use proper single and double quote marks instead of those stupid “smart” quotes that screw up the code, that would make copy & paste a lot easier without the need for a lot of editing.
  2. Similarly, if you could reformat the code sections to not include those random(?) numbers after each link or at least add a note that those numbers must be removed because they aren’t really supposed to be there, that would make it a lot less difficult to figure out why your code isn’t working.
  3. For finding my accountId and hubId values, I loaded my dashboard at My AcuRite and hit F12 to open the developer tools of the browser. Select the Network tab in the tools panel, then reload the page. Scroll down the left column to find an entry “hubs”, and in the right panel, select the “response” tab. This will show some code that includes the hub’s ID number and name. A little further down the left column is an entry named with the hub’s ID number; this one will show the account ID number in its data.

Once I figured out those 3 things, it all worked great. I appreciate the work you did in figuring this out.

Also, if you pipe the sensors data into jq, you can get the json data very nicely formatted.

Just a note: webcore will be phased out when ST stops support for groovy on its platform.

1 Like

Appreciate it, this was from 4 years ago so I don’t know how much has changed , I’ve been aggressively moving to hubitat

If there’s any interest, I built a Hubitat driver based on the info in this thread:

https://community.hubitat.com/t/release-acurite-weather-station/88484