SiteSensor for Shelly Interrogation

I am trying to extract the power and total values form a shelly PM1. I tried to set up a site sensor (1.15) in my vera plus to extract the “power” and “total”:

I get the following response from my web browser:

http://192.168.68.117/status/meters

I get the following message from SiteSensor:

13:42:32: SiteSensor: Requesting JSON data
13:42:32: SiteSensor: “GET” “http://192.168.68.117/status”, headers={ }
13:42:32: SiteSensor: Response is 1042 bytes in “/tmp/Q_SiteSensor_1010.txt”
13:42:32: SiteSensor: Failed to execute "meters[1].power"', { location=9, ["__source"]="luaxp", message="Undefined variable: meters", type="evaluation" } 13:42:32: SiteSensor: Eval #1: "meters[1].power"=(nil)nil 13:42:32: SiteSensor: Failed to execute “power”’, { location=6, ["__source"]=“luaxp”, message=“Undefined variable: power”, type=“evaluation” }
13:42:32: SiteSensor: Eval #2: “power”=(nil)nil

Can SiteSensor be used in this application and if so what is the correct syntax for the value expression?

Your expression doesn’t start with response., so that’s clearly a problem right from the start. Unfortunately, I can’t help you from there because you’ve posted a screen shot of the response data instead of the actual text, so I can’t copy-paste it into tools that would help make it more human readable.

Please find below the text for the web response (http://192.168.68.117/status/meters):

{"wifi_sta":{"connected":true,"ssid":"TP-LINK_1242","ip":"192.168.68.117","rssi":-68},"cloud":{"enabled":true,"connected":true},"mqtt":{"connected":false},"time":"08:59","unixtime":1636275556,"serial":252,"has_update":false,"mac":"E8DB84D76D55","cfg_changed_cnt":1,"actions_stats":{"skipped":0},"relays":[{"ison":true,"has_timer":false,"timer_started":0,"timer_duration":0,"timer_remaining":0,"overpower":false,"source":"input"}],"meters":[{"power":133.34,"overpower":0.00,"is_valid":true,"timestamp":1636275556,"counters":[118.257, 118.235, 118.232],"total":1221}],"inputs":[{"input":0,"event":"","event_cnt":0}],"temperature":42.68,"overtemperature":false,"tmp":{"tC":42.68,"tF":108.82, "is_valid":true},"temperature_status":"Normal","ext_sensors":{},"ext_temperature":{},"ext_humidity":{},"update":{"status":"idle","has_update":false,"new_version":"20210909-145919/v1.11.4-DNSfix-ge6b2f6d","old_version":"20210909-145919/v1.11.4-DNSfix-ge6b2f6d"},"ram_total":50464,"ram_free":37220,"fs_size":233681,"fs_free":148090,"uptime":609}

I’ll take another look at the SiteSensor documentation to see if I can get closer with the syntax. Thanks.

Looks like response.meters[1].power may be what you’re looking for.

Here’s the output formatted for human-readability (via jsonlint.com):

{
	"wifi_sta": {
		"connected ": true,
		"ssid": "TP - LINK_1242",
		"ip": "192.168 .68 .117",
		"rssi": -68
	},
	"cloud": {
		"enabled ": true,
		"connected": true
	},
	"mqtt": {
		"connected ": false
	},
	"time": "08: 59",
	"unixtime": 1636275556,
	"serial": 252,
	"has_update": false,
	"mac": "E8DB84D76D55",
	"cfg_changed_cnt": 1,
	"actions_stats": {
		"skipped ": 0
	},
	"relays": [{
		"ison ": true,
		"has_timer": false,
		"timer_started": 0,
		"timer_duration": 0,
		"timer_remaining": 0,
		"overpower": false,
		"source": "input"
	}],
	"meters": [{
		"power ": 133.34,
		"overpower": 0.00,
		"is_valid": true,
		"timestamp": 1636275556,
		"counters": [118.257, 118.235, 118.232],
		"total": 1221
	}],
	"inputs": [{
		"input ": 0,
		"event": "",
		"event_cnt": 0
	}],
	"temperature": 42.68,
	"overtemperature": false,
	"tmp": {
		"tC ": 42.68,
		"tF": 108.82,
		"is_valid": true
	},
	"temperature_status": "Normal",
	"ext_sensors": {},
	"ext_temperature": {},
	"ext_humidity": {},
	"update": {
		"status ": "idle ",
		"has_update": false,
		"new_version": "20210909 - 145919 / v1 .11 .4 - DNSfix - ge6b2f6d",
		"old_version": "20210909 - 145919 / v1 .11 .4 - DNSfix - ge6b2f6d"
	},
	"ram_total": 50464,
	"ram_free": 37220,
	"fs_size": 233681,
	"fs_free": 148090,
	"uptime": 609
}
1 Like

Best Home Automation shopping experience. Shop at getvera!

© 2021 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules