How to set Espeasy when 2 switches are using the same broker

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
jackwan1
Normal user
Posts: 21
Joined: 11 Apr 2017, 05:42

How to set Espeasy when 2 switches are using the same broker

#1 Post by jackwan1 » 12 Apr 2017, 06:29

I have two sonoff switches. When I set one switch, I have no problem to control it with node-red through mosquitto broker.

But when I add another identical switch, I have mqtt connection lost and re connect alternatively between the two switches and lost control on GPIO 12 of one switch.
In the log, the connection failure count also increase alternatively two at a time.

I name the switches differently also the names in the device definition differently.

What am I missing?

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: How to set Espeasy when 2 switches are using the same broker

#2 Post by grovkillen » 12 Apr 2017, 06:47

Tried giving them different Unit number?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

jackwan1
Normal user
Posts: 21
Joined: 11 Apr 2017, 05:42

Re: How to set Espeasy when 2 switches are using the same broker

#3 Post by jackwan1 » 12 Apr 2017, 09:56

Thank you
Where can I give them a unique unit number? The name of each unit is different, i.e. Sonoff1/# and sonoff2/#

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: How to set Espeasy when 2 switches are using the same broker

#4 Post by grovkillen » 12 Apr 2017, 10:20

Under the config tab.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

jackwan1
Normal user
Posts: 21
Joined: 11 Apr 2017, 05:42

Re: How to set Espeasy when 2 switches are using the same broker

#5 Post by jackwan1 » 12 Apr 2017, 10:27

Nvm
I saw the unit number entry in the config menu. Never thought it is significant
Thank you

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: How to set Espeasy when 2 switches are using the same broker

#6 Post by grovkillen » 12 Apr 2017, 10:32

A piece of advice: include the unit number in the device name. I.e. nodename_001, nodename_002 etc. It may be hard to find what next number is available.


PS. this should be implemented in the FW (to be able to publish the %unitnr% as the same manner as %ip%, %sysname% and %systime%). Just my opinion..
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

jackwan1
Normal user
Posts: 21
Joined: 11 Apr 2017, 05:42

Re: How to set Espeasy when 2 switches are using the same broker

#7 Post by jackwan1 » 14 Apr 2017, 23:00

actually I found out if you put a / in the espeasy name, you can subscribe and publish with a /# qualifier

For example, I name each sonoff switch as sonoff/1.....x instead of sonoff1....x

The benefit of that is in subscribe, I only need to subscribe: sonoff/# and one MQTT client will receive the information from all switches.

and when I publish, I can publish to "sonoff" and each sonoff unit will receive the same command. In my case, I only need one big timer in node red to control all my switches.

That is if you want to treat the series of switches in a "scene" like in IFTTT. You can also easily control each unit separately by using the full name convention.

Post Reply

Who is online

Users browsing this forum: No registered users and 35 guests