Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT Eventstream Infinate Loop #2245

Closed
webworxshop opened this issue Jun 6, 2016 · 6 comments · Fixed by #5624
Closed

MQTT Eventstream Infinate Loop #2245

webworxshop opened this issue Jun 6, 2016 · 6 comments · Fixed by #5624

Comments

@webworxshop
Copy link
Contributor

Make sure you are running the latest version of Home Assistant before reporting an issue.

You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:

Home Assistant release (hass --version):
0.20.3 (both instances)

Python release (python3 --version):
Python 3.4.2 (rpi), Python 3.4.4 (docker)

Component/platform:
MQTT Eventstream

Description of problem:
I am running trying to set up a master/slave system using the MQTT eventstream component between two HA instances (Raspberry Pi (slave) and Dockerised (master)). Upon starting the second instance the system gets stuck in an infinite loop of sending messages back and forth, presumably due to replication of "mqtt_message_received" messages between the two (there are a lot of escape backslashes printed in the logs and flying over the MQTT bus!).

Expected:
Not an infinite loop! State of entities on the slave should be replicated to the master (there seems to be a general lack of documentation on exactly what the behavior should be here).

Problem-relevant configuration.yaml entries and steps to reproduce:

# master config:
mqtt_eventstream:
  publish_topic: homeassistant/events/master
  subscribe_topic: homeassistant/events/slave

#slave config
mqtt_eventstream:
  publish_topic: homeassistant/events/slave
  subscribe_topic: homeassistant/events/master
  1. Add these snippets to the config for two instances and configure mosquitto broker in both
  2. Start both instances
  3. Watch backslash laden MQTT messages fly back and forth with "mosquitto_sub -t 'homeassistant/#' -v

Traceback (if applicable):

Additional info:

@cmsimike
Copy link
Contributor

cmsimike commented Jun 6, 2016

As an alternative to this solution, have you looked at https://home-assistant.io/developers/multiple_instances/?

@webworxshop
Copy link
Contributor Author

I had looked at the HTTP version, but had decided on MQTT as it's usually my preferred protocol for this kind of stuff. I was hoping to have the HTTP component on the RPi instance disabled completely.

@mikenolet
Copy link

I am also experiencing the loop issue.

@kstaniek
Copy link
Contributor

kstaniek commented Jan 2, 2017

There should be a split horizon rule implemented. The incoming mqtt event messages must never be replicated back to mqtt event stream.

@aequitas
Copy link
Contributor

I am also running into this issue. I am trying out the eventstream as alternative to: #3990

From what I see in the code this is not expected to happen as it check already for event locality before publishing: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/mqtt_eventstream.py#L43

I will try to investigate why this doesn't work.

@aequitas
Copy link
Contributor

I have found the issue in my case. The MQTT component fires an event for every received message. These where not ignored by the eventstream.

@home-assistant home-assistant locked and limited conversation to collaborators May 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants