t0mer / broadlinkmanager-docker

Broadlink Manager is a python based project that allows you to contorol your broadlink devices. Discover, Leran and send command in a very easy way
Apache License 2.0
265 stars 56 forks source link

feat: allow accessing broadlink controllers by referencing static ip.… #86

Open jannylund opened 3 months ago

jannylund commented 3 months ago

… This allows use of non-host network mode in docker and makes the app work properly on mac.

This will provide a solution for the following issues:

To confirm, the following docker-compose file can be used:

services:
  broadlinkmanager:
    build: .
    environment:
      - ENABLE_GOOGLE_ANALYTICS=False
      - STATIC_IP_LIST=<ip-of-controller1>,<ip-of-controller2..>
    ports:
      - 7020:7020
jannylund commented 2 months ago

Ping @t0mer - please check when you have time. I have another PR ready for opening to simplify dependency management, but would be great if this is handled first as they are a bit dependent on each other.

gorbypark commented 1 month ago

hey was trying out this branch to see if it would help me with my "no devices" issue...the IP of 192.168.1.151 is the RM4Pro. docker-compose.yml

services:
  broadlinkmanager:
    build: .
    environment:
      - ENABLE_GOOGLE_ANALYTICS=False
      - STATIC_IP_LIST=192.168.1.151
    ports:
      - 7020:7020

still not seeing any devices.

 broadlinkmanager-1  | INFO:     Application startup complete.
broadlinkmanager-1  | INFO:     Uvicorn running on http://0.0.0.0:7020 (Press CTRL+C to quit)
broadlinkmanager-1  | INFO:     192.168.65.1:27912 - "GET / HTTP/1.1" 200 OK
broadlinkmanager-1  | INFO:     192.168.65.1:27912 - "GET /all.min.css HTTP/1.1" 304 Not Modified
broadlinkmanager-1  | INFO:     192.168.65.1:27912 - "GET /adminlte.min.css HTTP/1.1" 304 Not Modified
broadlinkmanager-1  | INFO:     192.168.65.1:27912 - "GET /hex.js HTTP/1.1" 304 Not Modified
broadlinkmanager-1  | INFO:     192.168.65.1:27913 - "GET /broadlink.png HTTP/1.1" 304 Not Modified
broadlinkmanager-1  | INFO:     192.168.65.1:27914 - "GET /jquery.min.js HTTP/1.1" 304 Not Modified
broadlinkmanager-1  | INFO:     192.168.65.1:27915 - "GET /bootstrap.bundle.min.js HTTP/1.1" 304 Not Modified
broadlinkmanager-1  | INFO:     192.168.65.1:27912 - "GET /home.js?V=5 HTTP/1.1" 304 Not Modified
broadlinkmanager-1  | INFO:     192.168.65.1:27913 - "GET /clippy.svg HTTP/1.1" 304 Not Modified
broadlinkmanager-1  | INFO:     192.168.65.1:27916 - "GET /adminlte.min.js HTTP/1.1" 304 Not Modified
broadlinkmanager-1  | INFO:     192.168.65.1:27917 - "GET /clipboard.min.js HTTP/1.1" 304 Not Modified
broadlinkmanager-1  | INFO:     192.168.65.1:27912 - "GET /fa-regular-400.woff2 HTTP/1.1" 304 Not Modified
broadlinkmanager-1  | INFO:     192.168.65.1:27913 - "GET /fa-solid-900.woff2 HTTP/1.1" 304 Not Modified
broadlinkmanager-1  | 2024-09-23 18:28:29.190 | INFO     | __main__:search_for_devices:615 - Searching for devices...
broadlinkmanager-1  | 2024-09-23 18:28:29.191 | INFO     | __main__:search_for_devices:617 - Checking devices on interface assigned with IP: 172.22.0.2
broadlinkmanager-1  | 2024-09-23 18:28:34.198 | DEBUG    | __main__:search_for_devices:634 - Devices Found: []
broadlinkmanager-1  | INFO:     192.168.65.1:27918 - "GET /autodiscover HTTP/1.1" 200 OK
broadlinkmanager-1  | INFO:     192.168.65.1:27918 - "GET / HTTP/1.1" 200 OK

seems like it's still only scanning 172.22.0.2 which I guess is the internal docker IP?

jannylund commented 1 month ago

Hey @gorbypark , indeed, this looks like you are still on the master branch. Can you show the git log output from your clone to validate that it has my latest commit?

gorbypark commented 1 month ago

Ah, most likely that is it, I pulled your fork but didn’t switch from main. Now that you say it it’s obvious, haha!

I’ll try again tomorrow and report back.

Thanks!

On Mon, Sep 23, 2024 at 10:36 PM Jan Nylund @.***> wrote:

Hey @gorbypark https://github.com/gorbypark , indeed, this looks like you are still on the master branch. Can you show the git log output from your clone to validate that it has my latest commit?

— Reply to this email directly, view it on GitHub https://github.com/t0mer/broadlinkmanager-docker/pull/86#issuecomment-2369331127, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVJWPNTFQNY7UFAL5NDOSDZYB3WNAVCNFSM6AAAAABLPBBWUOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRZGMZTCMJSG4 . You are receiving this because you were mentioned.Message ID: @.***>

gorbypark commented 1 month ago

Hey @gorbypark , indeed, this looks like you are still on the master branch. Can you show the git log output from your clone to validate that it has my latest commit?

So it turns out master is the branch I should have been on and I appear to be using the correct fork/branch..

git log

Author: Jan Nylund <jan.nylund@mac.com>
Date:   Thu Jul 25 20:41:58 2024 +0300

    feat: allow accessing broadlink controllers by referencing static ip. This allows use of non-host network mode in docker and makes the app work properly on Mac.
jannylund commented 1 month ago

Strange. I confirmed that this works in my environment. Note that the static ip is scanned only after clicking the rescan button in the ui. Please see my screenshot. If this still fails for you, I can push a container to dockerhub to ensure that it is the proper commit that is running.

Screenshot 2024-09-24 at 20 38 53
gorbypark commented 1 month ago

Strange. I confirmed that this works in my environment. Note that the static ip is scanned only after clicking the rescan button in the ui. Please see my screenshot. If this still fails for you, I can push a container to dockerhub to ensure that it is the proper commit that is running.

So in the end I was missing the step of doing docker-compose build. I had run docker build ., which in theory should do the same thing if I am not mistaken. It's also possible I did the docker build . in the non-forked repo (but I'm about 90% sure I didn't!). Anyways, this works perfectly on my setup (macOS, docker desktop)! +1 for getting this merged.