Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Support UnifiOS #15

Closed
johntdyer opened this issue Mar 17, 2020 · 6 comments
Closed

Support UnifiOS #15

johntdyer opened this issue Mar 17, 2020 · 6 comments
Labels
bug Something isn't working upstream Issue appears to be caused by an upstream dependency

Comments

@johntdyer
Copy link

I tried this on my UDM w/ UnifiOS and it appears to not work. I know the auth changed in the newer release so I am assuming this simply doesnt support it

17:40:52 root@coruscant.local bin                                                                                                                                                                                                                             1 ↵
17:41:54 root@coruscant.local bin docker run -e UNIFI_HOST="192.168.100.1" -e UNIFI_PORT="443" -e UNIFI_USERNAME="xxxxxxxx" -e UNIFI_PASSWORD="xxxxxxxx" -e MQTT_BROKER="tcp://192.168.100.14:1883" -e MQTT_DISCOVERY="true" mannkind/unifi2mqtt:latest
time="2020-03-17T21:41:55Z" level=info msg="unifi2mqtt version: v0.8.20061.0159"
time="2020-03-17T21:41:55Z" level=info msg="Logging MQTT Environment Settings"
time="2020-03-17T21:41:55Z" level=info msg="MQTT Environment Settings" MQTT.Broker="tcp://192.168.100.14:1883" MQTT.ClientID= MQTT.Discovery=true MQTT.DiscoveryName=unifi MQTT.DiscoveryPrefix=homeassistant MQTT.Password= MQTT.TopicPrefix=home/unifi MQTT.Username=
time="2020-03-17T21:41:55Z" level=info msg="Logged MQTT Environment Settings"
time="2020-03-17T21:41:55Z" level=info msg="Connecting to MQTT"
time="2020-03-17T21:41:55Z" level=info msg="Service Environmental Settings" Unifi.AwayTimeout=5m0s Unifi.Devices="map[11:22:33:44:55:66:MyPhone 12:23:34:45:56:67:AnotherPhone]" Unifi.Host=192.168.100.1 Unifi.LookupInterval=10s Unifi.Password="<REDACTED>" Unifi.Port=443 Unifi.Username=xxxxxxxx
time="2020-03-17T21:41:55Z" level=info msg=Polling
time="2020-03-17T21:41:55Z" level=info msg="Connecting to Unifi"
time="2020-03-17T21:41:55Z" level=info msg="Connected to MQTT"
time="2020-03-17T21:41:55Z" level=info msg="Publishing MQTT Discovery"
time="2020-03-17T21:41:55Z" level=info msg="Publishing to MQTT" payload="{\"availability_topic\":\"home/unifi/status\",\"device\":{\"identifiers\":[\"home/unifi/status\"],\"manufacturer\":\"twomqtt\",\"name\":\"unifi2mqtt\",\"sw_version\":\"v0.8.20061.0159\"},\"device_class\":\"presence\",\"name\":\"unifi myphone\",\"state_topic\":\"home/unifi/myphone/state\",\"unique_id\":\"unifi.myphone\"}" topic=homeassistant/binary_sensor/unifi/myphone/config
time="2020-03-17T21:41:55Z" level=info msg="Finished publishing to MQTT"
time="2020-03-17T21:41:55Z" level=info msg="Publishing to MQTT" payload="{\"availability_topic\":\"home/unifi/status\",\"device\":{\"identifiers\":[\"home/unifi/status\"],\"manufacturer\":\"twomqtt\",\"name\":\"unifi2mqtt\",\"sw_version\":\"v0.8.20061.0159\"},\"device_class\":\"presence\",\"name\":\"unifi anotherphone\",\"state_topic\":\"home/unifi/anotherphone/state\",\"unique_id\":\"unifi.anotherphone\"}" topic=homeassistant/binary_sensor/unifi/anotherphone/config
time="2020-03-17T21:41:55Z" level=info msg="Finished publishing to MQTT"
time="2020-03-17T21:41:55Z" level=info msg="Published MQTT Discovery"
time="2020-03-17T21:41:55Z" level=info msg="Connected to Unifi"
time="2020-03-17T21:41:55Z" level=info msg="Selecting site"
2020/03/17 21:41:55 self/sites
2020/03/17 21:41:55
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1"><link href="/2.css" rel="stylesheet"></head>
<body>
<div id="root"></div>
<script type="text/javascript" src="/vendor.83223f80.chunk.js"></script><script type="text/javascript" src="/main.c7defc50.js"></script></body>
</html>

time="2020-03-17T21:41:55Z" level=error msg="Couldn't select the site specified" error="invalid character '<' looking for beginning of value"
time="2020-03-17T21:41:55Z" level=fatal msg="Unable to communicate with the Unifi Controller" error="invalid character '<' looking for beginning of value"
17:41:56 root@coruscant.local bin                                                                                                                                                                                                                             1 ↵


@mannkind mannkind added bug Something isn't working upstream Issue appears to be caused by an upstream dependency labels Mar 17, 2020
@mannkind
Copy link
Owner

Ack. That's interesting. I was not aware of such big changes with the UDM, but I also have not been tracking it too closely.

This project utilizes the dim13/unifi library in order to communicate with the unifi controller. Once that library supports the UDM, I can certainly look at supporting it within this project. Hopefully it won't be too difficult.

@bluewalk
Copy link

bluewalk commented Dec 29, 2020

Now that this project is using KoenZomers.UniFi.Api (https://github.com/KoenZomers/UniFiApi) after switching to .NET (yay!) maybe we notifiy them to update the library to support UnifiOS as my controller just updated as well...

@mannkind
Copy link
Owner

mannkind commented Jan 5, 2021

No promise on a timeline, but I now have a CloudKey gen2 on the way. After it arrives and I get everything setup, I'll try to adapt/hack-n-slash KoenZomers/UniFiApi to support UniFiOS. 😄

@mannkind
Copy link
Owner

mannkind commented Feb 2, 2021

Should anyone be interested...

I made a little patch in the dev branch (mannkind/unifi2mqtt:dev if you're using Docker) to support UnifiOS. I've tested it over the last couple days and it seems to be working as expected with my cloudkey gen2.

I haven't heard back about the unifiapi lib yet, so I replaced the lib for now. I hope the replacement will be temporary and that I haven't introduced other errors. 😂

@bluewalk
Copy link

bluewalk commented Feb 3, 2021

Confirmed working, great job 👍

@mannkind
Copy link
Owner

Alright well since this appears to be worked-around for the time being, I'm going to close this.

  • "Fixed" in 29463d4
  • Merged to main
  • Docker images rebuilt.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working upstream Issue appears to be caused by an upstream dependency
Projects
None yet
Development

No branches or pull requests

3 participants