emilohman / node-red-contrib-plejd

A set of Node-RED nodes for interacting with Plejd.
MIT License
4 stars 1 forks source link

Error: error:0607F08A:digital envelope routines:EVP_EncryptFinal_ex:data not multiple of block length #3

Open Jamelnacef opened 5 years ago

Jamelnacef commented 5 years ago

Hi,

I receive this error after I've setup one flow of Plejd.

I run node-red v1.0.0 on my MacBook Pro Mojave v10.14.4 and node-red-contrib-plejd v.0.0.7

Below is my node-red log and my flow ....

What am I missing? I also receive similar error while sending to Plejd out.

2 Oct 21:48:29 - [info] Starting flows 2 Oct 21:48:29 - [info] Started flows 2 Oct 21:48:29 - [info] Server now running at http://127.0.0.1:1880/ 2 Oct 21:48:31 - [info] [plejd:Plejd IN] Plejd setup is complete 2 Oct 21:48:37 - [error] [plejd out:Plejd OUT] Error: error:0607F08A:digital envelope routines:EVP_EncryptFinal_ex:data not multiple of block length FATAL ERROR: error:0607F08A:digital envelope routines:EVP_EncryptFinal_ex:data not multiple of block length 1: 0x10003d035 node::Abort() [/usr/local/bin/node] 2: 0x10003d23f node::OnFatalError(char const*, char const*) [/usr/local/bin/node] 3: 0x10003d1f5 node::OnFatalError(char const*, char const*) [/usr/local/bin/node] 4: 0x100045d77 napi_create_function [/usr/local/bin/node] 5: 0x10634e641 Napi::Error::Fatal(char const*, char const*) [/Users/jamelnacef/.node-red/node_modules/@abandonware/noble/lib/mac/native/binding.node] 6: 0x106359c45 ThreadSafeCallback::Impl::static_async_callback(uv_async_s*) [/Users/jamelnacef/.node-red/node_modules/@abandonware/noble/lib/mac/native/binding.node] 7: 0x1009b5cc3 uv__async_io [/usr/local/bin/node] 8: 0x1009c60fb uv__io_poll [/usr/local/bin/node] 9: 0x1009b6139 uv_run [/usr/local/bin/node] 10: 0x100044831 node::Start(v8::Isolate*, node::IsolateData*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) [/usr/local/bin/node] 11: 0x100043d3c node::Start(uv_loop_s*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) [/usr/local/bin/node] 12: 0x100043886 node::Start(int, char**) [/usr/local/bin/node] 13: 0x100001034 start [/usr/local/bin/node] Abort trap: 6

Exported flow below:

[{"id":"b31b9b1d.f07798","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"fe25e1e1.7e9e48","type":"plejd in","z":"b31b9b1d.f07798","name":"Plejd IN","plejd":"e54ad567.ad56f","x":150.5,"y":221,"wires":[["f25a2621.98131"]]},{"id":"f25a2621.98131","type":"debug","z":"b31b9b1d.f07798","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","x":622.5,"y":221,"wires":[]},{"id":"ee3079ba.5931d8","type":"plejd out","z":"b31b9b1d.f07798","name":"Plejd OUT","plejd":"e54ad567.ad56f","x":614.5,"y":333,"wires":[]},{"id":"fac3693d.c78bd8","type":"inject","z":"b31b9b1d.f07798","name":"","topic":"","payload":"{id: 12, state: 'on', dim: 255}","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":185.5,"y":334,"wires":[["e6508e1a.e71f28"]]},{"id":"e6508e1a.e71f28","type":"function","z":"b31b9b1d.f07798","name":"code","func":"msg.payload = {id: 16, state: 'on', dim: 255}\nreturn msg;","outputs":1,"noerr":0,"x":365.5,"y":335,"wires":[["ee3079ba.5931d8"]]},{"id":"e54ad567.ad56f","type":"plejd","z":"","name":"Plejd IN","cryptoKey":"C5DD22D1AB2CF7CC37F0A7245EBF810D"}]

emilohman commented 5 years ago

I can´t even install it on my mac. I´ve only been running it on my raspberry pi. But after some googling it may have something to do with the crypto code.

Could you please try to edit the file /Users/jamelnacef/.node-red/node_modules/node-red-contrib-plejd/plejd.js (based on your log above..) and remove line 323: cipher.setAutoPadding(false) and then restart node-red? If it works I'll create a new release without it.

Jamelnacef commented 5 years ago

Thanks for your reply!

That did indeed work for the error.

But however, I receive very high values on the dim value on the Plejd in payload, please see below:

1st I switch on one controller from push button: {"id":139,"state":"On","dim":65535}

Then I switch it off from same push button: {"id":138,"state":"On","dim":65535}

It's probably the inputAddress of the buttons I believe, since this device has ID 16 in my. sites file.

On the other side, when I try to control the same device with played out nothing happens, I tried to send these two on msg.payload:

{id: 16, state: 'on', dim: 255} {id: 16, state: 'off', dim: 100}

However nothing happens and there is no output in the node-red console log.

Thank you!

Jamelnacef commented 5 years ago

I believe this can be related to the bluetooth driver of Mac OSx, I will test my setup on a RPI 3 instead.

But thanks for the help :D

emilohman commented 5 years ago

Strange.. please let me know how it works out for you on your raspberry.

Jamelnacef commented 5 years ago

It works well on my Raspberry. Though, I can't use the Plejd app while running Plejd node, you have same issue ?

emilohman commented 5 years ago

yes unfortunately, it's because Plejd can only be connect to one device at the time. It's the same for the home assistant plugin that I have ported.