New Node-RED add-on

@korylprince, Yes the certificate is legit, no, the hostname didn’t match because you said under your configuration that the hostname needed to literally be homeassistant. However, changing the base URL to match the cert still isn’t able to connect.

Not using SSL isn’t an option, because I’ll often edit or write new automations when I’m not on my home network. I’ll just go back to notoriousbdg’s version. Thanks for making this addon! I’ll give it another try in a month or two.

@oakbrad, Yes, I’ve previously been using the other addon through SSL without issues. The same setup doesn’t work with this one.

@oakbrad are you the author of DIY Futurism? If so, thanks! That blog inspired me to start using Node-RED.

@HeffeD

Yeah I wasn’t considering people connecting through SSL when writing that. I’ve updated the README to clarify.

Note that you can use an SSL proxy to connect to home assistant, node-red, etc but still have the connection between home assistant and node-red be just HTTP; that’s how I run mine.

If you do want to connect the add-on to Home Assistant using SSL you can do that too. Use the SSL certificate hostname, and do the DNS config like the post linked above where your local DNS resolves your SSL hostname to your local Hass.io IP.

OK, it’s working with SSL now… Either I was having a major brain fart, or my Pi (possibly an addon?) was unhappy. I had tried setting it up the same way I’ve been running notoriousbdg’s version with SSL, (the same method outlined on DIY Futurism, including resolving my SSL domain to my local HA server using Pi-hole) but it wouldn’t work.

This time, I rebooted my Pi before installing your Node Red addon, and this time it’s working! I really wish I had more info to give you, but to the best of my knowledge, both setups were exactly the same, aside from the fact that one works, and one didn’t…

Thanks again for your addon! I really like the smaller footprint, and that it doesn’t need to build locally.

The latest upgrade did upgrade Node-RED to 0.18.2 from 0.18.0. I really doubt that had anything to do with it but I can’t rule it out.

In terms of networking, the only difference between my add-on and NotoriousBDG’s is his has host networking turned on and I don’t. I try to avoid host networking unless necessary because I don’t want to expose any more attack surfaces than necessary. If there’s a demand for it I’ll consider turning it on, though. Host networking or not won’t affect how the DNS is resolving, though, so the same SSL setup should work for either.

I’m glad you got it working!

I can confirm it’s working again in version 1.5.

Thank you.

Anyone else have all of the Home Assistant nodes lose their icons?
Error: ENOENT: no such file or directory, stat ‘/share/node-red/node_modules/node-red-contrib-home-assistant/node-server-events/icons/arrow-right-bold.png’

There’s an error for each node. Looking in the share folder, that directory is indeed gone.

I’m not seeing that issue after updating my add-on. One thing to try would be to use the Node-RED GUI to remove then re-add the node-red-contrib-home-assistant palette.

If that doesn’t work, stop the add-on, remove the whole /share/node-red/node_modules/node-red-contrib-home-assistant folder, then restart the add-on. It should reinstall everything.

Let me know if neither of those work and we can dig deeper.

I used the stop/start addon method which worked great. (Seemed easiest because I had HA nodes in use) I didn’t need to remove the node-red-contrib-home-assistant folder because it wasn’t there. There were apparently quite a few folders missing in the node_modules folder. There are 13 more folders now, than there were before. Not quite sure what to make of that, because I hadn’t touched that directory until I noticed the missing icons and error message.

Edit: (I had previously deleted the Node-Red directory left from the other addon before installing this one)

Thanks for your help!

It looks like the ssl configuration from the add-on’s options input isn’t respected @korylprince.

Even though ssl is set to true the server is running at http instead of https.

Options:

{
  "ssl": true,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  ...
}

Log:

[info] Server now running at http://127.0.0.1:1880/

Hmm, looks like it’s working fine here. You did restart the add-on after saving the changes, right?

Have you made any manual changes to settings.js?

If you haven’t made any manual changes, stop the add-on, remove settings.js, then start the add-on again.

