Enphase Envoy sensors

Hi
im trying to pull various values from a json file (http://xxx.xxx.xxx.xxx/production.json)
through a web browser i get these results

{
  "production": [
    {
      "type": "inverters",
      "activeCount": 0,
      "readingTime": 0,
      "wNow": 0,
      "whLifetime": 0
    },
    {
      "type": "eim",
      "activeCount": 1,
      "measurementType": "production",
      "readingTime": 1588377945,
      "wNow": 186.89,
      "whLifetime": 44759.12,
      "varhLeadLifetime": 662.693,
      "varhLagLifetime": 1065.682,
      "vahLifetime": 45425.044,
      "rmsCurrent": 0.784,
      "rmsVoltage": 242.161,
      "reactPwr": -4.622,
      "apprntPwr": 189.702,
      "pwrFactor": "1",
      "whToday": 357.12,
      "whLastSevenDays": 34348.12,
      "vahToday": 388.044,
      "varhLeadToday": 22.693,
      "varhLagToday": 58.682
    }
  ],
  "consumption": [
    {
      "type": "eim",
      "activeCount": 1,
      "measurementType": "total-consumption",
      "readingTime": 1588377945,
      "wNow": 668.008,
      "whLifetime": 77473.677,
      "varhLeadLifetime": 72139.654,
      "varhLagLifetime": 3314.765,
      "vahLifetime": 173821.64,
      "rmsCurrent": 4.478,
      "rmsVoltage": 242.152,
      "reactPwr": -448.089,
      "apprntPwr": 1084.319,
      "pwrFactor": 0.62,
      "whToday": 3433.677,
      "whLastSevenDays": 68860.677,
      "vahToday": 5568.64,
      "varhLeadToday": 3214.654,
      "varhLagToday": 175.765
    },
    {
      "type": "eim",
      "activeCount": 1,
      "measurementType": "net-consumption",
      "readingTime": 1588377945,
      "wNow": 481.118,
      "whLifetime": 79509.175,
      "varhLeadLifetime": 71476.961,
      "varhLagLifetime": 2249.083,
      "vahLifetime": 173821.64,
      "rmsCurrent": 3.694,
      "rmsVoltage": 242.143,
      "reactPwr": -452.711,
      "apprntPwr": 897.916,
      "pwrFactor": 0.54,
      "whToday": 0,
      "whLastSevenDays": 0,
      "vahToday": 0,
      "varhLeadToday": 0,
      "varhLagToday": 0
    }
  ],
  "storage": [
    {
      "type": "acb",
      "activeCount": 0,
      "readingTime": 0,
      "wNow": 0,
      "whNow": 0,
      "state": "idle"
    }
  ]
}

i have pulled my hair out for hours trying to grab values from consumption rmsvoltage and pwrfactor

i have been able to get some information using

sensor:
  - platform: enphase_envoy
    name: Optional_name
    ip_address: xxx.xxx.xxx.xxx

it spits out some production data

any help is appreciated

I got it working

sensor:
  # Envoy Integrated Meter - Production
  - platform: rest
    name: Production Lifetime
    resource: http://xxx.xxx.xxx.xxx/production.json
    value_template: '{{ "%.1f" | format(value_json.production[1].whLifetime) }}'
    method: GET
    unit_of_measurement: "Wh"
  - platform: rest
    name:  Production  - Last Seven Days
    resource: http://xxx.xxx.xxx.xxx/production.json
    value_template: '{{ "%.1f" | format(value_json.production[1].whLastSevenDays) }}'
    method: GET
    unit_of_measurement: "Wh"
  - platform: rest
    name:  Production  - Today
    resource: http://xxx.xxx.xxx.xxx/production.json
    value_template: '{{ "%.1f" | format(value_json.production[1].whToday) }}'
    method: GET
    unit_of_measurement: "Wh"
  - platform: rest
    name:  Production  - Now
    resource: http://xxx.xxx.xxx.xxx/production.json
    value_template: '{{ "%.1f" | format(value_json.production[1].wNow) }}'
    method: GET
    unit_of_measurement: "W"
  # Envoy Integrated Meter - Total Consumption
  - platform: rest
    name: Consumption - Lifetime
    resource: http://xxx.xxx.xxx.xxx/production.json
    value_template: '{{ "%.1f" | format(value_json.consumption[0].whLifetime) }}'
    method: GET
    unit_of_measurement: "Wh"
  - platform: rest
    name:  Consumption - Last Seven Days
    resource: http://xxx.xxx.xxx.xxx/production.json
    value_template: '{{ "%.1f" | format(value_json.consumption[0].whLastSevenDays) }}'
    method: GET
    unit_of_measurement: "Wh"
  - platform: rest
    name:  Consumption  - Today
    resource: http://xxx.xxx.xxx.xxx/production.json
    value_template: '{{ "%.1f" | format(value_json.consumption[0].whToday) }}'
    method: GET
    unit_of_measurement: "Wh"
  - platform: rest
    name: Consumption - Now
    resource: http://xxx.xxx.xxx.xxx/production.json
    value_template: '{{ "%.1f" | format(value_json.consumption[0].wNow) }}'
    method: GET
    unit_of_measurement: "W"
  # Envoy Integrated Meter - Net Consumption
  - platform: rest
    name: Net Consumption - Now
    resource: http://xxx.xxx.xxx.xxx/production.json
    value_template: '{{ "%.1f" | format(value_json.consumption[1].wNow) }}'
    method: GET
    unit_of_measurement: "W"    
  - platform: rest
    name: Power factor
    resource: http://xxx.xxx.xxx.xxx/production.json
    value_template: '{{ "%.1f" | format(value_json.consumption[1].pwrFactor) }}'
    method: GET
    unit_of_measurement: "PF"
  - platform: rest
    name: Voltage
    resource: http://xxx.xxx.xxx.xxx/production.json
    value_template: '{{ "%.1f" | format(value_json.consumption[1].rmsVoltage) }}'
    method: GET
    unit_of_measurement: "V"
    
  # Envoy Integrated Meter - Battery
  - platform: rest
    name: Battery wNow
    resource: http://xxx.xxx.xxx.xxx/production.json
    value_template: '{{ "%.1f" | format(value_json.storage[0].wNow) }}'
    method: GET
    unit_of_measurement: "W"
  - platform: rest
    name: Battery PercentFull
    resource: http://xxx.xxx.xxx.xxx/production.json
    value_template: '{{ "%.1f" | format(value_json.storage[0].percentFull) }}'
    method: GET
    unit_of_measurement: "%"
  - platform: rest
    name: Battery whNow
    resource: http://xxx.xxx.xxx.xxx/production.json
    value_template: '{{ "%.1f" | format(value_json.storage[0].whNow) }}'
    method: GET
    unit_of_measurement: "WH"        
 - platform: rest   
   name: State
    resource: http://xxx.xxx.xxx.xxx/production.json
    value_template: '{{ "%.1f" | format(value_json.storage[0].state) }}'
    method: GET
    unit_of_measurement: "w"         
1 Like