scottyphillips / echonetlite_homeassistant

A Home Assistant custom component for use with ECHONET enabled devices.
MIT License
119 stars 40 forks source link

0xE1 not return from smart electric meter #150

Closed leonunix closed 2 months ago

leonunix commented 6 months ago

@nao-pon I have a problem with smart electric meter. In my meter return. it have not 0xE1 power unit property. So it can not get Measured cumulative amounts data. Have you same problem with this? both mitsubishi and hitachi meter have this problem with me.

scottyphillips-work commented 6 months ago

Hi, can you enable debugging in the custom component and post the log output here? Though if you don't have 0xE1 available you might be stuck. There might be something else we can use though, or you might have to use a template.

scottyphillips-work commented 6 months ago

ahhhh, okay I see whats happening. if you are not getting 0xE1 then maybe we need to take that into account when calculating 0xE0 value.

The vendors are not properly conforming to the spec, the appendix says these are mandatory values.

In sensor.py we need to fix this logic (line 388):

            ]:  # Measured cumulative amounts normal or revers
                if self._eojgc == 0x02 and self._eojcc == 0x88:
                    if self._connector._update_data.get(0xE1):
                        coef = self._connector._update_data.get(0xD3) or 1
                        return (
                            self._state_value
                            * coef
                            * self._connector._update_data[0xE1]
                        )  # value in kWh
                    else:
                        return None

to something like this:

     ]:  # Measured cumulative amounts normal or revers
                if self._eojgc == 0x02 and self._eojcc == 0x88:
                    if self._connector._update_data.get(0xE1):
                        coef = self._connector._update_data.get(0xD3) or 1
                        return (
                            self._state_value
                            * coef
                            * self._connector._update_data[0xE1]
                        )  # value in kWh
                    else:
                        return self._state_value

Not sure why none is being returned, I think @nao-pon might have worked on this. I can only assume that 0xE0 will be 1kwh values in the absence of a co-efficient and multipler. Only way to determine is trial and error.

nao-pon commented 6 months ago

I haven't started on this yet, but the fact that the spec doesn't give you the required parameters means you have no choice but to guess the coefficients and apply them. That's exactly what @scottyphillips-work said. I approach this problem by looking at past versions of the spec to see if I can accommodate it properly.

nao-pon commented 6 months ago

I checked the specifications of the early version of Echonet Lite, and as expected, E1 is a required parameter, and the initial value is a multiplication factor of 0.001kWh. Multiplying by 0.001kWh when E1 is not available is questionable.

@leonunix Could you please debug the log and attach the actual data?

leonunix commented 6 months ago

@nao-pon smart electric meter is work in wisun interface. So i have write a convert refer to your source. But it is more easy. It only recive packet and send to wisun and forward it to homeassist. It is the log file for my convert app. https://github.com/leonunix/python-echonetlite-broute echolite.log

scottyphillips commented 6 months ago

Dec 11 07:36:33 b-route python3[642]: echonet_lite.Property(EPC=0xe0, PDC=4, EDT=bytearray(b'\x00\x00\x10\xf3'))

When I convert to b'\x00\x00\x10\xf3 int value I get 4339 as a value is that 4339kwhs? Does that number sound right?

scottyphillips commented 6 months ago

@nao-pon rather then try to second guess how to handle it among different vendors, maybe we just pass the value as it is in the absence of a co-efficient and multiplier and document it in the readme file so users can use it as part of a template sensor?

nao-pon commented 6 months ago

