Newbie: msg configuration help

Just started with Node-red, but run into the following problem. When I inject ON to the switch it does not act. I assume that I have to configure msg:command, but I’m doing something wrong.

Don’t want a .json editted solution, because I prefer everything via the graphical interface to be set up.
After 3 days of reading I can use some input for my current setup. In the end I would like to switch a light via the Sonoff switch on/off triggered by a door switch.

The first thing I would do is switch from Tasmota to ESPHome, then reflash your SonOFF Basic R2 with the .bin file you compile in ESPHome.

You don’t need to inject a particular message to turn something on. Simply create an inject and tie it to a service call. In that service call, set the entity and the action and that’s all you need.

Meanwhile I got it working via an HTTP call, but that is not my way forward. What is the benefit switch to ESPHome in relation to Node-red ? I can re-flash these, np, but why is not clear.

Can you elaborate on that part ?

So node-red is a little funny in that sometimes the message doesn’t matter sometimes it does.

For example if you inject a payload of “off” to a call service node that is set to turn a light on, it will turn the light on. If you inject off to an mqtt node, with the topic set to a light, it will turn off.

You could start with the basic call service node. This one node can be used for each task you need.

Set one to publish mqtt for the tasmota. Don’t set an entity instead hit load example. Enter your topic(path to the light) and payload on / off / toggle.

If you want to turn a switch on / off / toggle again use a call service node.

Then use an event node to trigger the call service. There are a lot of ways to accomplish this task, without one way being right or wrong.

Thank you all. Finally got it working via MQTT. I already was wondering if I was using the right information, because there are a lot of details left and right. I’m not sure if someone already documented it, but maybe someone else finds this information also useful.

See next post

And checking the info in your Tasmota device. Mine showed this, but I did not which parameter or label to use in Node Red

I got it working by using the label MQTT Client

And now it works :wink:

image

Thanks again