scottyphillips/echonetlite_homeassistant

Support for IP/JEM-A Switches

Closed this issue · 27 comments

Now that there's support for water heater switches and the like, it would be fantastic if there was support for IP/JEM-A switches. I have a number of shutters in the home that are connected to these -- I believe they are compatible with Echonetlite:

https://echonet.jp/introduce/gz-000761/

This whole project is fantastic. Thank you so much for making it.

Sure we can take a look. Try adding the device via it’s IP address and let me know what the output is.

Thanks! This appears to be the only echonetlite related logging I can find in the home assistant log around the time I tried adding the device:

Logger: homeassistant
Source: custom_components/echonetlite/sensor.py:282 
Integration: ECHONETLite ([documentation](https://www.github.com/scottyphillips/echonetlite_homeassistant), [issues](https://github.com/scottyphillips/echonetlite_homeassistant/issues)) 
First occurred: 10:52:47 AM (1 occurrences) 
Last logged: 10:52:47 AM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pychonet/echonetapiclient.py", line 69, in echonetMessageReceived
    await update_func(isPush)
  File "/config/custom_components/echonetlite/__init__.py", line 327, in async_update_callback
    await update_func(isPush)
  File "/config/custom_components/echonetlite/sensor.py", line 282, in async_update_callback
    changed = self._state_value != self._instance._update_data[self._op_code]
KeyError: 180

Yes that's correct.

This appears to be the relevant logging:

2022-09-01 11:35:24 DEBUG (MainThread) [custom_components.echonetlite.config_flow] IP address is 192.168.40.15
2022-09-01 11:35:24 DEBUG (MainThread) [custom_components.echonetlite.config_flow] Beginning ECHONET node discovery
2022-09-01 11:35:47 DEBUG (MainThread) [custom_components.echonetlite.config_flow] ECHONET Node Discovery Failed!

It's strange -- I'm able to ping the devices just fine. I have 3 of these adapters and each results in the above logging.

Using the SSNG iOS tool from the support center appears to work. It's not the most straightforward interface, but it gives me this data:

EOJ: 05FD01
  ESV: 61
    EPC: 80
      EDT: 30, 31
    EPC: 81
      EDT: 00, 08, 10, 18, 20, 28, 30, 38, 40, 48, 50, 58, 60, 68 70, 78, FF
    EPC: F1
      EDT: [2 byte hex]
  ESV: 62
    EPC: 80, 81, 82, 83, 88, 8A, 8C, 9D, 9E, 9F, F0, F1

I hope this information helps.

How can I provide you that logging? This appears to be the only logging coming from custom_components.echonetlite. I just tried again after a restart and it's the same output.

The error message indicates that the response does not contain data that should be included in get properties. This may be a bug in the Panasonic device, making the integration ignore it may fix it.

I'm not very familiar with python, and I'm much less familiar with echonet lite as a protocol, but I'm happy to try steps out in a python repl with pychonet if that would help.

Now try the following on the command line and let us know the result.

python3 -m asyncio
from pychonet.lib.udpserver import UDPServer
from pychonet import ECHONETAPIClient as api

udp = UDPServer()
loop = asyncio.get_event_loop()
udp.run("0.0.0.0", 3610, loop)
server = api(udp)
server._debug_flag = True
await server.discover('192.168.40.15')

Both pychonet and the home assistant plugin appear to discover the device now after a few more restarts. Here's what I get from the JEM-A adapter at 192.168.40.14:

>>> await server.discover('192.168.40.14')
ECHONETLite Message Received - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 1, 'SEOJGC': 14, 'SEOJCC': 240, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 114, 'OPC': [{'EPC': 138, 'PDC': 3, 'EDT': b'\x00\x00\x0b'}, {'EPC': 131, 'PDC': 17, 'EDT': b'\xfe\x00\x00\x0b\x00\x00\x0e\xf0\x01L6N\xff\xfe\xce\xd6\xa0'}, {'EPC': 214, 'PDC': 4, 'EDT': b'\x01\x05\xfd\x01'}]}
True

While the device appears to be added, it's a bit finicky:

  • A single switch is exposed, starting in the OFF position, and the shutter is open (i.e.: it is not covering the window)
  • If you press the switch, it toggles to ON, and the shutter begins to close (i.e.: it covers the window)
  • At some point before the shutter fully closes, the switch goes back to OFF
  • To re-open the shutter, you need to toggle the switch to 'ON', then to 'OFF'. At that point, the shutter opens

This is what I see when doing the above:

Close:

2022-09-01 19:45:32 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 354, 'SEOJGC': 5, 'SEOJCC': 253, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 113, 'OPC': [{'EPC': 128, 'PDC': 0, 'EDT': b''}]}

Press Once from OFF to ON

2022-09-01 19:46:16 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 355, 'SEOJGC': 5, 'SEOJCC': 253, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 113, 'OPC': [{'EPC': 128, 'PDC': 0, 'EDT': b''}]}

Press Once from ON to OFF (opens)

2022-09-01 19:46:17 DEBUG (MainThread) [custom_components.echonetlite] ECHONETLite Message Received - Processed data is {'EHD1': 16, 'EHD2': 129, 'TID': 356, 'SEOJGC': 5, 'SEOJCC': 253, 'SEOJCI': 1, 'DEOJGC': 5, 'DEOJCC': 255, 'DEOJCI': 1, 'ESV': 113, 'OPC': [{'EPC': 128, 'PDC': 0, 'EDT': b''}]}

It seems to be the same issue as #110. There is a bug in the pychonet library and I will fix this.

Ok! I'm happy to verify and close both issues after!

pychonet 2.3.3 was released. so please try "pychonet==2.3.3".

"requirements": [
"pychonet==2.3.2"
],

to

 "requirements": [ 
   "pychonet==2.3.3" 
 ], 

Yes, that's right. Be sure to restart HA.

It's working! Thank you! I tested this for the water heater as well and it appears to work. Shall I close these?

Ah. Hm. I just tried again and the switch appears to go back to OFF...

And just like that I can't get it to reproduce again. Might just be a fluke and it's working now. Here were my steps:

  1. stop the homeassistant docker instance
  2. edit the manifest.json file for the echonet custom component to require pychonet==2.3.3
  3. start the homeassistant docker instance
  4. wait for startup to complete
  5. flip the shutter switch on / off

要するに: I believe this is resolved, and along with 110. Shall I close these? I can open a new issue if I encounter any strangeness.

(and thank you!!!)

Thank you for your validation. I am glad that this issue has been resolved.

Since wireless LAN is used, it may become unstable depending on the radio wave conditions. On unstable devices, forcing polling in the configuration may give good results.

I will close this as the next version 3.6.1 will be released with this issue fixed. Thanks! 👍

@aftertommy Version 3.6.2 has been released. It contains a modification that provides a more stable response.

giving it a shot!

This looks to be working!