There is a configuration for the IP address in "config/.storage/core.config_entries", could you please attach it? The data looks like this:

      {
        "entry_id": "9699a67114cfaa243d51d2e47d0dc188",
        "version": 1,
        "domain": "echonetlite",
        "title": "Mitsubishi Electric",
        "data": {
          "instances": [
            {
              "host": "192.168.1.204",
              "eojgc": 2,
              "eojcc": 136,
              "eojci": 1,
              "ntfmap": [
                128,
                129,
                136,
                224,
                227,
                231,
                232
              ],
              "getmap": [
                128,
                224,
                129,
                225,
                130,
                226,
                211,
                227,
                228,
                229,
                151,
                215,
                231,
                136,
                152,
                232,
                138,
                234,
                235,
                236,
                141,
                157,
                237,
                158,
                159
              ],
              "setmap": [
                129,
                229,
                237
              ],
              "uid": "001204",
              "uidi": "001204-2-136-1",
              "manufacturer": "Mitsubishi Electric"
            },
            {
              "host": "192.168.1.204",
              "eojgc": 6,
              "eojcc": 1,
              "eojci": 1,
              "ntfmap": [
                128
              ],
              "getmap": [
                128
              ],
              "setmap": [
                128
              ],
              "uid": "001204",
              "uidi": "001204-6-1-1",
              "manufacturer": "Mitsubishi Electric"
            }
          ]
        },
        "options": {
          "other_mode": "as_off"
        },
        "pref_disable_new_entities": false,
        "pref_disable_polling": false,
        "source": "user",
        "unique_id": null,
        "disabled_by": null
      },
leonunix commented 6 months ago

