elad-bar / DahuaVTO2MQTT

Listens to events from Dahua VTO unit and publishes them via MQTT Message
103 stars 39 forks source link

Help porting this to node #18

Closed cibernox closed 3 years ago

cibernox commented 3 years ago

Hi,

I'm trying to port the php logic into Node.js for easier integration with node-red. My php-fu is rather week so I'm having some problems understanding the logic on the Send method.

Can you add some comments or explain the kind of messages/headers we should be sending to the doorbell? Is that documented somewhere or did you just reverse-enginnered this by inspecting traffic on the network?

Thanks

elad-bar commented 3 years ago

I took the original PHP and added more on top of that, I'm not a PHP developer but knows a bit si I extended it, Tried to port it to python but didn't manage so far...

cibernox commented 3 years ago

@elad-bar Thanks, I'll check on the original repo.

cibernox commented 3 years ago

FWIW, I managed to port this to node.js successfully. It took some digging but it's now far clearer what this thingy does when compared with the inscrutable PHP. Turns out that node's evented nature makes socket communication much simpler.

It's not ready to be shared. I need to clean up things and and not hardcode my password (😆) but if you are interested I can share it with you in case you prefer to dockerize the node.js version.

Also, now that I understand what the code does, porting it to python should be reasonably easy (considering I haven't written a single line of python in 12 years). If this was ported to python, would it be necessary to dockerize it or since home assistant is already python it could run directly?