Closed jghaanstra closed 3 years ago
Got it from a user of my app that already has the Shelly Uni. I just received the output for CoAP as well. Have not checked yet if it matches my eduacated guesses based on the REST API.
[{
3332 SHUNI - 1 #10521CF9919E# 2
}]
}
{
"blk": [{
"I": 1,
"D": "relay_0"
}, {
"I": 2,
"D": "relay_1"
}, {
"I": 3,
"D": "adc_0"
}, {
"I": 4,
"D": "sensor_0"
}, {
"I": 5,
"D": "sensor_1"
}, {
"I": 6,
"D": "sensor_2"
}, {
"I": 7,
"D": "sensor_3"
}, {
"I": 8,
"D": "sensor_4"
}, {
"I": 9,
"D": "device"
}],
"sen": [{
"I": 9103,
"T": "EVC",
"D": "cfgChanged",
"R": "U16",
"L": 9
}, {
"I": 1101,
"T": "S",
"D": "output",
"R": "0/1",
"L": 1
}, {
"I": 1201,
"T": "S",
"D": "output",
"R": "0/1",
"L": 2
}, {
"I": 2101,
"T": "S",
"D": "input",
"R": "0/1",
"L": 1
}, {
"I": 2102,
"T": "EV",
"D": "inputEvent",
"R": ["S/L", ""],
"L": 1
}, {
"I": 2103,
"T": "EVC",
"D": "inputEventCnt",
"R": "U16",
"L": 1
}, {
"I": 2201,
"T": "S",
"D": "input",
"R": "0/1",
"L": 2
}, {
"I": 2202,
"T": "EV",
"D": "inputEvent",
"R": ["S/L", ""],
"L": 2
}, {
"I": 2203,
"T": "EVC",
"D": "inputEventCnt",
"R": "U16",
"L": 2
}, {
"I": 3118,
"T": "V",
"D": "adc",
"U": "V",
"R": ["0/30", "-1"],
"L": 3
}, {
"I": 3101,
"T": "T",
"D": "extTemp",
"U": "C",
"R": ["-55/125", "999"],
"L": 4
}, {
"I": 3201,
"T": "T",
"D": "extTemp",
"U": "C",
"R": ["-55/125", "999"],
"L": 5
}, {
"I": 3301,
"T": "T",
"D": "extTemp",
"U": "C",
"R": ["-55/125", "999"],
"L": 6
}, {
"I": 3401,
"T": "T",
"D": "extTemp",
"U": "C",
"R": ["-55/125", "999"],
"L": 7
}, {
"I": 3501,
"T": "T",
"D": "extTemp",
"U": "C",
"R": ["-55/125", "999"],
"L": 8
}, {
"I": 3103,
"T": "H",
"D": "humidity",
"R": ["0/100", "999"],
"L": 4
}]
}
{
"G": [
[0, 9103, 0],
[0, 1101, 0],
[0, 1201, 0],
[0, 2101, 0],
[0, 2102, ""],
[0, 2103, 0],
[0, 2201, 0],
[0, 2202, ""],
[0, 2203, 0],
[0, 3118, 0.06]
]
}
Ok, seems to match well. Two additional external temperature values and a property called "adc", not sure what that is.
Looking at the REST API output adc
is a voltage measure.
"UNI Sta": {
"wifi_sta": {
"connected": true,
"ssid": "ssid",
"ip": "192.168.1.22",
"rssi": -40
},
"cloud": {
"enabled": true,
"connected": true
},
"mqtt": { "connected": false },
"time": "18:00",
"unixtime": 1602957632,
"serial": 18,
"has_update": true,
"mac": "10xxxxxA",
"cfg_changed_cnt": 13,
"actions_stats": { "skipped": 0 },
"relays": [
{
"ison": false,
"has_timer": false,
"timer_started": 0,
"timer_duration": 0,
"timer_remaining": 0,
"source": "http"
},
{
"ison": false,
"has_timer": false,
"timer_started": 0,
"timer_duration": 0,
"timer_remaining": 0,
"source": "http"
}
],
"inputs": [
{ "input": 0 },
{ "input": 0 }
],
"adcs": [ { "voltage": 0.00 } ],
"ext_sensors": {},
"ext_temperature": {},
"ext_humidity": {},
"update": {
"status": "pending",
"has_update": true,
"new_version": "20200812-092537/v1.8.0@8acf41b0",
"old_version": "20200826-111450/1206-production-ShellyUNI@a80ee1fc+"
},
"ram_total": 49928,
"ram_free": 36388,
"fs_size": 233681,
"fs_free": 143321,
"uptime": 4511
}
Ok! Would you like to add these other properties to the PR?
I added the extra properties to the best of my knowledge (amateur developer here). But I dont know what the first number of the array in the second parameter of a property means. This is only added for some properties. I did not add them for the newly added properties but you might wanna check that. If you could explain what it does I can fix the PR if needed.
I fixed a mistake for the Shelly Uni and added support for the Shelly 1L. Below is a link where you can find information about this new (and currently unreleased) device.
I'd appreciate if you could answer my previous question about the first number of the array in the second parameter of a property. What is it for (and did I add it correctly for the Shelly Uni and Shelly 1L)?
Thanks @jghaanstra. The additional property numbers are for firmware versions older than 1.8.0. Since these devices are probably not supported by older firmware versions, that doesn't really matter here.
Thanks @jghaanstra. The additional property numbers are for firmware versions older than 1.8.0. Since these devices are probably not supported by older firmware versions, that doesn't really matter here.
Ok clear. I removed them for the Shelly Uni and Shelly 1L as these devices are indeed not supported on lower firmwares. I hope I fixed all issues now. Bare with me.
Looks good! I just merged your changes now. Will release them soon.
This PR adds support for the Shelly Uni. I dont own the device myself but used the JSON output from the REST API to put it together.