Node-RED state change not working anymore?

Hi All

I have this setup for the all family members but for some reason it doesn’t work for one person?

The Node-Red setup is as follows:

The bayesian sensor presence is “on” --> Set presence = Home but for some reason its set at Away?

image


As you can see above the the binary sensor is “on”

and I have set

and the switch:
image

And final for Home:

{"dev_id":"victoria_bayesian","location_name":"home"}

And not home
{"dev_id":"victoria_bayesian","location_name":"not_home"}

This all works for everyone else except one person?
I have followed the example found here some time ago:

I am actually getting really tired of this third time this breaks, so if some one knows how to do this in the configuration file then please share it :slight_smile:

Thanks
Casperse

UPDATE: Debug shows this…?

“entity could not be found in cache for entity_id: binary_sensor.victoria_presence, sending empty payload”

@oakbrad - Have you experienced this? I cant find any difference between family members but for this person it just doesn’t work?

@Ulisses_Nogueira do you experience the same problem? we talked about this in a older post some time ago that time it was another problem after an update of Node Reed

@oakbrad - I can confirm that something have changed non of my sensors --> device_tracker works anymore in Node Reed? (So either its an error or some update have broken the nice guide you made for doing this?

As a quick workaround I have created a sensor that states Home or Not_home

# Convert binary_sensor.victoria_presence-> into sensor.victoria_presence (Home/not_home)
sensor:
  - platform: template
    sensors:
      victoria_presence:
        value_template:
          "{% if is_state('binary_sensor.victoria_presence', 'on') %}
          home
          {% else %}
          not_home
          {% endif %}"
        friendly_name: victoria

Then you’d need to replace binary_sensor.victoria_presence->sensor.victoria_presence in groups or pages to show in the gui (binary sensor itself will still display on/off, only the new sensor will display home/not_home)
The only drawback with this is when clicking on sensor.victoria_presence it won’t show the binary sensor history graph?

But it’s not really a nice substitute for the device_tracker icons on the HA UI, but at least they work!

And I get this

11/5/2018, 8:26:51 PMnode: Home Assistantmsg : error

“Error: Invalid access token or password.”

11/5/2018, 8:27:00 PMnode: Bayesian Presencemsg : string[104]

“entity could not be found in cache for entity_id: binary_sensor.victoria_presence, sending empty payload”

SOLUTION - Error was major changes in V1.0

The solution to this is simple:

  • Click on one of the Home Assistant nodes in your flow.
  • Click on the little edit button, next to the server name.
  • Change the URL to: http://hassio/homeassistant .
  • Save it, and deploy your flow!
  • Now the add-on handles the authentication for you.

And delete the old token…
And remove users from configuration

{
  "log_level": "info",
  "credential_secret": "",
  "http_node": {
    "username": "",
    "password": ""
  },
  "http_static": {
    "username": "",
    "password": ""
  },
  "port": 1880,
  "ssl": true,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "require_ssl": true,
  "system_packages": [],
  "npm_packages": [],
  "init_commands": []
<---------------------------------------
  "users": [
    {
      "username": "",
      "password": "",
      "permissions": "*"
    }
  ]
<--------------------------------------
}

https://github.com/hassio-addons/addon-node-red/blob/master/README.md#faq

I’m seeing this with the latest updates. It was working great.

Yeah I’m having this issue as well, it seems to have a mind of its own. I’ll do it another way :wink:

Actually it (Node-RED) seems to be struggling with these bayesian sensors exclusively for some reason. Sometimes it’ll work, but then it seems like eventually NR can’t see the binary_sensor.xxxxx_presence entity any more.

https://discourse-cdn-sjc1.com/business6/uploads/nodered/original/2X/6/688db110a80eb0a088034d6b37dcdfab7835089c.gif

https://discourse-cdn-sjc1.com/business6/uploads/nodered/original/2X/a/a4a9fa035cec0d5a8a0f253e559e66ef69e40d44.gif

I’ve opened a thread on their forums if anyone else wants to chime in: https://discourse.nodered.org/t/having-problems-getting-bayesian-binary-sensors-from-home-assistant-to-show-in-node-red/10596

1 Like

Did you open an issue for this?

I didn’t, but I ended up speaking to kermit on Discord about it, but it also hasn’t happened again since. I think I actually may have fixed it by changing the matching from Exact to Substring. It seemed to immediately kick in and sort itself out after I did that.

I seem to still get it intermittently. I can’t get my state machine nodes out of default states because of it.

Hmm, maybe I’ve just been lucky since then, it’s probably worth reporting it if you’re still seeing issues though, and I’ll jump in if it happens again.

@Hansel I am getting this issue again after updating HA (0.93.1 raspb)
What exactly did you do to fix this?
“fixed it by changing the matching from Exact to Substring”

What do you mean?

Hey, the substring option only available for state nodes:

image

That said, unless it’s just a bug, I don’t really see why this would fix the issue (unless you have trailing spaces or something like that, so the Exact filter isn’t picking up the correct ID), so it may just have been coincidence that I haven’t had any issues since changing that.

Please does anyone have any suggestions?

I tried to rollback on the Node-red and that broke my HA, so I need to get this fixed?
Like below I cant a list of my binary_sensor in Node-red?
https://discourse-cdn-sjc1.com/business6/uploads/nodered/original/2X/6/688db110a80eb0a088034d6b37dcdfab7835089c.gif