mariusmotea / diyHue

Philips Hue emulator that is able to control multiple types of lights
Other
627 stars 107 forks source link

Tasmota support? #469

Closed chonnymon closed 5 years ago

chonnymon commented 5 years ago

I notice that in some of the notes it mentions tasmota support.

i have some sonoff basics flashed with tasmota, is there a way i can add these as lights to the diyhue hub?

many thanks in advance

Thanks

mariusmotea commented 5 years ago

One user added support for it but i'm not sure how detection works. Did you try a light search after you pair the device to your network?

chonnymon commented 5 years ago

Many thanks for your very quick reply and continued work on the project

I did try a light search from the hue app with the sonoffs connected to the network.

i will have a play with it and see if i can get anything to work

mariusmotea commented 5 years ago

I look in the code, it must be detected automatically:


def discover(bridge_config, new_lights):
    logging.debug("tasmota: <discover> invoked!")

    device_ips = check_output("nmap  " + getIpAddress() + "/24 -p80 --open -n | grep report | cut -d ' ' -f5", shell=True).decode('utf-8').rstrip("\n").split("\n")
    del device_ips[-1] #delete last empty element in list
    for ip in device_ips:
        try:
            logging.debug ( "tasmota: probing ip " + ip)
            response = requests.get ("http://" + ip + "/cm?cmnd=Status%200", timeout=3)
            if response.status_code == 200:
                device_data = json.loads(response.text)
                #logging.debug(pretty_json(device_data))
                if ("StatusSTS" in device_data) and ("Color" in device_data["StatusSTS"]):```

Please note that this project was moved, i will push updated in the new repo from now on.
ghost commented 5 years ago

Tasmota devices should be auto-discovered. If you have any more trouble, would you mind opening an issue at the new repo found here, thanks!