Uner ENERGY, the current Watt which devices connected use, is shown under “Power”. The value is shown as [x,y] where x and y are the watt for each relay on the device.
How should my channel look like to grab the “x” and the “y” values - meaning the watt for relay1 (in the JSON example it would be = 32 and 0 respectively) ?
Type number : watt_x [
stateTopic="tele/shelly25_1/SENSOR",
transformationPattern="REGEX:(.*\"Power\".*)∩JSONPATH:$.ENERGY.Power"
]
Type number : watt_y [
stateTopic="tele/shelly25_1/SENSOR",
transformationPattern="REGEX:(.*\"Power\".*)∩JSONPATH:$.ENERGY.Power"
]
Thanks a lot @rlkoshak !!
You are absolutely correct; I dont need the REGEX. I honestly believe I copied it into my Tasmota definitions from an example sometime and never thought too much about it as it worked Probably never got around to understand why.
Your JSON example was exactly what I needed. I just didnt know about the reference array values…
Here is the working example of channels:
{
Channels:
Type switch : switch1 [
stateTopic="stat/shelly25_1/POWER1",
commandTopic="cmnd/shelly25_1/POWER1"
]
Type switch : switch2 [
stateTopic="stat/shelly25_1/POWER2",
commandTopic="cmnd/shelly25_1/POWER2"
]
Type switch : online [
stateTopic="tele/shelly25_1/LWT",
on="Online",
off="Offline"
]
Type number : temperature [
stateTopic="tele/shelly25_1/SENSOR",
transformationPattern="JSONPATH:$.ANALOG.Temperature"
]
Type number : voltage [
stateTopic="tele/shelly25_1/SENSOR",
transformationPattern="JSONPATH:$.ENERGY.Voltage"
]
Type number : watt1 [
stateTopic="tele/shelly25_1/SENSOR",
transformationPattern="JSONPATH:$.ENERGY.Power[0]"
]
Type number : watt2 [
stateTopic="tele/shelly25_1/SENSOR",
transformationPattern="JSONPATH:$.ENERGY.Power[1]"
]
}