morrijr / node-red-contrib-nanoleaf-aurora

Node-Red contribution. Control Nanoleaf Aurora

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Boolean output of power-status-node delivers object

narolinus opened this issue · comments

Hello, thanks for your great node, which works really nice in my setup for many month now!

But since the last update i encountered a small problem: The power-status-node no longer sends a boolean on the output but an object like {value: true}.

I have to admit that i did not update for some month before this, and i am not completly sure, in which version the problem occurred first.

It is not a big problem, because you can easily workaround this by placing a change-node to convert the object, but it would be nice if it could be fixed in a future version.

EDIT: The integer and string outputs are not working, too. They always return "ON" or 1.

It was quite easy to fix this locally by replacing all three occurrences of info in the definiton of convertOutput inside power-status.js with info.value. I don't know if there are any side effects but this works for me.

Diff for power-status.js:

13c13
<                     return info.value
---
>                     return info
15c15
<                     return info.value ? 1 : 0
---
>                     return info ? 1 : 0
18c18
<                     return info.value ? 'ON' : 'OFF'
---
>                     return info ? 'ON' : 'OFF'

commented

Hi Narolinus,

Thanks for the report and suggestion!

I've committed a correction, not quite what you had above, but thanks for saving me the effort of working out what was wrong!

The new implementation has been published on npmjs, but it might take node-red a few hours to notice.

Regards,

J.

Great. Thank you very much. 👍