Shellyforhass: [FR] Add config settings for new MQTT mini server

Created on 20 May 2020  路  9Comments  路  Source: StyraHem/ShellyForHASS

Environment

  • ShellyForHASS release with the issue: 0.1.9.beta2
  • Last working ShellyForHASS release (if known): -
  • Home Assistant Core release with the issue: 0.109.6
  • Operating environment (Home Assistant/Supervised/Docker/venv): Docker

Describe the bug


Log trace about new MQTT mini server: port in use.
Take care that I don't have any other MQTT server in use, nor I need it.

Steps to Reproduce


Update to latest beta and check log

Expected behavior


No error in log

Screenshots

Traceback/Error logs

2020-05-19 17:25:07 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/shelly/__init__.py", line 185, in start_up
    pys.start()
  File "/usr/local/lib/python3.7/site-packages/pyShelly/__init__.py", line 129, in start
    self._mqtt.start()
  File "/usr/local/lib/python3.7/site-packages/pyShelly/mqtt.py", line 97, in start
    self._init_socket()
  File "/usr/local/lib/python3.7/site-packages/pyShelly/mqtt.py", line 103, in _init_socket
    sock.bind((self._root.bind_ip, 9955))
OSError: [Errno 98] Address in use

Additional context

Would be nice to have MQTT mini-server disabled by default, and enable it only when necessary in rodere to limit necessary resources.

enhancement fixed

All 9 comments

Yes I will add config for that and port. Can you try to telnet to that port and see if you get an answer or list. I just pick a random port, guess it is used by something else.

Are ju running multiple instances of ShellyForHass?

Yes I will add config for that and port.

While you are at it, would be even better to enable the mini server only if needed.
Something like:

mqtt_server_enable: true/false (default: false)
mqtt_server_port: XXX ( default: XXX)

Are ju running multiple instances of ShellyForHass?

I have 2 HA instances both running in containers using host network , so same TCP port is available only once ;-)

Simone

Then that is the reason. You can downgrade one instance to b1 for now.

Yes will add settings like that with default to off. I just want to see if it working for others than me first.

Can you change title to some thing like; Add settings for mqtt?

@hakana I found an issue about build-in MQTT broker - https://github.com/StyraHem/pyShelly/issues/18
maybe an option to disable MQTT server and use a build-in server?
I have my Home Assistant on Raspberry Pi3 and I have Mosquitto.
I don't know if having two MQTT brokers on one machine will cause any performance issues, but Pi3 isn't very powerful. I think that using a build-in broker will also simplify the code. What do you think?

TThe built-in MTT server is not a full MQTT server and does not affect the performance if not used. This was just a test and we will add configuration to enable it etc. I also looking to use the integrated MQTT part of HA.

If only Shelly could support both MQTT and Cloud at the same time. This would solve a lot of problems.
Hopefully one day they will :)

If only Shelly could support both MQTT and Cloud at the same time. This would solve a lot of problems.
Hopefully one day they will :)

Dimitar already told this is not possible, it's a issue with hardware resources.

Simone

Dimitar already told this is not possible, it's a issue with hardware resources.

Simone

Currently not, but as Dimitar wrote they are working on supporting both:
image
https://www.facebook.com/groups/ShellyIoTCommunitySupport/permalink/2116214735144546/?comment_id=2116222398477113&reply_comment_id=2294219027344115

The last update was about 34 weeks ago. Maybe something will be announced on the 4th of June.

MQTT port setting added to version 0.1.9.

Closing this issue.

Simone

Was this page helpful?
0 / 5 - 0 ratings