Skip to content

Instantly share code, notes, and snippets.

@mdrovdahl
Created November 14, 2016 16:29
Show Gist options
  • Save mdrovdahl/5b2edc510439776ed02a2cb8221dbee5 to your computer and use it in GitHub Desktop.
Save mdrovdahl/5b2edc510439776ed02a2cb8221dbee5 to your computer and use it in GitHub Desktop.
Deconstructing the NeviWeb API
Warning, raw notes below...
Functions:
DEFINES
input("email", "text", title: "E-mail", description: "Your neviweb® account login e-mail")
input("password", "password", title: "Password", description: "Your neviweb® account login password")
input("gatewayname", "text", title: "Network Name:", description: "Name of your neviweb® network")
input("devicename", "text", title: "Device Name:", description: "Name of your neviweb® thermostat")
AUTH
isLoggedIn()
deviceId()
def login() {
data.server="https://neviweb.com/"
def params = [
uri: "${data.server}",
path: 'api/login',
requestContentType: "application/x-www-form-urlencoded; charset=UTF-8",
body: ["email": settings.email, "password": settings.password, "stayConnected": "0"]
]
httpPost(params)
def logout() {
def params = [
uri: "${data.server}",
path: "api/logout",
requestContentType: "application/x-www-form-urlencoded; charset=UTF-8",
headers: ['Session-Id' : data.auth.session]
]
httpGet(params)
HEATING
setHeatingSetpoint(newSetpoint , temperatureUnit)
heatingSetpointDown()
heatingSetpointUp()
DEVICE
def gatewayId(){
def params = [
uri: "${data.server}",
path: "api/gateway",
requestContentType: "application/json, text/javascript, */*; q=0.01",
headers: ['Session-Id' : data.auth.session]
]
httpGet(params)
DeviceData()
def params = [
uri: "${data.server}api/device/${data.deviceId}/data?force=1",
requestContentType: "application/x-www-form-urlencoded; charset=UTF-8",
headers: ['Session-Id' : data.auth.session]
]
to change the gateway mode you can POST to https://neviweb.com/api/gateway/{gateway1 id}/mode
Device is an array with each of the stats as an object:
0: Object
active: 1
family: "1120"
gatewayId: 463
id: 3345
mac: "00002B26"
model: 1120
name: "Boys Bedroom"
rfAddress: "0201"
rfParent: "0200"
type: 10
console.log(Device[463][0].name)
"463" is the Gateway
Page.getGatewayID()
Page.connectionStatus()
curl -s -H "Session-Id:aSJPIk1mg7GqJJIhOi09sVug1en1tBFcZSTh6pAd" https://neviweb.com/api/device/3345/data?force=0&_=1449466777076
{"setpoint":17.2,"temperature":19.7,"heatLevel":0,"mode":3,"alarm":0,"errorCode":null,"lastUpdate":"2015-12-07 05:54:35"}
MVP functionality
1. Login (get SessionID)
2. Get weather
3. Get list of thermostat ID's
4. For thermostat in thermostats, get ???
2. curl -s -H "Session-Id:aSJPIk1mg7GqJJIhOi09sVug1en1tBFcZSTh6pAd" https://neviweb.com/api/weather/98110
{"postalCode":"98110","latitude":null,"longitude":null,"temperature":10.2,"icon":"10n","condition":"500","cityOfRequest":"Bainbridge Island","dataTimestamp":"2015-12-07 05:18:00","lastUpdate":"2015-12-07 05:45:29"}
3. curl -s -H "Session-Id:aSJPIk1mg7GqJJIhOi09sVug1en1tBFcZSTh6pAd" https://neviweb.com/api/device?gatewayId=463&force=force
[{"id":3345,"gatewayId":463,"rfAddress":"0201","rfParent":"0200","mac":"00002B26","type":10,"model":1120,"family":"1120","name":"Boys Bedroom","active":1},{"id":3344,"gatewayId":463,"rfAddress":"0101","rfParent":"0100","mac":"00003B2D","type":10,"model":1120,"family":"1120","name":"Guest Bedroom","active":1},{"id":3347,"gatewayId":463,"rfAddress":"0100","rfParent":"0200","mac":"00003052","type":10,"model":1120,"family":"1120","name":"Master Bedroom","active":1},{"id":3346,"gatewayId":463,"rfAddress":"0200","rfParent":"0000","mac":"000022FD","type":10,"model":1120,"family":"1120","name":"Mattea Bedroom","active":1},{"id":4908,"gatewayId":463,"rfAddress":"0102","rfParent":"0100","mac":"000022EB","type":10,"model":1120,"family":"1120","name":"Mudroom","active":1},{"id":3343,"gatewayId":463,"rfAddress":"0202","rfParent":"0200","mac":"000010CA","type":10,"model":1120,"family":"1120","name":"Play Room","active":1}]
4. tbd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment