Okay so I fixed the state by just hardcoding the value “OK” in there for the state:
sensor:
- name: "Solar API Production"
unique_id: solar_api_production_production
value_template: "{{ "OK" }}"
json_attributes_path: $.production[1]
So the state is now reading OK, and the attributes still have their value, but the template still is reporting null.
Here is a copy of the API output from postman:
{
"production": [
{
"type": "inverters",
"activeCount": 61,
"readingTime": 1686677300,
"wNow": 3505,
"whLifetime": 503564
},
{
"type": "eim",
"activeCount": 1,
"measurementType": "production",
"readingTime": 1686677315,
"wNow": 12337.654,
"whLifetime": 506850.003,
"varhLeadLifetime": 4062.696,
"varhLagLifetime": 143163.31,
"vahLifetime": 657712.576,
"rmsCurrent": 106.54,
"rmsVoltage": 245.089,
"reactPwr": -34.016,
"apprntPwr": 12784.688,
"pwrFactor": 0.97,
"whToday": 25968.003,
"whLastSevenDays": 480657.003,
"vahToday": 40354.576,
"varhLeadToday": 163.696,
"varhLagToday": 15101.31,
"lines": [
{
"wNow": 6173.031,
"whLifetime": 253371.51,
"varhLeadLifetime": 1985.219,
"varhLagLifetime": 71561.673,
"vahLifetime": 328705.962,
"rmsCurrent": 53.266,
"rmsVoltage": 122.613,
"reactPwr": -16.208,
"apprntPwr": 6395.309,
"pwrFactor": 0.97,
"whToday": 12983.51,
"whLastSevenDays": 240275.51,
"vahToday": 20170.962,
"varhLeadToday": 79.219,
"varhLagToday": 7551.673
},
{
"wNow": 6164.623,
"whLifetime": 253478.493,
"varhLeadLifetime": 2077.477,
"varhLagLifetime": 71601.637,
"vahLifetime": 329006.614,
"rmsCurrent": 53.274,
"rmsVoltage": 122.477,
"reactPwr": -17.809,
"apprntPwr": 6389.379,
"pwrFactor": 0.97,
"whToday": 12984.493,
"whLastSevenDays": 240381.493,
"vahToday": 20183.614,
"varhLeadToday": 84.477,
"varhLagToday": 7549.637
}
]
}
],
"consumption": [
{
"type": "eim",
"activeCount": 1,
"measurementType": "total-consumption",
"readingTime": 1686677315,
"wNow": 8726.829,
"whLifetime": 548359.324,
"varhLeadLifetime": 56837.031,
"varhLagLifetime": -112314.571,
"vahLifetime": 356435.183,
"rmsCurrent": 73.764,
"rmsVoltage": 244.688,
"reactPwr": 264.274,
"apprntPwr": 9023.963,
"pwrFactor": 0.99,
"whToday": 41893.324,
"whLastSevenDays": 288.324,
"vahToday": 27116.183,
"varhLeadToday": 6864.031,
"varhLagToday": 0.0,
"lines": [
{
"wNow": 3830.833,
"whLifetime": 281610.842,
"varhLeadLifetime": 25746.034,
"varhLagLifetime": -53642.536,
"vahLifetime": 203836.373,
"rmsCurrent": 32.576,
"rmsVoltage": 122.416,
"reactPwr": -166.611,
"apprntPwr": 3987.873,
"pwrFactor": 0.96,
"whToday": 22732.842,
"whLastSevenDays": 133.842,
"vahToday": 16205.373,
"varhLeadToday": 2887.034,
"varhLagToday": 0.0
},
{
"wNow": 4895.995,
"whLifetime": 266748.482,
"varhLeadLifetime": 31090.997,
"varhLagLifetime": -58672.035,
"vahLifetime": 152598.81,
"rmsCurrent": 41.187,
"rmsVoltage": 122.272,
"reactPwr": 430.885,
"apprntPwr": 5036.09,
"pwrFactor": 0.97,
"whToday": 19160.482,
"whLastSevenDays": 154.482,
"vahToday": 10910.81,
"varhLeadToday": 3977.0,
"varhLagToday": 0.0
}
]
},
{
"type": "eim",
"activeCount": 1,
"measurementType": "net-consumption",
"readingTime": 1686677315,
"wNow": -3610.826,
"whLifetime": 41555.689,
"varhLeadLifetime": 60899.727,
"varhLagLifetime": 30848.738,
"vahLifetime": 356435.183,
"rmsCurrent": -32.776,
"rmsVoltage": 244.688,
"reactPwr": 298.29,
"apprntPwr": -4010.608,
"pwrFactor": -1.0,
"whToday": 0,
"whLastSevenDays": 0,
"vahToday": 0,
"varhLeadToday": 0,
"varhLagToday": 0,
"lines": [
{
"wNow": -2342.198,
"whLifetime": 28261.044,
"varhLeadLifetime": 27731.253,
"varhLagLifetime": 17919.137,
"vahLifetime": 203836.373,
"rmsCurrent": -20.69,
"rmsVoltage": 122.416,
"reactPwr": -150.404,
"apprntPwr": -2532.724,
"pwrFactor": -1.0,
"whToday": 0,
"whLastSevenDays": 0,
"vahToday": 0,
"varhLeadToday": 0,
"varhLagToday": 0
},
{
"wNow": -1268.628,
"whLifetime": 13294.644,
"varhLeadLifetime": 33168.474,
"varhLagLifetime": 12929.602,
"vahLifetime": 152598.81,
"rmsCurrent": -12.087,
"rmsVoltage": 122.272,
"reactPwr": 448.694,
"apprntPwr": -1477.883,
"pwrFactor": -1.0,
"whToday": 0,
"whLastSevenDays": 0,
"vahToday": 0,
"varhLeadToday": 0,
"varhLagToday": 0
}
]
}
],
"storage": [
{
"type": "acb",
"activeCount": 0,
"readingTime": 0,
"wNow": 0,
"whNow": 0,
"state": "idle"
}
]
}
Btw thank you for your help.