@nao-pon` this is my file @scottyphillips yes. but unit is 0.1 so 433.9kw is right

      {
        "entry_id": "e73950d0617398fac01abec7988b5af6",
        "version": 1,
        "domain": "echonetlite",
        "title": "smart_meter",
        "data": {
          "instances": [
            {
              "host": "172.16.0.152",
              "eojgc": 2,
              "eojcc": 136,
              "eojci": 1,
              "ntfmap": [
                128,
                129,
                136
              ],
              "getmap": [
                128,
                224,
                129,
                225,
                130,
                226,
                211,
                227,
                228,
                229,
                151,
                215,
                231,
                136,
                152,
                232,
                138,
                234,
                235,
                236,
                141,
                157,
                237,
                158,
                159
              ],
              "setmap": [
                129,
                229,
                237
              ],
              "uid": "000016001c6400034e67df0000000000",
              "uidi": "000016001c6400034e67df0000000000-2-136-1",
              "manufacturer": "Toshiba"
            }
          ]
        },
       "options": {
          "other_mode": "as_off"
        },
        "pref_disable_new_entities": false,
        "pref_disable_polling": false,
        "source": "user",
        "unique_id": null,
        "disabled_by": null
      },
nao-pon commented 6 months ago

Since getmap has E1(225), data is obtained by polling. Could you please attach the debug log polling data?

The polling data looks like this:

2023-12-11 16:38:19.697 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 192.168.1.204 - Raw data is b'\x10\x81\x00\x03\x02\x88\x01\x05\xff\x01r\x07\x80\x010\xe0\x04\x00\x0b\xc7\x94\xe3\x04\x00\x00\x00,\xe7\x04\x00\x00\x06\xe8\xe8\x04\x00\x82\x00<\xd3\x04\x00\x00\x00\x01\xe1\x01\x01'
2023-12-11 16:38:19.697 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 192.168.1.204 - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 3, 'SEOJGC': 2, 'SEOJCC': 136, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 114, 'OPC': [{'EPC': 128, 'PDC': 1, 'EDT': b'0'}, {'EPC': 224, 'PDC': 4, 'EDT': b'\x00\x0b\xc7\x94'}, {'EPC': 227, 'PDC': 4, 'EDT': b'\x00\x00\x00,'}, {'EPC': 231, 'PDC': 4, 'EDT': b'\x00\x00\x06\xe8'}, {'EPC': 232, 'PDC': 4, 'EDT': b'\x00\x82\x00<'}, {'EPC': 211, 'PDC': 4, 'EDT': b'\x00\x00\x00\x01'}, {'EPC': 225, 'PDC': 1, 'EDT': b'\x01'}]}
2023-12-11 16:38:19.698 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 192.168.1.204 - tid_data is {}
2023-12-11 16:38:19.698 DEBUG (MainThread) [custom_components.echonetlite] 
ECHONETlite polling update data:
 - Operation status (0x80): On
 - Operation status (0x80): On
 - Measured cumulative amount of electric energy (normal direction) (0xe0): 771988
 - Measured cumulative amounts of electric energy (reverse direction) (0xe3): 44
 - Measured instantaneous electric energy (0xe7): 1768
 - Measured instantaneous currents (0xe8): {'r_phase_amperes': 13.0, 't_phase_amperes': 6.0}
 - Coefficient (0xd3): 1
 - Unit for cumulative amounts of electric energy (normal and reverse directions) (0xe1): 0.1
scottyphillips-work commented 6 months ago

if 0xE1 is returning a value of None then it is possible that the if statement would be skipped:

>>> connector = {'update_data': {0xe1: None}}
>>> connector['update_data'][0xE1] == True
False
>>> connector['update_data'][0xE1] == False
False
>>> connector['update_data'][0xE1] == None
True
>>> if connector['update_data'][0xE1]:
...   print('true')
...
>>>

The related EPC function can indeed return None:

def _0288E1(edt):
    if len(edt) < 1:
        return None
    op_mode = _int(edt)
    values = {0x00: 1,
              0x01: 0.1,
              0x02: 0.01,
              0x03: 0.001,
              0x04: 0.0001,
              0x0A: 10,
              0x0B: 100,
              0x0C: 1000,
              0x0D: 10000}
    return values.get(op_mode, None)
scottyphillips commented 6 months ago

hey @leonunix have you managed to obtain the debug logs yet?

leonunix commented 6 months ago
2023-12-18 08:45:58.629 DEBUG (MainThread) [custom_components.echonetlite] Starting ECHONETLite LowVoltageSmartElectricEnergyMeter instance at 172.16.0.152
2023-12-18 08:45:58.629 DEBUG (MainThread) [custom_components.echonetlite] UID for ECHONETLite instance at 172.16.0.152  is 000016001c6400034e67df0000000000.
2023-12-18 08:46:32.418 DEBUG (MainThread) [custom_components.echonetlite] Polling ECHONET Instance host 172.16.0.152 timed out. Retry 1 of 3
2023-12-18 08:46:37.183 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Raw data is b'\x10\x81\x00#\x02\x88\x01\x05\xff\x01R\x06\x80\x010\xe0\x04\x00\x00\x12<\xe3\x04\x00\x00 \xdd\xe7\x04\x00\x00\x00\x01\xe8\x04\x00\n\xff\xec\xd3\x04\x00\x00\x00\x01'
2023-12-18 08:46:37.183 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 35, 'SEOJGC': 2, 'SEOJCC': 136, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 82, 'OPC': [{'EPC': 128, 'PDC': 1, 'EDT': b'0'}, {'EPC': 224, 'PDC': 4, 'EDT': b'\x00\x00\x12<'}, {'EPC': 227, 'PDC': 4, 'EDT': b'\x00\x00 \xdd'}, {'EPC': 231, 'PDC': 4, 'EDT': b'\x00\x00\x00\x01'}, {'EPC': 232, 'PDC': 4, 'EDT': b'\x00\n\xff\xec'}, {'EPC': 211, 'PDC': 4, 'EDT': b'\x00\x00\x00\x01'}]}
2023-12-18 08:46:37.183 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - tid_data is {}
2023-12-18 08:46:37.249 DEBUG (MainThread) [custom_components.echonetlite] Polling ECHONET Instance host at 172.16.0.152 succeeded. Retry 2 of 3
2023-12-18 08:46:37.250 DEBUG (MainThread) [custom_components.echonetlite] Plaform entry data - {'instances': [{'host': '172.16.0.152', 'eojgc': 2, 'eojcc': 136, 'eojci': 1, 'ntfmap': [128, 129, 136], 'getmap': [128, 224, 129, 225, 130, 226, 211, 227, 228, 229, 151, 215, 231, 136, 152, 232, 138, 234, 235, 236, 141, 157, 237, 158, 159], 'setmap': [129, 229, 237], 'uid': '000016001c6400034e67df0000000000', 'uidi': '000016001c6400034e67df0000000000-2-136-1', 'manufacturer': 'Toshiba'}]}
2023-12-18 08:46:37.252 DEBUG (MainThread) [custom_components.echonetlite.sensor] Configuring ECHONETLite sensor {'instance': {'host': '172.16.0.152', 'eojgc': 2, 'eojcc': 136, 'eojci': 1, 'ntfmap': [128, 129, 136], 'getmap': [128, 224, 129, 225, 130, 226, 211, 227, 228, 229, 151, 215, 231, 136, 152, 232, 138, 234, 235, 236, 141, 157, 237, 158, 159], 'setmap': [129, 229, 237], 'uid': '000016001c6400034e67df0000000000', 'uidi': '000016001c6400034e67df0000000000-2-136-1', 'manufacturer': 'Toshiba'}, 'echonetlite': <custom_components.echonetlite.ECHONETConnector object at 0x7f063b51a3d0>}
2023-12-18 08:47:07.453 DEBUG (MainThread) [custom_components.echonetlite] Polling ECHONET Instance host 172.16.0.152 timed out. Retry 1 of 3
2023-12-18 08:47:12.710 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Raw data is b'\x10\x81\x005\x02\x88\x01\x05\xff\x01R\x06\x80\x010\xe0\x04\x00\x00\x12<\xe3\x04\x00\x00 \xdd\xe7\x04\x00\x00\x00\x00\xe8\x04\x00\n\xff\xec\xd3\x04\x00\x00\x00\x01'
2023-12-18 08:47:12.710 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 53, 'SEOJGC': 2, 'SEOJCC': 136, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 82, 'OPC': [{'EPC': 128, 'PDC': 1, 'EDT': b'0'}, {'EPC': 224, 'PDC': 4, 'EDT': b'\x00\x00\x12<'}, {'EPC': 227, 'PDC': 4, 'EDT': b'\x00\x00 \xdd'}, {'EPC': 231, 'PDC': 4, 'EDT': b'\x00\x00\x00\x00'}, {'EPC': 232, 'PDC': 4, 'EDT': b'\x00\n\xff\xec'}, {'EPC': 211, 'PDC': 4, 'EDT': b'\x00\x00\x00\x01'}]}
2023-12-18 08:47:12.710 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - tid_data is {}
2023-12-18 08:47:12.796 DEBUG (MainThread) [custom_components.echonetlite] Polling ECHONET Instance host at 172.16.0.152 succeeded. Retry 2 of 3
2023-12-18 08:48:13.035 DEBUG (MainThread) [custom_components.echonetlite] Polling ECHONET Instance host 172.16.0.152 timed out. Retry 1 of 3
2023-12-18 08:48:18.108 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Raw data is b'\x10\x81\x00W\x02\x88\x01\x05\xff\x01R\x06\x80\x010\xe0\x04\x00\x00\x12<\xe3\x04\x00\x00 \xdd\xe7\x04\xff\xff\xff\xff\xe8\x04\x00\n\xff\xec\xd3\x04\x00\x00\x00\x01'
2023-12-18 08:48:18.109 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 87, 'SEOJGC': 2, 'SEOJCC': 136, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 82, 'OPC': [{'EPC': 128, 'PDC': 1, 'EDT': b'0'}, {'EPC': 224, 'PDC': 4, 'EDT': b'\x00\x00\x12<'}, {'EPC': 227, 'PDC': 4, 'EDT': b'\x00\x00 \xdd'}, {'EPC': 231, 'PDC': 4, 'EDT': b'\xff\xff\xff\xff'}, {'EPC': 232, 'PDC': 4, 'EDT': b'\x00\n\xff\xec'}, {'EPC': 211, 'PDC': 4, 'EDT': b'\x00\x00\x00\x01'}]}
2023-12-18 08:48:18.109 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - tid_data is {}
2023-12-18 08:48:18.183 DEBUG (MainThread) [custom_components.echonetlite] Polling ECHONET Instance host at 172.16.0.152 succeeded. Retry 2 of 3
2023-12-18 08:48:47.634 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Raw data is b'\x10\x81\x00h\x02\x88\x01\x05\xff\x01R\x06\x80\x010\xe0\x04\x00\x00\x12<\xe3\x04\x00\x00 \xdd\xe7\x04\x00\x00\x00\x01\xe8\x04\x00\n\xff\xec\xd3\x04\x00\x00\x00\x01'
2023-12-18 08:48:47.634 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 104, 'SEOJGC': 2, 'SEOJCC': 136, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 82, 'OPC': [{'EPC': 128, 'PDC': 1, 'EDT': b'0'}, {'EPC': 224, 'PDC': 4, 'EDT': b'\x00\x00\x12<'}, {'EPC': 227, 'PDC': 4, 'EDT': b'\x00\x00 \xdd'}, {'EPC': 231, 'PDC': 4, 'EDT': b'\x00\x00\x00\x01'}, {'EPC': 232, 'PDC': 4, 'EDT': b'\x00\n\xff\xec'}, {'EPC': 211, 'PDC': 4, 'EDT': b'\x00\x00\x00\x01'}]}
2023-12-18 08:48:47.634 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - tid_data is {}
2023-12-18 08:49:43.040 DEBUG (MainThread) [custom_components.echonetlite] Polling ECHONET Instance host 172.16.0.152 timed out. Retry 1 of 3
2023-12-18 08:49:47.834 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Raw data is b'\x10\x81\x00\x8a\x02\x88\x01\x05\xff\x01R\x06\x80\x010\xe0\x04\x00\x00\x12<\xe3\x04\x00\x00 \xdd\xe7\x04\x00\x00\x00\x01\xe8\x04\x00\n\xff\xec\xd3\x04\x00\x00\x00\x01'
2023-12-18 08:49:47.834 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 138, 'SEOJGC': 2, 'SEOJCC': 136, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 82, 'OPC': [{'EPC': 128, 'PDC': 1, 'EDT': b'0'}, {'EPC': 224, 'PDC': 4, 'EDT': b'\x00\x00\x12<'}, {'EPC': 227, 'PDC': 4, 'EDT': b'\x00\x00 \xdd'}, {'EPC': 231, 'PDC': 4, 'EDT': b'\x00\x00\x00\x01'}, {'EPC': 232, 'PDC': 4, 'EDT': b'\x00\n\xff\xec'}, {'EPC': 211, 'PDC': 4, 'EDT': b'\x00\x00\x00\x01'}]}
2023-12-18 08:49:47.835 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - tid_data is {}
2023-12-18 08:49:47.879 DEBUG (MainThread) [custom_components.echonetlite] Polling ECHONET Instance host at 172.16.0.152 succeeded. Retry 2 of 3
2023-12-18 08:50:17.856 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Raw data is b'\x10\x81\x00\x9b\x02\x88\x01\x05\xff\x01R\x06\x80\x010\xe0\x04\x00\x00\x12<\xe3\x04\x00\x00 \xdd\xe7\x04\xff\xff\xff\xfe\xe8\x04\x00\x14\xff\xec\xd3\x04\x00\x00\x00\x01'
2023-12-18 08:50:17.856 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 155, 'SEOJGC': 2, 'SEOJCC': 136, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 82, 'OPC': [{'EPC': 128, 'PDC': 1, 'EDT': b'0'}, {'EPC': 224, 'PDC': 4, 'EDT': b'\x00\x00\x12<'}, {'EPC': 227, 'PDC': 4, 'EDT': b'\x00\x00 \xdd'}, {'EPC': 231, 'PDC': 4, 'EDT': b'\xff\xff\xff\xfe'}, {'EPC': 232, 'PDC': 4, 'EDT': b'\x00\x14\xff\xec'}, {'EPC': 211, 'PDC': 4, 'EDT': b'\x00\x00\x00\x01'}]}
2023-12-18 08:50:17.856 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - tid_data is {}
2023-12-18 08:50:47.659 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Raw data is b'\x10\x81\x00\xac\x02\x88\x01\x05\xff\x01R\x06\x80\x010\xe0\x04\x00\x00\x12<\xe3\x04\x00\x00 \xdd\xe7\x04\x00\x00\x00\x02\xe8\x04\x00\n\xff\xec\xd3\x04\x00\x00\x00\x01'
2023-12-18 08:50:47.660 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 172, 'SEOJGC': 2, 'SEOJCC': 136, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 82, 'OPC': [{'EPC': 128, 'PDC': 1, 'EDT': b'0'}, {'EPC': 224, 'PDC': 4, 'EDT': b'\x00\x00\x12<'}, {'EPC': 227, 'PDC': 4, 'EDT': b'\x00\x00 \xdd'}, {'EPC': 231, 'PDC': 4, 'EDT': b'\x00\x00\x00\x02'}, {'EPC': 232, 'PDC': 4, 'EDT': b'\x00\n\xff\xec'}, {'EPC': 211, 'PDC': 4, 'EDT': b'\x00\x00\x00\x01'}]}
2023-12-18 08:50:47.660 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - tid_data is {}
2023-12-18 08:51:17.811 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Raw data is b'\x10\x81\x00\xbd\x02\x88\x01\x05\xff\x01R\x06\x80\x010\xe0\x04\x00\x00\x12<\xe3\x04\x00\x00 \xdd\xe7\x04\xff\xff\xff\xff\xe8\x04\x00\n\xff\xf6\xd3\x04\x00\x00\x00\x01'
2023-12-18 08:51:17.811 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 189, 'SEOJGC': 2, 'SEOJCC': 136, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 82, 'OPC': [{'EPC': 128, 'PDC': 1, 'EDT': b'0'}, {'EPC': 224, 'PDC': 4, 'EDT': b'\x00\x00\x12<'}, {'EPC': 227, 'PDC': 4, 'EDT': b'\x00\x00 \xdd'}, {'EPC': 231, 'PDC': 4, 'EDT': b'\xff\xff\xff\xff'}, {'EPC': 232, 'PDC': 4, 'EDT': b'\x00\n\xff\xf6'}, {'EPC': 211, 'PDC': 4, 'EDT': b'\x00\x00\x00\x01'}]}
2023-12-18 08:51:17.811 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - tid_data is {}
2023-12-18 08:51:47.561 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Raw data is b'\x10\x81\x00\xce\x02\x88\x01\x05\xff\x01R\x06\x80\x010\xe0\x04\x00\x00\x12<\xe3\x04\x00\x00 \xdd\xe7\x04\x00\x00\x00\x00\xe8\x04\x00\n\xff\xec\xd3\x04\x00\x00\x00\x01'
2023-12-18 08:51:47.561 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 206, 'SEOJGC': 2, 'SEOJCC': 136, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 82, 'OPC': [{'EPC': 128, 'PDC': 1, 'EDT': b'0'}, {'EPC': 224, 'PDC': 4, 'EDT': b'\x00\x00\x12<'}, {'EPC': 227, 'PDC': 4, 'EDT': b'\x00\x00 \xdd'}, {'EPC': 231, 'PDC': 4, 'EDT': b'\x00\x00\x00\x00'}, {'EPC': 232, 'PDC': 4, 'EDT': b'\x00\n\xff\xec'}, {'EPC': 211, 'PDC': 4, 'EDT': b'\x00\x00\x00\x01'}]}
2023-12-18 08:51:47.561 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - tid_data is {}
2023-12-18 08:55:47.736 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - tid_data is {}
2023-12-18 08:55:47.736 DEBUG (MainThread) [custom_components.echonetlite] 
ECHONETlite polling update data:
 - Operation status (0x80): On
 - Operation status (0x80): On
 - Measured cumulative amount of electric energy (normal direction) (0xe0): 4668
 - Measured cumulative amounts of electric energy (reverse direction) (0xe3): 8413
 - Measured instantaneous electric energy (0xe7): 1
 - Measured instantaneous currents (0xe8): {'r_phase_amperes': 1.0, 't_phase_amperes': -2.0}
 - Coefficient (0xd3): 1
 - Unit for cumulative amounts of electric energy (normal and reverse directions) (0xe1): None

2023-12-18 08:55:47.751 DEBUG (MainThread) [custom_components.echonetlite] 
ECHONETlite polling update data:
 - Operation status (0x80): On
 - Operation status (0x80): On
 - Measured cumulative amount of electric energy (normal direction) (0xe0): 4668
 - Measured cumulative amounts of electric energy (reverse direction) (0xe3): 8413
 - Measured instantaneous electric energy (0xe7): 1
 - Measured instantaneous currents (0xe8): {'r_phase_amperes': 1.0, 't_phase_amperes': -2.0}
 - Coefficient (0xd3): 1
 - Unit for cumulative amounts of electric energy (normal and reverse directions) (0xe1): None

this is part of logs

scottyphillips-work commented 6 months ago

Looks like a broken implementation of 0xE1, or your Toshiba perhaps has a silly limit to the number of EPC requests it can handle?

Two options here: Option 1 - Will definitely work. Change the code in sensor.py as I suggested originally to accommodate your use case:

     ]:  # Measured cumulative amounts normal or revers
                if self._eojgc == 0x02 and self._eojcc == 0x88:
                    if self._connector._update_data.get(0xE1):
                        coef = self._connector._update_data.get(0xD3) or 1
                        return (
                            self._state_value
                            * coef
                            * self._connector.update_data[0xE1]
                        )  # value in kWh
                    else:
                        return self._state_value * 0.1

Option 2 - might not work - tune down the number of requests per packet: In __init__.py of the custom component there is a setting:

PARALLEL_UPDATES = 0
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=1)
MAX_UPDATE_BATCH_SIZE = 10

Change to : MAX_UPDATE_BATCH_SIZE = 5

leonunix commented 6 months ago

@scottyphillips-work you are right. I think SmartElectricEnergyMeter is work on wisun interface. So it has some limit on it . I change MAX_UPDATE_BATCH_SIZE to 5. It works.

2023-12-18 10:02:57.698 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 174, 'SEOJGC': 2, 'SEOJCC': 136, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 114, 'OPC': [{'EPC': 211, 'PDC': 4, 'EDT': b'\x00\x00\x00\x01'}, {'EPC': 225, 'PDC': 1, 'EDT': b'\x01'}]}
2023-12-18 10:02:57.698 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - tid_data is {}
2023-12-18 10:02:57.755 DEBUG (MainThread) [custom_components.echonetlite] 
ECHONETlite polling update data:
 - Operation status (0x80): None
 - Operation status (0x80): None
 - Measured cumulative amount of electric energy (normal direction) (0xe0): None
 - Measured cumulative amounts of electric energy (reverse direction) (0xe3): None
 - Measured instantaneous electric energy (0xe7): None
 - Measured instantaneous currents (0xe8): None
 - Coefficient (0xd3): 1
 - Unit for cumulative amounts of electric energy (normal and reverse directions) (0xe1): 0.1
scottyphillips commented 6 months ago

I’m sure there is some way we can made this batch size sliding to accommodate this issue in the future, by perhaps comparing the expected number of EPCs with the number actually received and adjusting on the fly.

Scott

Sent from my iPhone

On 18 Dec 2023, at 12:04 pm, leonunix @.***> wrote:



@scottyphillips-workhttps://github.com/scottyphillips-work you are right. I think SmartElectricEnergyMeter is work on wisun interface. So it has some limit on it . I change MAX_UPDATE_BATCH_SIZE to 5. It works.

2023-12-18 10:02:57.698 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 174, 'SEOJGC': 2, 'SEOJCC': 136, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 114, 'OPC': [{'EPC': 211, 'PDC': 4, 'EDT': b'\x00\x00\x00\x01'}, {'EPC': 225, 'PDC': 1, 'EDT': b'\x01'}]} 2023-12-18 10:02:57.698 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received from 172.16.0.152 - tid_data is {} 2023-12-18 10:02:57.755 DEBUG (MainThread) [custom_components.echonetlite] ECHONETlite polling update data:

— Reply to this email directly, view it on GitHubhttps://github.com/scottyphillips/echonetlite_homeassistant/issues/150#issuecomment-1859372739, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGHQNDBRDYMIOLU6S2B7OCLYJ6I73AVCNFSM6AAAAABACH2S5SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJZGM3TENZTHE. You are receiving this because you were mentioned.Message ID: @.***>

nao-pon commented 5 months ago

I started working on this. I'm considering adding an option for max number of batches and further auto-adjusting that value.

nao-pon commented 5 months ago

If you are willing to try it out, you can try out the modified features in my echonetlite edge branch.

nao-pon commented 5 months ago

@leonunix This is probably resolved by #159. It is currently applied to the master version, so could you please verify it?