twocolors / node-red-contrib-esphome

Node-RED nodes to ESPhome devices
MIT License
18 stars 5 forks source link

Struggling to send commands to ESPHome devices - could anyone please post an example flow? #27

Closed DeeBeeKay closed 7 months ago

DeeBeeKay commented 7 months ago

First, let me say how happy I am to see this project. All of my home automation is in Node-RED; I only use Home Assistant as an ersatz state machine. If this works, I can eliminate an entire VM.

Anyway, I installed it, and I can see devices, and see the exposed controls, which is exciting!

However, I am struggling to actually send commands. I know that the documentation seems to list what's required, but I'm not succeeding. If I get this working, I'm happy to write up a tutorial with steps for noob users that want to do this.

SO: here's my difficulty. There's an ESPHome device in this room that controls the light above me. I want to be able to turn it on and off - basic, right?

So I added an ESPHome Out node, correctly configured. The right device comes back, I can see the entities inside it.

So now I need to inject a command to make it work.

What I need is to understand how that instruction needs to be formatted, and where it should go: msg.payload?

Boolean True and False don't seem to work.

String ON and OFF don't seem to work.

If I could see one working example, I could figure it out from there, probably.

Halp? Thanks.

DeeBeeKay commented 7 months ago

EDIT: I figured it out. I'm typing this here in case anyone else finds this via search. I am old, and not particularly clever.

Right, to inject a command into an ESPHome-OUT node, do this:

  1. Set JSON as the payload
  2. Check in the documentation what the thing is expecting; in my case, a light, it wants "true" or "false".
  3. Righto, then the msg is formatted thusly: {"state": true}

Tadaaaaa suddenly you don't need Home Assistant anymore.

twocolors commented 7 months ago

example can found in import flow

image

or you can sent pull for more documentations (: thx you

i can't found user to help write doc ):

DeeBeeKay commented 6 months ago

Hi @twocolors, I am willing to help write docs, only I don't know very much. I am still learning as I go, but I am very much enjoying your work.

However, I do write good English. Maybe if you have some basic notes, I can fill it out with more details?