briancmpbll / home_assistant_custom_envoy

178 stars 76 forks source link

Divide by zero error? #40

Closed copekyle closed 1 year ago

copekyle commented 1 year ago

I was attempting to troubleshoot something else when I went into me HA logs and realized this component is having fits. I have one of the newer enphase systems that uses sunlight backup but no batteries. I'm guessing that's why the "storage type" is "ac b". Is this making the code think I have batteries and then doing a divide by 0? Also, please don't mind there being no production on this system. It's been installed 3 weeks and I'm still waiting on the utility to change my meter and let me connect to the grid.

2023-01-13 09:57:03.368 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Checking Token value: eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIyMDIyMzkwNTE1OTYiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Im93bmVyIiwiZXhwIjoxNzA1MTQwMjg2LCJpYXQiOjE2NzM2MDQyODYsImp0aSI6IjE2OGU3MTg0LTJlNmQtNDk2MC1iMTIwLWFkZTdhYjBmNTE4NSIsInVzZXJuYW1lIjoiY29wZWt5bGVAZ21haWwuY29tIn0.HRsC9cjRI-3AhGrXXC_t9t3svmAgNky_pDkijozsG8WV0ODw888tKsmkystuZmmTlnD1cO7uen9CRP8L7nPSGg
2023-01-13 09:57:03.368 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Token is populated: eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIyMDIyMzkwNTE1OTYiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Im93bmVyIiwiZXhwIjoxNzA1MTQwMjg2LCJpYXQiOjE2NzM2MDQyODYsImp0aSI6IjE2OGU3MTg0LTJlNmQtNDk2MC1iMTIwLWFkZTdhYjBmNTE4NSIsInVzZXJuYW1lIjoiY29wZWt5bGVAZ21haWwuY29tIn0.HRsC9cjRI-3AhGrXXC_t9t3svmAgNky_pDkijozsG8WV0ODw888tKsmkystuZmmTlnD1cO7uen9CRP8L7nPSGg
2023-01-13 09:57:03.368 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Token expires at: 2024-01-13 03:04:46
2023-01-13 09:57:03.368 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP GET Attempt #1: https://192.168.1.60/production.json: Header:{'Authorization': 'Bearer eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIyMDIyMzkwNTE1OTYiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Im93bmVyIiwiZXhwIjoxNzA1MTQwMjg2LCJpYXQiOjE2NzM2MDQyODYsImp0aSI6IjE2OGU3MTg0LTJlNmQtNDk2MC1iMTIwLWFkZTdhYjBmNTE4NSIsInVzZXJuYW1lIjoiY29wZWt5bGVAZ21haWwuY29tIn0.HRsC9cjRI-3AhGrXXC_t9t3svmAgNky_pDkijozsG8WV0ODw888tKsmkystuZmmTlnD1cO7uen9CRP8L7nPSGg'}
2023-01-13 09:57:05.541 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Fetched from https://192.168.1.60/production.json: <Response [200 OK]>: {"production":[{"type":"inverters","activeCount":40,"readingTime":0,"wNow":0,"whLifetime":87},{"type":"eim","activeCount":1,"measurementType":"production","readingTime":1673629032,"wNow":0.0,"whLifetime":390.925,"varhLeadLifetime":46.389,"varhLagLifetime":936.073,"vahLifetime":24697.283,"rmsCurrent":0.28,"rmsVoltage":244.647,"reactPwr":0.0,"apprntPwr":33.778,"pwrFactor":0.0,"whToday":0.925,"whLastSevenDays":0.925,"vahToday":330.283,"varhLeadToday":1.389,"varhLagToday":2.073}],"consumption":[{"type":"eim","activeCount":1,"measurementType":"total-consumption","readingTime":1673629032,"wNow":549.297,"whLifetime":2936714.393,"varhLeadLifetime":67123.278,"varhLagLifetime":78251.217,"vahLifetime":3003677.23,"rmsCurrent":5.419,"rmsVoltage":244.692,"reactPwr":-218.942,"apprntPwr":1325.897,"pwrFactor":0.41,"whToday":28344.393,"whLastSevenDays":624447.393,"vahToday":29210.23,"varhLeadToday":993.278,"varhLagToday":858.217},{"type":"eim","activeCount":1,"measurementType":"net-consumption","readingTime":1673629032,"wNow":549.297,"whLifetime":2936362.039,"varhLeadLifetime":67076.889,"varhLagLifetime":77315.144,"vahLifetime":3003677.23,"rmsCurrent":5.139,"rmsVoltage":244.738,"reactPwr":-218.942,"apprntPwr":629.887,"pwrFactor":0.88,"whToday":0,"whLastSevenDays":0,"vahToday":0,"varhLeadToday":0,"varhLagToday":0}],"storage":[{"type":"acb","activeCount":0,"readingTime":0,"wNow":0,"whNow":0,"state":"idle"}]}
2023-01-13 09:57:05.543 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP GET Attempt #1: https://192.168.1.60/ivp/ensemble/inventory: Header:{'Authorization': 'Bearer eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIyMDIyMzkwNTE1OTYiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Im93bmVyIiwiZXhwIjoxNzA1MTQwMjg2LCJpYXQiOjE2NzM2MDQyODYsImp0aSI6IjE2OGU3MTg0LTJlNmQtNDk2MC1iMTIwLWFkZTdhYjBmNTE4NSIsInVzZXJuYW1lIjoiY29wZWt5bGVAZ21haWwuY29tIn0.HRsC9cjRI-3AhGrXXC_t9t3svmAgNky_pDkijozsG8WV0ODw888tKsmkystuZmmTlnD1cO7uen9CRP8L7nPSGg'}
2023-01-13 09:57:05.836 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Fetched from https://192.168.1.60/ivp/ensemble/inventory: <Response [200 OK]>: [
    {
        "type": "ENCHARGE",
        "devices": []
    },
    {
        "type": "ENPOWER",
        "devices": [
            {
                "part_num": "865-00376-r29",
                "installed": 1673464750,
                "serial_num": "MySerialNumber",
                "device_status": [
                    "envoy.global.ok",
                    "prop.done"
                ],
                "last_rpt_date": 1673628959,
                "admin_state": 24,
                "admin_state_str": "ENPWR_STATE_OPER_CLOSED",
                "created_date": 1673464750,
                "img_load_date": 1673464750,
                "img_pnum_running": "2.0.4780_rel/22.10",
                "zigbee_dongle_fw_version": "100F",
                "operating": true,
                "communicating": true,
                "temperature": 53,
                "comm_level_sub_ghz": 4,
                "comm_level_2_4_ghz": 4,
                "mains_admin_state": "closed",
                "mains_oper_state": "closed",
                "Enpwr_grid_mode": "grid-tied",
                "Enchg_grid_mode": "multimode-ongrid",
                "Enpwr_relay_state_bm": 15664,
                "Enpwr_curr_state_id": 16
            }
      
]
    }
]
2023-01-13 09:57:05.837 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP GET Attempt #1: https://192.168.1.60/home.json: Header:{'Authorization': 'Bearer eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIyMDIyMzkwNTE1OTYiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Im93bmVyIiwiZXhwIjoxNzA1MTQwMjg2LCJpYXQiOjE2NzM2MDQyODYsImp0aSI6IjE2OGU3MTg0LTJlNmQtNDk2MC1iMTIwLWFkZTdhYjBmNTE4NSIsInVzZXJuYW1lIjoiY29wZWt5bGVAZ21haWwuY29tIn0.HRsC9cjRI-3AhGrXXC_t9t3svmAgNky_pDkijozsG8WV0ODw888tKsmkystuZmmTlnD1cO7uen9CRP8L7nPSGg'}
2023-01-13 09:57:09.749 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Fetched from https://192.168.1.60/home.json: <Response [200 OK]>: {"software_build_epoch":1665679533,"is_nonvoy":false,"db_size":7778304,"db_percent_full":"  2.06","timezone":"US/Mountain","current_date":"01/13/2023","current_time":"09:57","network":{"web_comm":true,"ever_reported_to_enlighten":true,"last_enlighten_report_time":1673628803,"primary_interface":"wlan0","interfaces":[{"signal_strength":20,"signal_strength_max":31,"network":true,"type":"cellular","interface":"ppp0","dhcp":true,"ip":"100.73.191.195","carrier":true},{"type":"ethernet","interface":"eth0","mac":"00:1D:C0:B8:39:13","dhcp":true,"ip":"169.254.120.1","signal_strength":0,"signal_strength_max":1,"carrier":false},{"signal_strength":3,"signal_strength_max":5,"type":"wifi","interface":"wlan0","mac":"20:D7:78:C2:6F:BA","dhcp":true,"ip":"192.168.1.60","carrier":true,"supported":true,"present":true,"configured":true,"status":"connected"}]},"tariff":"none","comm":{"num":1,"level":0,"pcu":{"num":0,"level":0},"acb":{"num":0,"level":0},"nsrb":{"num":0,"level":0},"esub":{"num":1,"level":5},"encharge":[{"num":0,"level":0,"level_24g":0,"level_subg":0}]},"alerts":[],"update_status":"not-satisfied","wireless_connection":[{"signal_strength":0,"signal_strength_max":0,"type":"zigbee","connected":true},{"signal_strength":0,"signal_strength_max":0,"type":"subghz","connected":true}],"enpower":{"connected":true,"grid_status":"closed"}}
2023-01-13 09:57:09.750 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP GET Attempt #1: https://192.168.1.60/api/v1/production/inverters: Header:{'Authorization': 'Bearer eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIyMDIyMzkwNTE1OTYiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Im93bmVyIiwiZXhwIjoxNzA1MTQwMjg2LCJpYXQiOjE2NzM2MDQyODYsImp0aSI6IjE2OGU3MTg0LTJlNmQtNDk2MC1iMTIwLWFkZTdhYjBmNTE4NSIsInVzZXJuYW1lIjoiY29wZWt5bGVAZ21haWwuY29tIn0.HRsC9cjRI-3AhGrXXC_t9t3svmAgNky_pDkijozsG8WV0ODw888tKsmkystuZmmTlnD1cO7uen9CRP8L7nPSGg'}
2023-01-13 09:57:09.983 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Fetched from https://192.168.1.60/api/v1/production/inverters: <Response [200 OK]>: [
  {
    "serialNumber": "202218100716",
    "lastReportDate": 1671059892,
    "devType": 1,
    "lastReportWatts": 5,
    "maxReportWatts": 5
  },
  {
    "serialNumber": "202219042158",
    "lastReportDate": 1671060044,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219043076",
    "lastReportDate": 1671059902,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219066898",
    "lastReportDate": 1671059905,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219124102",
    "lastReportDate": 1671059911,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219124112",
    "lastReportDate": 1671059914,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219124544",
    "lastReportDate": 1671059915,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219124593",
    "lastReportDate": 1671059919,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219124964",
    "lastReportDate": 1671059923,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219125397",
    "lastReportDate": 1671060086,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219125472",
    "lastReportDate": 1671060088,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219125531",
    "lastReportDate": 1671059932,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219127756",
    "lastReportDate": 1671059938,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219128312",
    "lastReportDate": 1671059941,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219131561",
    "lastReportDate": 1671059944,
    "devType": 1,
    "lastReportWatts": 4,
    "maxReportWatts": 4
  },
  {
    "serialNumber": "202219132160",
    "lastReportDate": 1671059949,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219133917",
    "lastReportDate": 1671059951,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219133923",
    "lastReportDate": 1671060091,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219137190",
    "lastReportDate": 1671059959,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219137225",
    "lastReportDate": 1671060092,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219139066",
    "lastReportDate": 1671059966,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219139187",
    "lastReportDate": 1671059967,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202221037625",
    "lastReportDate": 1671059970,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221037790",
    "lastReportDate": 1671059181,
    "devType": 1,
    "lastReportWatts": 1,
    "maxReportWatts": 1
  },
  {
    "serialNumber": "202221037815",
    "lastReportDate": 1671059975,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221041871",
    "lastReportDate": 1671059978,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202221041934",
    "lastReportDate": 1671059983,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221042811",
    "lastReportDate": 1671060097,
    "devType": 1,
    "lastReportWatts": 1,
    "maxReportWatts": 1
  },
  {
    "serialNumber": "202221043902",
    "lastReportDate": 1671060099,
    "devType": 1,
    "lastReportWatts": 2,
    "maxReportWatts": 2
  },
  {
    "serialNumber": "202221044077",
    "lastReportDate": 1671060101,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221044331",
    "lastReportDate": 1671060104,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202221044502",
    "lastReportDate": 1671060106,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202221044733",
    "lastReportDate": 1671060109,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202221044762",
    "lastReportDate": 1671060111,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221044767",
    "lastReportDate": 1671060113,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202221044768",
    "lastReportDate": 1671060115,
    "devType": 1,
    "lastReportWatts": 5,
    "maxReportWatts": 5
  },
  {
    "serialNumber": "202221044778",
    "lastReportDate": 1671060117,
    "devType": 1,
    "lastReportWatts": 5,
    "maxReportWatts": 5
  },
  {
    "serialNumber": "202221044782",
    "lastReportDate": 1671060121,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221045009",
    "lastReportDate": 1671060123,
    "devType": 1,
    "lastReportWatts": 2,
    "maxReportWatts": 2
  },
  {
    "serialNumber": "202221045503",
    "lastReportDate": 1671060127,
    "devType": 1,
    "lastReportWatts": 5,
    "maxReportWatts": 5
  }
]
2023-01-13 09:57:09.983 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Fetched from https://192.168.1.60/api/v1/production/inverters: <Response [200 OK]>: [
  {
    "serialNumber": "202218100716",
    "lastReportDate": 1671059892,
    "devType": 1,
    "lastReportWatts": 5,
    "maxReportWatts": 5
  },
  {
    "serialNumber": "202219042158",
    "lastReportDate": 1671060044,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219043076",
    "lastReportDate": 1671059902,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219066898",
    "lastReportDate": 1671059905,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219124102",
    "lastReportDate": 1671059911,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219124112",
    "lastReportDate": 1671059914,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219124544",
    "lastReportDate": 1671059915,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219124593",
    "lastReportDate": 1671059919,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219124964",
    "lastReportDate": 1671059923,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219125397",
    "lastReportDate": 1671060086,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219125472",
    "lastReportDate": 1671060088,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219125531",
    "lastReportDate": 1671059932,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219127756",
    "lastReportDate": 1671059938,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202219128312",
    "lastReportDate": 1671059941,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219131561",
    "lastReportDate": 1671059944,
    "devType": 1,
    "lastReportWatts": 4,
    "maxReportWatts": 4
  },
  {
    "serialNumber": "202219132160",
    "lastReportDate": 1671059949,
    "devType": 1,
    "lastReportWatts": 8,
    "maxReportWatts": 8
  },
  {
    "serialNumber": "202219133917",
    "lastReportDate": 1671059951,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219133923",
    "lastReportDate": 1671060091,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219137190",
    "lastReportDate": 1671059959,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219137225",
    "lastReportDate": 1671060092,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219139066",
    "lastReportDate": 1671059966,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202219139187",
    "lastReportDate": 1671059967,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202221037625",
    "lastReportDate": 1671059970,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221037790",
    "lastReportDate": 1671059181,
    "devType": 1,
    "lastReportWatts": 1,
    "maxReportWatts": 1
  },
  {
    "serialNumber": "202221037815",
    "lastReportDate": 1671059975,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221041871",
    "lastReportDate": 1671059978,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202221041934",
    "lastReportDate": 1671059983,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221042811",
    "lastReportDate": 1671060097,
    "devType": 1,
    "lastReportWatts": 1,
    "maxReportWatts": 1
  },
  {
    "serialNumber": "202221043902",
    "lastReportDate": 1671060099,
    "devType": 1,
    "lastReportWatts": 2,
    "maxReportWatts": 2
  },
  {
    "serialNumber": "202221044077",
    "lastReportDate": 1671060101,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221044331",
    "lastReportDate": 1671060104,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202221044502",
    "lastReportDate": 1671060106,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202221044733",
    "lastReportDate": 1671060109,
    "devType": 1,
    "lastReportWatts": 7,
    "maxReportWatts": 7
  },
  {
    "serialNumber": "202221044762",
    "lastReportDate": 1671060111,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221044767",
    "lastReportDate": 1671060113,
    "devType": 1,
    "lastReportWatts": 6,
    "maxReportWatts": 6
  },
  {
    "serialNumber": "202221044768",
    "lastReportDate": 1671060115,
    "devType": 1,
    "lastReportWatts": 5,
    "maxReportWatts": 5
  },
  {
    "serialNumber": "202221044778",
    "lastReportDate": 1671060117,
    "devType": 1,
    "lastReportWatts": 5,
    "maxReportWatts": 5
  },
  {
    "serialNumber": "202221044782",
    "lastReportDate": 1671060121,
    "devType": 1,
    "lastReportWatts": 3,
    "maxReportWatts": 3
  },
  {
    "serialNumber": "202221045009",
    "lastReportDate": 1671060123,
    "devType": 1,
    "lastReportWatts": 2,
    "maxReportWatts": 2
  },
  {
    "serialNumber": "202221045503",
    "lastReportDate": 1671060127,
    "devType": 1,
    "lastReportWatts": 5,
    "maxReportWatts": 5
  }
]
2023-01-13 09:57:09.985 DEBUG (MainThread) [custom_components.enphase_envoy] Retrieved data from API: {'production': 0, 'daily_production': 0, 'seven_days_production': 0, 'lifetime_production': 390, 'consumption': 549, 'daily_consumption': 28344, 'seven_days_consumption': 624447, 'lifetime_consumption': 2936714, 'inverters_production': {'202218100716': [5, '2022-12-14 16:18:12'], '202219042158': [6, '2022-12-14 16:20:44'], '202219043076': [6, '2022-12-14 16:18:22'], '202219066898': [8, '2022-12-14 16:18:25'], '202219124102': [8, '2022-12-14 16:18:31'], '202219124112': [6, '2022-12-14 16:18:34'], '202219124544': [8, '2022-12-14 16:18:35'], '202219124593': [8, '2022-12-14 16:18:39'], '202219124964': [8, '2022-12-14 16:18:43'], '202219125397': [6, '2022-12-14 16:21:26'], '202219125472': [7, '2022-12-14 16:21:28'], '202219125531': [7, '2022-12-14 16:18:52'], '202219127756': [6, '2022-12-14 16:18:58'], '202219128312': [7, '2022-12-14 16:19:01'], '202219131561': [4, '2022-12-14 16:19:04'], '202219132160': [8, '2022-12-14 16:19:09'], '202219133917': [7, '2022-12-14 16:19:11'], '202219133923': [7, '2022-12-14 16:21:31'], '202219137190': [7, '2022-12-14 16:19:19'], '202219137225': [7, '2022-12-14 16:21:32'], '202219139066': [7, '2022-12-14 16:19:26'], '202219139187': [6, '2022-12-14 16:19:27'], '202221037625': [3, '2022-12-14 16:19:30'], '202221037790': [1, '2022-12-14 16:06:21'], '202221037815': [3, '2022-12-14 16:19:35'], '202221041871': [7, '2022-12-14 16:19:38'], '202221041934': [3, '2022-12-14 16:19:43'], '202221042811': [1, '2022-12-14 16:21:37'], '202221043902': [2, '2022-12-14 16:21:39'], '202221044077': [3, '2022-12-14 16:21:41'], '202221044331': [6, '2022-12-14 16:21:44'], '202221044502': [6, '2022-12-14 16:21:46'], '202221044733': [7, '2022-12-14 16:21:49'], '202221044762': [3, '2022-12-14 16:21:51'], '202221044767': [6, '2022-12-14 16:21:53'], '202221044768': [5, '2022-12-14 16:21:55'], '202221044778': [5, '2022-12-14 16:21:57'], '202221044782': [3, '2022-12-14 16:22:01'], '202221045009': [2, '2022-12-14 16:22:03'], '202221045503': [5, '2022-12-14 16:22:07']}, 'batteries': {}, 'grid_status': 'closed'}
2023-01-13 09:57:09.985 DEBUG (MainThread) [custom_components.enphase_envoy] Finished fetching envoy Envoy 202239051596 data in 6.617 seconds (success: True)
2023-01-13 09:57:12.570 ERROR (Recorder) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 316, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 121, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 381, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 556, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 597, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 562, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 855, in state
    value = self.native_value
  File "/config/custom_components/enphase_envoy/sensor.py", line 365, in native_value
    return round(battery_sum / len(batteries), 2)
ZeroDivisionError: division by zero
briancmpbll commented 1 year ago

Fixed by #42. Can you install the latest release and try this out again?

copekyle commented 1 year ago

Sweet. That did the trick. Thanks for the quick response. I have one dumb follow up question. How do I turn off the logging in HA? None of my other sensors/devices log as much as this does.

briancmpbll commented 1 year ago

Yeah, the repo I forked this off of had a lot of debug info getting logged. Let me see if I can add a debug flag to turn that off most of the time.

briancmpbll commented 1 year ago

Should be much less logging in the newest version now.

copekyle commented 1 year ago

This took care of it for me. Thank you.