scottyphillips/echonetlite_homeassistant

Failed to configure Nichicon storage battery

Closed this issue · 9 comments

The plugin could detect storage battery automatically, but failed in configure.

Debug log showed an error:

2023-11-30 15:36:14.320 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Nichicon for echonetlite
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/echonetlite/__init__.py", line 242, in async_setup_entry
    echonetlite = ECHONETConnector(instance, hass.data[DOMAIN]["api"], entry)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/echonetlite/__init__.py", line 384, in __init__
    if item in list(EPC_CODE[self._eojgc][self._eojcc].keys()):
                    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 165
2023-11-30 15:37:19.567 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry OMRON for echonetlite
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/echonetlite/__init__.py", line 242, in async_setup_entry
    echonetlite = ECHONETConnector(instance, hass.data[DOMAIN]["api"], entry)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/echonetlite/__init__.py", line 384, in __init__
    if item in list(EPC_CODE[self._eojgc][self._eojcc].keys()):
                    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 165

Actually the plugin could read info from battery correctly, which showed in debug logs.

2023-11-30 15:37:25.910 DEBUG (MainThread) [custom_components.echonetlite] ECHONETlite platform is already started.
2023-11-30 15:37:25.910 DEBUG (MainThread) [custom_components.echonetlite] Starting ECHONETLite Generic instance for 2-125-1 at 192.168.1.160
2023-11-30 15:37:25.910 DEBUG (MainThread) [custom_components.echonetlite] UID for ECHONETLite instance at 192.168.1.160  is 00006c30303030313930343445333443.
2023-11-30 15:37:25.921 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 192.168.1.160 - Raw data is b"\x10\x81\x00%\x02}\x01\x05\xff\x01r\n\x80\x010\xa0\x04\x00\x008j\xd0\x04\x00\x00:4\xa1\x04\x00\x002\xea\xd1\x02\x02\xda\xa2\x04\x00\x00-!\xd2\x02\x00\xcb\xe2\x04\x00\x00\x0et\xa3\x04\x00\x00(\xbb\xd3\x04\xff\xff\xfe'"
2023-11-30 15:37:25.921 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 192.168.1.160 - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 37, 'SEOJGC': 2, 'SEOJCC': 125, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 114, 'OPC': [{'EPC': 128, 'PDC': 1, 'EDT': b'0'}, {'EPC': 160, 'PDC': 4, 'EDT': b'\x00\x008j'}, {'EPC': 208, 'PDC': 4, 'EDT': b'\x00\x00:4'}, {'EPC': 161, 'PDC': 4, 'EDT': b'\x00\x002\xea'}, {'EPC': 209, 'PDC': 2, 'EDT': b'\x02\xda'}, {'EPC': 162, 'PDC': 4, 'EDT': b'\x00\x00-!'}, {'EPC': 210, 'PDC': 2, 'EDT': b'\x00\xcb'}, {'EPC': 226, 'PDC': 4, 'EDT': b'\x00\x00\x0et'}, {'EPC': 163, 'PDC': 4, 'EDT': b'\x00\x00(\xbb'}, {'EPC': 211, 'PDC': 4, 'EDT': b"\xff\xff\xfe'"}]}
2023-11-30 15:37:25.921 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 192.168.1.160 - tid_data is {}
2023-11-30 15:37:25.921 DEBUG (MainThread) [custom_components.echonetlite] 
ECHONETlite polling update data:
 - Operation status (0x80): On
 - Operation status (0x80): On
 - AC effective capacity (charging) (0xa0): 14442
 - Rated electric energy (0xd0): 14900
 - AC effective capacity (discharging) (0xa1): 13034
 - Rated capacity (0xd1): 730
 - AC chargeable capacity (0xa2): 11553
 - Rated voltage (0xd2): 203
 - Remaining stored electricity 1 (0xe2): 3700
 - AC dischargeable capacity (0xa3): 10427
 - Measured instantaneous charging/discharging electric energy (0xd3): -473
 - AC chargeable electric energy (0xa4): 10253
 - Remaining stored electricity 3 (0xe4): 30
 - AC dischargeable electric energy (0xa5): 1173
 - Battery state of health (0xe5): 100
 - Measured cumulative discharging electric energy (0xd6): 271
 - Battery type (0xe6): Lithium
 - Charging amount setting 1 (0xe7): 14900
 - AC measured cumulative charging electric energy (0xa8): 27
 - Minimum/maximum charging electric power (0xc8): 0/4000
 - Measured cumulative charging electric energy (0xd8): 26
 - Discharging amount setting 1 (0xe8): 14900
 - AC measured cumulative discharging electric energy (0xa9): 258
 - Minimum/maximum discharging electric power (0xc9): 0/4000
 - AC charge amount setting value (0xaa): 0
 - Operation mode setting (0xda): auto
 - AC discharge amount setting value (0xab): 0
 - System-interconnected type (0xdb): reversePowerFlowNotAcceptable
 - Charging electric energy setting (0xeb): 4000
 - Minimum/maxim um charging power (Independent) (0xdc): 0/4000
 - Discharging electric energy setting (0xec): 4000
 - Minimum/maxim um discharging power (Independent) (0xdd): 0/5000
 - Working operation status (0xcf): discharging

which version do you use?
3.7.3 is work with my OMRON battery fine.

which version do you use? 3.7.3 is work with my OMRON battery fine.

Latest 3.7.7 version. Tried to install 3.7.3 but same error occurred, not sure if Nichicon battery needs additional deals.

2023-12-01 13:05:51.871 DEBUG (MainThread) [custom_components.echonetlite] Starting ECHONETLite Generic instance for 2-165-1 at 192.168.1.160
2023-12-01 13:05:51.871 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Nichicon for echonetlite
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/echonetlite/__init__.py", line 240, in async_setup_entry
    echonetlite = ECHONETConnector(instance, hass.data[DOMAIN]["api"], entry)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/echonetlite/__init__.py", line 371, in __init__
    if item in list(EPC_CODE[self._eojgc][self._eojcc].keys()):
                    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 165

Starting ECHONETLite Generic instance for 2-125-1 at 192.168.1.160
Starting ECHONETLite Generic instance for 2-165-1 at 192.168.1.160
It interesting at your log . It has two echonet instance on this ip. 2-125 is storage right. But 2-165 is Multiple Input PCS.
Also i think it will not effect storage battery finish init. Did you install echonetlite with hacs? I think pyechonet version cause this problem. 2-165 device is add at Sep 23.

Starting ECHONETLite Generic instance for 2-125-1 at 192.168.1.160 Starting ECHONETLite Generic instance for 2-165-1 at 192.168.1.160 It interesting at your log . It has two echonet instance on this ip. 2-125 is storage right. But 2-165 is Multiple Input PCS. Also i think it will not effect storage battery finish init. Did you install echonetlite with hacs? I think pyechonet version cause this problem. 2-165 device is add at Sep 23.

Yes, the plugin is installed via HACS. The battery system is connect to solar panel via PCS, so maybe there are 2 instances in same device.

try to update pychonet to master branch. may solve this issue.
@scottyphillips
can you update pychonet version?

@twfx1207
change manifest.json
"pychonet==2.3.18"
change to
"pychonet @ git+https://github.com/scottyphillips/pychonet.git@master"

@twfx1207 change manifest.json "pychonet==2.3.18" change to "pychonet @ git+https://github.com/scottyphillips/pychonet.git@master"

Thanks for your reply, the plugin works after pychonet upgrade:)

Hi there, I will try to push out a new version shortly. Thanks for the tip about the manifest file by the way!

3.7.8 should fix this - please test.