Seemed pretty wasteful to keep my EC2 instance running 24/7 just to execute every hour, and assuming it's still needed after my year of free tier runs out, don't care to pay $4/month estimated cost.
There are probably other ways to cut the cost, but I managed to get login.py running as an AWS Lamda function with a couple modifications (uses EventBridge to trigger every hour):
import pyemvue
import json
import requests
import osdef lambda_handler(event, context):
os.chdir('/tmp')
vue = pyemvue.PyEmVue()
#create the auth token and store it in keys.json
auth = vue.login(username='xxxxxx', password='xxxxxx', token_storage_file='keys.json')
#retrieve the auth_token from keys.json
with open('keys.json')as f:
data = json.load(f)
#pass token to hubitat via Maker API
token_id = data['id_token']
requests.get("https://cloud.hubitat.com/api/xxxxxxxxxxxxx/apps/###/devices/###/authToken/{}?access_token=yyyyyyyyyyyyyyyy".format(token_id))
Used this tutorial to install pyemview as a layer:
Should be very cheap, to keep this running after free tier runs out, but haven't estimated cost yet.
Sorry to keep spamming your thread with this, in case no one else finds it useful. I do hope someone figures out how to do this in Groovy, or with WebCore/Rules.