Node-red-contrib-home-assistant-websocket

I was wondering what property was referring to, that worked! Thanks for the great work on this!

Just a little question. Am I overlooking something or can’t you change the value to integer in the data field using the code below?

{
    "level": "{{ states.input_number.purifier_level | int }}"
}

I’m trying to use this with xiaomi_miio_set_favorite_level.

If you’re talking about the data field within a call-service no you can’t use a template to create a number because the data field needs to be a valid JSON string.

{
    "level": {{ states.input_number.purifier_level}}
}

The above isn’t a valid JSON string.

You could pass in the data value from a function node before the call-service node.

const states = global.get('homeassistant').homeAssistant.states;
msg.payload = {
  data: {
      level: states['input_number.purifier_level'].state
    }
};
return msg;
1 Like

Hi Kermit, I managed to fix it in a different way.

I’m now using a Get template node to convert the value to int:
{{ states['input_number.purifier_level'].state | int }}

The reason is that input_number uses decimals, which xiaomi_miio_set_favorite_level doesn’t expect.

After that I’m using the payload in the Call service data field:

{
    "level": "{{payload}}"
} 

Thanks for helping out!

Hello, I just updated to the latest version and all of my Home assistant nodes have changed to “unknown” . Here is a screen shot of the pallette:

Could you please advise on how I can fix this?

Thanks for your help!

Are you using docker on a rpi? If so you need to upgrade node.js

https://github.com/zachowj/node-red-contrib-home-assistant-websocket/issues/127#issuecomment-500345381

Thanks @Kermit! Took me a little to figure out, but I got it working!

I have NR running on ubuntu server in docker and after upgrade to latest node-red-contrib-home-assistant-websocket and latest nodered/node-red-docker image, beside error above (I had to update all nodes in flows :frowning: ), I am also facing very high load on this docker container. I tried to run new container and after I add few hass nodes to flow, it starts to eat cpu also. Anyone facing this issue?

Also since upgrade, I am facing very slow response in browser page with node-red and high cpu usage on this machine (not hosting node-red). This is pain, I don’t know what to do with this cpu usage(s). Any suggestion would be welcome :slight_smile:

Boy, I’m having a hell of time with this. I recently updated from 10.2 and I can no longer connect to HA. Nothing else has changed. I’ve done all the standard troubleshooting and even rebuilt the entire node-red container, started w/o importing any of my flows, etc. I’m currently running node-red-contrib-home-assistant-websocket v0.12.3, Node-RED v0.20.5 (I’m using the v10 container), Node.js v12.4.0, HA v0.94.3. I’ve also rebuilt the LLAT (several times), restarted both HA and Node-RED containers in every order possible. I’m dying here.

Debug shows “connecting” and then an instant “disconnected”… over and over and over again. The only flow I have is an events:all running to a msg.payload debug.

Any thoughts? I’m out of things to try!

Happened to me once. I regenerated the long lived access token and it started working again.

Done that more times than I can count. :frowning:

So, this just happened: If I set the Base URL to my HTTPS DuckDNS URL for HA it works. Thing is, I don’t want to route every little thing through the internet, not least of which because if my connection goes down, so will all of my automations. This is not behavior that occurred before. Any thoughts?

I’m starting to think I have something misconfigured in HA that’s now allowing unsecured local connections. Haven’t changed anything in there either. Maybe I updated HA the same time I updated this pallet and just forgot? And that HA update had a breaking change here? I’ll have to dig in there.

New Release v0.13.0

Features

  • current-state: Templates are rendered in the entity id field (aed4579)

  • wait-until: Allow overriding of config value (c4d3081)

Full Changelog


Buy me a coffee For those that enjoy my work.

3 Likes

Thanks, just updated from v0.12.x and so far so good, as it everything is still working :slight_smile:

Hi, could anyone advise on how to fix this? I’m running in docker.
An uninstall, docker restart, npm install does not fix it.
thanks
image

Nine posts above or any of the following links

1 Like

Thanks kermit, that worked. I can indeed do things like turn on a light from NR now.
But, autofill doesn’t seem to work for domain, service, entity id. This is vital to me since I’m just starting to use NR. Do you have any suggestions on how to fix this? thanks
EDIT: A full restart of the box solved this for me

Am I doing something wrong?

I have many sequences where I have a certain value in the payload. Then I do a ‘current state’ node that checks the state of an entity in HA. Only if it has a certain value, I want to continue in the sequence with the original payload value. This used to work perfectly in the past, I was able to configure that the ‘current state’ node would not overwrite the payload value. But now I can’t seem to prevent that from happening.

I can only guess how about an example flow?

Here is a very basic example. Is it possible to retain ‘hello’ in the payload at the debug node? So have the current state node basically just act like a switch node? (only proceed the sequence with existing message if the HA entity has a certain value)?