albertogeniola / ha-meross-local-broker

HomeAssistant addon that handles LAN-local MQTT and API service for Meross Devices.
Apache License 2.0
33 stars 14 forks source link

Possible to run this standalone to HA #16

Closed rhysmorgan134 closed 2 years ago

rhysmorgan134 commented 2 years ago

Hi,

Thanks for the work on this, I am looking forward to giving it a go. I have my HA installed manually, so can't install it using the addon. I have been trying to get it to work via docker, however I seem to have come accross quite a few issues. Is this something that is possible? Or am I trying in vain?

Thanks again

albertogeniola commented 2 years ago

Hi! The addon is actually capable of being run via docker in stand-alone mode. In fact, I run it that way when I debug it.

Here's you can find the launch command for running the docker container in stand-alone mode: https://github.com/albertogeniola/ha-meross-local-broker/tree/main/.local_debug

Look at the run_addon_locally.sh

rhysmorgan134 commented 2 years ago

Thanks for the quick response and pointer!

I have managed to get the container running now, and can access the configuration page, however I am getting container errors

Traceback (most recent call last):

  File "/opt/custom_broker/mdns_register.py", line 94, in <module>

    exit(main())

  File "/opt/custom_broker/mdns_register.py", line 82, in main

    path = register_service(service_name=args.service_name, service_name_template=args.service_name_template, service_type=args.service_type, service_port=args.service_port, service_priority=args.priority, service_weight=args.weight, data=args.set, update_if_present=args.update_if_present)

  File "/opt/custom_broker/mdns_register.py", line 55, in register_service

    raise e

  File "/opt/custom_broker/mdns_register.py", line 50, in register_service

    return _register_service(service_name=service_name, service_name_template=service_name_template, service_type=service_type, service_port=service_port, service_priority=service_priority, service_weight=service_weight, data=data)

  File "/opt/custom_broker/mdns_register.py", line 32, in _register_service

    bus = SystemBus()

  File "/usr/local/lib/python3.7/dist-packages/dbus/_dbus.py", line 196, in __new__

    private=private)

  File "/usr/local/lib/python3.7/dist-packages/dbus/_dbus.py", line 102, in __new__

    bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)

  File "/usr/local/lib/python3.7/dist-packages/dbus/bus.py", line 124, in __new__

    bus = cls._new_for_bus(address_or_type, mainloop=mainloop)

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.FileNotFound: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory

I'm guessing that I maybe need to pass dbus from the host to the container?

rhysmorgan134 commented 2 years ago

Never mind, I have just disabled broadcast and done a reinit and I am in!

Thanks alot!

albertogeniola commented 2 years ago

Exactly: either you install dbus on the host and pass it to the container or disable broadcasting. Congrats for having figured it out!