Hlk-dio16 how to connect homeassistant

I’m glad to hear the news, Can I use it now

Well you can use the new config flow with the hlk-sw16 if you check out the dev branch, but I haven’t received and done the hlk-dio16 integration yet.

HLK-DIO cannot be integrated into homeassistant now?

No, not yet.

How’s it going, how’s HLK-DIO going

Well I just received the device from @mehdi38 and started poking around at it, the HLK-DIO16 appears to function somewhat similar to the HLK-SW16 at a high level, although the packet format is definitely different and it has a few additional features.

It appears to be the same sort of bridged internal serial device design that the HLK-SW16 uses where the Linux operating system handling the networking is just a passthrough to some sort of MCU.

I haven’t been able to obtain reference source code or the windows app from hlktech yet but did find the android app which has a lot of debug logging enabled which makes it fairly easy to trace command logic, although still somewhat time consuming.

I was also able to de-compile the android app…which is a fairly typical example of terribly written Chinese hardware OEM interface code, it’s not intentionally obfuscated but the variable naming is this strange combination of English words along with Chinese words phonetically translated to a Latin alphabet(for example one variable is named COMMAND_READ_DIANDONG_TIME).

If anyone here happens to speak Chinese and would be interested in translating these sorts of things let me know, I pretty much have to trace the code logic to figure out what they mean since google translate doesn’t really work on Chinese when it’s phonetically translated to a Latin alphabet.

I’m Chinese, how do I work with you

I’ll PM you.

Started playing around with this, got state response decoding working so far.

INFO:hlk_dio16.protocol:data received: 6a:a6:05:ff:01:46:00:4b:6a:a6:04:06:aa:aa:5e
INFO:hlk_dio16.protocol:got frame: ff:01:46:00
INFO:hlk_dio16.protocol:cmd: TYPE_YINGDA, data: 01:46:00
INFO:hlk_dio16.protocol:got frame: 06:aa:aa
INFO:hlk_dio16.protocol:cmd: OUTPUT_STATE, data: aa:aa
INFO:hlk_dio16.protocol:states: {1: False, 2: True, 3: False, 4: True, 5: False, 6: True, 7: False, 8: True, 9: False, 10: True, 11: False, 12: True, 13: False, 14: True, 15: False, 16: True}
1 Like

please update hlk-dio-16 or any idea how to connect home assistant with hlk-dio16

working on the integration still

Got some basic status dumping working now. Library is here.

python3 -m pip install hlk-dio16
python3 -m hlk_dio16.tools.info --host=192.168.1.150

example:

DEBUG:asyncio:Using selector: KqueueSelector
INFO:hlk_dio16.protocol:connected
DEBUG:hlk_dio16.protocol:sending packet: 6a:a6:03:fe:06:07
INFO:hlk_dio16.protocol:data received: 6a:a6:04:06:fd:ff:06
INFO:hlk_dio16.protocol:cmd: OUTPUT_STATE, data: fd:ff
DEBUG:hlk_dio16.protocol:output states: {1: True, 2: False, 3: True, 4: True, 5: True, 6: True, 7: True, 8: True, 9: True, 10: True, 11: True, 12: True, 13: True, 14: True, 15: True, 16: True}
INFO:__main__:output_state:
{1: True,
 2: False,
 3: True,
 4: True,
 5: True,
 6: True,
 7: True,
 8: True,
 9: True,
 10: True,
 11: True,
 12: True,
 13: True,
 14: True,
 15: True,
 16: True}
DEBUG:hlk_dio16.protocol:sending packet: 6a:a6:03:fe:07:08
INFO:hlk_dio16.protocol:data received: 6a:a6:04:07:00:00:0b
INFO:hlk_dio16.protocol:cmd: INPUT_STATE, data: 00:00
DEBUG:hlk_dio16.protocol:input states: {1: False, 2: False, 3: False, 4: False, 5: False, 6: False, 7: False, 8: False, 9: False, 10: False, 11: False, 12: False, 13: False, 14: False, 15: False, 16: False}
INFO:__main__:input_state:
{1: False,
 2: False,
 3: False,
 4: False,
 5: False,
 6: False,
 7: False,
 8: False,
 9: False,
 10: False,
 11: False,
 12: False,
 13: False,
 14: False,
 15: False,
 16: False}
DEBUG:hlk_dio16.protocol:sending packet: 6a:a6:03:fe:02:03
INFO:hlk_dio16.protocol:data received: 6a:a6:08:02:02:08:15:0a:24:20:77
INFO:hlk_dio16.protocol:cmd: DEVICE_TIME, data: 02:08:15:0a:24:20
DEBUG:hlk_dio16.protocol:device time: {'Year': 2020, 'Month': 8, 'Day': 21, 'Hour': 10, 'Minute': 36, 'Second': 32}
INFO:__main__:device_time:
{'Day': 21, 'Hour': 10, 'Minute': 36, 'Month': 8, 'Second': 32, 'Year': 2020}
DEBUG:hlk_dio16.protocol:Shutting down.
INFO:hlk_dio16.protocol:disconnected because of close/abort.

this only info from hik-dio16 need connect to home-assistant any idea

hello any update

I haven’t finished the integration yet, got partway through but have been rather busy with work lately so haven’t had a lot of time to work on it.

hello I have the Dio 16 and this is the first good new I read. You have a ideer when it will be ready jameshilliard?

Thanks

If that helps I get the Dio 16 direct from HLK and get a documentation. With seplar and a code list.

Please upload any progress hlk-dio16 with homeassistant or modebus connection

This is my email [email protected]

I send you a mail.