Thanks for your efforts @del13r - I’ve used your code example and I also have setup sensors using the production.json file. Your help was invaluable so thanks again! I changed the frequency the file is read by including
scan_interval: 1
Also thanks for the link to the RESTful sensor - I’ve spent a few hours and have been able to access the password protected installer .json however I have come across an issue I don’t know how to fix - the json data coming from that installer json isn’t 100% formatted correctly as json - this is what comes out - note it’s missing the start and end { } and the word data isn’t enclosed in quotes "
data: {"production":{"ph-a":{"p":3621.602,"q":305.704,"s":3627.168,"v":248.652,"i":14.582,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"net-consumption":{"ph-a":{"p":-3195.826,"q":-686.842,"s":3277.01,"v":248.674,"i":13.17,"pf":-0.98,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"total-consumption":{"ph-a":{"p":425.776,"q":-992.546,"s":351.08,"v":248.663,"i":1.412,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}}}
It should look like this:
{"data":{"production":{"ph-a":{"p":3621.602,"q":305.704,"s":3627.168,"v":248.652,"i":14.582,"pf":1,"f":50},"ph-b":{"p":0,"q":0,"s":0,"v":0,"i":0,"pf":0,"f":0},"ph-c":{"p":0,"q":0,"s":0,"v":0,"i":0,"pf":0,"f":0}},"net-consumption":{"ph-a":{"p":-3195.826,"q":-686.842,"s":3277.01,"v":248.674,"i":13.17,"pf":-0.98,"f":50},"ph-b":{"p":0,"q":0,"s":0,"v":0,"i":0,"pf":0,"f":0},"ph-c":{"p":0,"q":0,"s":0,"v":0,"i":0,"pf":0,"f":0}},"total-consumption":{"ph-a":{"p":425.776,"q":-992.546,"s":351.08,"v":248.663,"i":1.412,"pf":1,"f":50},"ph-b":{"p":0,"q":0,"s":0,"v":0,"i":0,"pf":0,"f":0},"ph-c":{"p":0,"q":0,"s":0,"v":0,"i":0,"pf":0,"f":0}}}}
Which then formats correctly as:
{
"data": {
"production": {
"ph-a": {
"p": 3621.602,
"q": 305.704,
"s": 3627.168,
"v": 248.652,
"i": 14.582,
"pf": 1,
"f": 50
},
"ph-b": {
"p": 0,
"q": 0,
"s": 0,
"v": 0,
"i": 0,
"pf": 0,
"f": 0
},
"ph-c": {
"p": 0,
"q": 0,
"s": 0,
"v": 0,
"i": 0,
"pf": 0,
"f": 0
}
},
"net-consumption": {
"ph-a": {
"p": -3195.826,
"q": -686.842,
"s": 3277.01,
"v": 248.674,
"i": 13.17,
"pf": -0.98,
"f": 50
},
"ph-b": {
"p": 0,
"q": 0,
"s": 0,
"v": 0,
"i": 0,
"pf": 0,
"f": 0
},
"ph-c": {
"p": 0,
"q": 0,
"s": 0,
"v": 0,
"i": 0,
"pf": 0,
"f": 0
}
},
"total-consumption": {
"ph-a": {
"p": 425.776,
"q": -992.546,
"s": 351.08,
"v": 248.663,
"i": 1.412,
"pf": 1,
"f": 50
},
"ph-b": {
"p": 0,
"q": 0,
"s": 0,
"v": 0,
"i": 0,
"pf": 0,
"f": 0
},
"ph-c": {
"p": 0,
"q": 0,
"s": 0,
"v": 0,
"i": 0,
"pf": 0,
"f": 0
}
}
}
}
My level of skills on Home Assistant are quite low - I know how to fix this in php or in a bash script but I’m struggling on how to fix it in Home Assistant - would I use a value template or something else?
Cheers