DaveMDS / node-red-contrib-tasmota

Tasmota devices for NodeRed
MIT License
24 stars 9 forks source link

Devices show "Offline" when referenced in multiple flows #39

Closed OneHoopyFrood closed 1 year ago

OneHoopyFrood commented 2 years ago

I'm not sure if this is fixable, but when multiple tasmota nodes reference the same device name (disclaimer: only tried with lights) only one of them shows the correct state. The others (somewhat random order, assume it's based on a race condition) show "Offline" or occasionally "Wrong Config" (only until a message is sent, then it switches to "offline").

To illustrate, these are in two separate flows:

Screen Shot 2022-08-03 at 11 03 24 AM

Screen Shot 2022-08-03 at 11 03 32 AM

It would be preferred that all references were able to show the status correctly.

DaveMDS commented 2 years ago

Hi, I'm not able to reproduce this error, please double check the broker config of your nodes. Both nodes (in same or different flows) should use the same broker configuration item. In general you should have a single broker config for all your tasmota nodes (so a single connection to the broker is made and shared across nodes)

OneHoopyFrood commented 2 years ago

Interesting.

These are actually copied directly from one to another between flows. I'm not on my network right now but I'll check the configs when I'm back home. It does seem somewhat inconsistent about which flow fails, leading to my suspicion of some form of race condition.

For context, I'm running a mosquito service on localhost. Nothing special.

If I can reproduce consistently I'll send you a minimal example.

OneHoopyFrood commented 2 years ago

So it seems to be only occurring after MQTT messages are sent to the lights via some other method, such as from an app. Then whichever flow you're in when it happens gets the "offline" state except the last remaining.

DaveMDS commented 2 years ago

Still not able to reproduce :/

Have a light node in 2 different flows, issuing a power toggle command from an external app (MQTT explorer), and everything works as expected.

Try to look at your mosquitto logs, maybe there is something interesting there.

Also make sure you are not using the same client-id for NodeRed and the other apps (client-id should be unique for each app that connect to the broker)

FreekBos commented 2 years ago

Hi, I have exacly the same behavior: no matter what I do, I don't get nodes to connect to the broker. The buildin mqtt nodes register fine (63 nodes), zigbee2mqtt (37) registers fine but I can't make node-red-tasmota to work. Can I provide any info to assist?

Many thanks in advance

DaveMDS commented 2 years ago

I need to see the configuration for the tasmota-mqtt-broker (that do not work) and the nodered mqtt-broker (that works), I also need to see the configuration for an mqtt node and a tasmota node.

You should get some kind of errors, in the nodered debug panel, in nodered console or in the mosquitto logs

FreekBos commented 2 years ago

Will look for logging in NR / MQTT - sofar nothing. KR, F tasmota mqtt - that doesnt work.zip nr mqtt - that does work.zip tasmo.zip

DaveMDS commented 2 years ago

Hi, the first thing that I see in your config is the "Device" field in the tasmota node config: it should match the "Topic" field in your tasmota device config, not the full topic. But you are using a quite custom naming convention for your devices, so it's not easy to say. Can you show me the MQTT config page on the tasmota device itself?

FreekBos commented 2 years ago

Hi, Thanks for responding; much appreciated. The full topic is

h13 (the house it lives in) type (has, son, home, zig2mqtt, actor, sensor) floor (s1, bg, f1, f2, ou) type of device or sensor (light, switch, motion, open, vibration, water...) device-name (lampxx) So, I have multiple same device-name (lamp01, ..02, ...04); with over 100 devices I had to make some form of organization.

2022-09-05 19_13_14-MQTT Explorer 2022-09-05 19_12_25-h13_son_bg_light_lamp04 - Configure MQTT
DaveMDS commented 2 years ago

Ok, then you need to configure the tasmota node as: lamp04 in the Device field h13/son/bg/light/%topic%/%prefix%/ in the Full Topic field (in the advanced tab)

DaveMDS commented 2 years ago

I also added a section in the README to explain the various configuration values. In the screenshots I left your FullTopic values as I was testing them, hope you don't mind, otherwise let me know and I will remake the screenshots with a bit more privacy ;)

FreekBos commented 2 years ago

Not a problem; anything that helps and my servers are not accessible from the outside so no worries there.

KR,

F

FreekBos commented 2 years ago

Ha Dave, Just tested it... works well! Thank you ever so much

DaveMDS commented 2 years ago

@FreekBos great :)