Also, post the full logs from the starting version 3.2.4 line to the [info] Starting flows line (it may take a few seconds for all of the log messages to show up.)

Letting the add-on recreate settings.js solved the problem, but I’ve noticed the error returns when restarting the add-on. Every time the add-on is restarted some of the lines in setting.js get comment delimiters (//) added to them.

This includes the lines required for the https setup disabling https again…

I just pushed version 1.6. The container was missing git which caused trying to update node-red-contrib-home-assistant to fail. I’m not sure if there was a change on the npm package or what.

In any case, 0.3.0 is included in the new image.

Updated, and its rooted my flows.
states are now not updated, but some randomly work… almost impossible to debug.

Anyone else have the same?

Also get this on the log;

20 Feb 21:23:41 - [warn] Cannot find Pi RPi.GPIO python library
20 Feb 21:23:45 - [warn] ------------------------------------------------------
20 Feb 21:23:45 - [warn] [node-red/rpi-gpio] Warning : Cannot find Pi RPi.GPIO python library
20 Feb 21:23:45 - [warn] ------------------------------------------------------

@viperIII I’m sorry to hear that. By “rooted” you just mean “messed up”, right?

Are the nodes not appearing, or do they just not seem to be working?

I’ve seen issues before where if Node-RED is restarted the current-state nodes won’t work and Home Assistant sends a new state for that node. i.e. It doesn’t check the state when Node-RED is started, it waits for the state to come in. Could that be the issue you’re having?

Please restart the add-on, wait a couple of minutes, and then post the add-on logs.

The log messages are a known issue. Until the GPIO API for Hassio is fixed, I can’t include it in my add-on.

I can’t find any combination of slug, repository, dashes or not…that will let me trigger the hassio.addon_start with this addon.

I tried:

  • f16403dc_node-red
  • node-red
  • nodered

The error is that the addon doesn’t exist, or the slug was invalid. Example:

Invalid service data for hassio.addon_start: invalid slug f16403dc_node-red (try f16403dc_nodered) for dictionary value @ data['addon']. Got 'f16403dc_node-red'

@fearoffish

This is an issue with Home Assistant itself. The service won’t take the - in the name. I’ve filed an issue.

For the time being you can call the Hassio API directly using the RESTFul Command component:

rest_command:
  start_node_red:
    url: 'http://hassio/addons/f16403dc_node-red/start'
    method: 'post'
  stop_node_red:
    url: 'http://hassio/addons/f16403dc_node-red/stop'
    method: 'post'

Then just call the rest_command.start_node_red or rest_command.stop_node_red services.

Hey Kory, thanks for the reply.

I had to enter each node and then close it. The flows then worked. Guess with the update the flow logic needed to regenerate.

However state updates still aren’t shown :-/
Just shows connected on the start point of each flow and that’s it. Seems to just be the HA nodes. Others appear to work.

Btw, thanks for the addon. Appreciate your efforts for the community.

I think the suggestion is normally to move a node or something then redeploy the flow. I don’t usually have issues with it.

I don’t seem to have any issues with states. If I use the “events: state” node and filter on, say a lamp state, and plug that into debug, turning the lamp on and off generates the proper events.

If I insert a “current state” node between the previous two nodes and set it to the same lamp state with “Halt if” being set to “off”, only the “on” events show in debug.

That would indicate to me that everything is working, but I admit that I don’t have very complex flows.

This release also includes a “poll state” node which might help you overcome some of the issues you’ve been having.

@Florian

I just now saw your edit as I read your first reply soon after you posted it.

I’m afraid I can’t replicate your issue. I’ve tried "ssl": true and restarting the add-on several times. I also tried removing settings.js and letting it be recreated, then restarting the add-on several times.

Every time it worked as expected: the add-on started with HTTPS and I never saw the comment issue you mentioned.

Can you post your add-on options JSON (with passwords redacted)?

Also the add-on logs after a minute of running? That can help me troubleshoot what’s going on.