b-anantha / tuxedo

0 stars 0 forks source link

Integration error: tuxedo - Integration 'tuxedo' not found. #1

Open dennislv opened 2 years ago

dennislv commented 2 years ago

I followed the instruction provided to install the Tuxedo Touch integration which did not work, Maybe I'm doing something wrong? I'm running the latest homeassistant os. I created the folder /config/custom_components/tuxedo and cloned the repo to that folder. As soon as I add 'tuxedo:' to /config/configuration.yaml home assistant throws the 'Integration error: tuxedo - Integration 'tuxedo' not found.' error. I'm still very new to HA so I'm assuming I've done something wrong. Thank you in advance! 2022-04-27_17-32-07 2022-04-27_17-30-23

b-anantha commented 2 years ago

Hmm, that's the same setup I have on my server. Did you restart your instance after adding the the files?

dennislv commented 2 years ago

Thanks for responding so quick. I restarted the HA with the reboot host option with the 'Configuration invalid' message still present. Once it restarted, I got the same error component not found error as before.

`Logger: homeassistant.setup Source: setup.py:162 First occurred: 6:51:14 PM (1 occurrences) Last logged: 6:51:14 PM

Setup failed for tuxedo: Integration not found.` 2022-04-27_19-21-24

Here's a view of my system version/config. I was just wondering if there is an option to enable custom components or does HA automatically pick them up?

System Health

version core-2022.4.7
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.9.9
os_name Linux
os_version 5.10.108
arch x86_64
timezone America/Los_Angeles
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4964 Installed Version | 1.24.5 Stage | running Available Repositories | 1021 Downloaded Repositories | 2
AccuWeather can_reach_server | ok -- | -- remaining_requests | 13
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 7.6 -- | -- update_channel | stable supervisor_version | supervisor-2022.04.0 docker_version | 20.10.9 disk_total | 30.8 GB disk_used | 7.9 GB healthy | true supported | true board | ova supervisor_api | ok version_api | ok installed_addons | Terminal & SSH (9.3.0), Mosquitto broker (6.0.1), File editor (5.3.3), Signal Messenger (0.59.0)
Dashboards dashboards | 4 -- | -- resources | 0 views | 7 mode | storage
b-anantha commented 2 years ago

I just updated my Core to match yours, core-2022.4.7 and it still works. Can you share your home-assistant.log contents on boot? It should list that it's found the custom_components directory and loaded integrations from it.

I was just wondering if there is an option to enable custom components or does HA automatically pick them up?

I don't recall having to do toggle anything to get the integration to load.

dennislv commented 2 years ago

2022-04-27 18:51:06 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration tuxedo which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

2022-04-27 18:51:06 ERROR (SyncWorker_1) [homeassistant.loader] The custom integration 'tuxedo' does not have a version key in the manifest file and was blocked from loading. See https://developers.home-assistant.io/blog/2021/01/29/custom-integration-changes#versions for more details

2022-04-27 18:51:06 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

2022-04-27 18:51:13 ERROR (MainThread) [homeassistant.components.panel_custom] Unable to register panel Dominos: Either js_url, module_url or html_url is required.

2022-04-27 18:51:13 WARNING (SyncWorker_2) [pyhik.hikvision] Sensor type "audioexception" is unsupported.

2022-04-27 18:51:14 ERROR (MainThread) [homeassistant.setup] Setup failed for tuxedo: Integration not found.

b-anantha commented 2 years ago

Interesting, looks like this requirement of version was added afterwards, wonder why I don't receive that.

Can you add a version value to your manifest file and see if it loads?

dennislv commented 2 years ago

That worked. But now when I add the Tuxedo Touch integration, I get 'Failed to connect to controller'.

The log shows

2022-04-27 20:31:07 WARNING (SyncWorker_4) [custom_components.tuxedo.config_flow] request to obtain key returned code 404

2022-04-27_20-34-10

2022-04-27_20-34-47

b-anantha commented 2 years ago

You are running a much newer firmware than I am, probably a different model of the panel. If you clicked the System Http API link what does it take you to?

Can you go to the url manually to see if you get the secret needed for encryption/decryption: http://192.168.0.6/TuxedoAPI or https://192.168.0.6/TuxedoAPI If the https version works and the http does not then my guess is you have enabled it on your panel. For now you can either disable that on your panel or in the config_flow.py file modify the method _obtain_key to use https.

I will work on adding hassfest integration into mine, for the version fix, and look into maybe adding a checkbox for https if that solves your problem.

dennislv commented 2 years ago

My version gives a 404 at 192.168.0.6/TuxedoAPI, http or https doesn't matter. When I click on the System Http API link, it takes me to http://192.168.0.6/tuxedoapi.html where I can browse the API calls. From what I can tell, the registration process looks the same, maybe just the endpoint moved in the newer version?

2022-04-28_13-33-35 2022-04-28_13-35-28

dennislv commented 2 years ago

I changed the endpoint and was able to get the integration added to HA. All subsequent calls are broken

Changes to ./config_flow.py 35:- readit = requests.get(f"http://{ip_address}/TuxedoAPI") 35:+ readit = requests.get(f"http://{ip_address}/tuxedoapi.html")

[core-ssh tuxedo]$ cat ../../home-assistant.log 2022-04-28 15:13:01 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration tuxedo which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

2022-04-28 15:13:06 ERROR (SyncWorker_0) [custom_components.tuxedo.alarm_control_panel] endpoint /GetSecurityStatus returned a 401 NoneType: None

2022-04-28 15:13:06 ERROR (MainThread) [custom_components.tuxedo.alarm_control_panel] unable to get alarm status NoneType: None

I went into the js and found the register button call. Does it look like the api has changed between the versions?

$("#registerBtn").click(function () {
    //var url = protocol + "://" + window.location.hostname + ":" + location.port + apibasepath + "/Registration/Register?Type=" + $("#Type").val() + "&Description=" + $("#Description").val() + "&uname=" + $("#uname").val() + "&pass=" + $("#pass").val() + "&mac=" + $("#mac").val() + "&operation=set";
    //var dataCnt = encryptData("Type=" + $("#Type").val() + "&Description=" + $("#Description").val() + "&uname=" + $("#uname").val() + "&pass=" + $("#pass").val() + "&mac=" + $("#mac").val() + "&operation=set");
    var dataCnt = encryptData("mac=" + $("#mac").val() + "&operation=set");
    var url = protocol + "://" + window.location.hostname;
    if (location.port != "")
        url += ":" + location.port + "/";
    url += apibasepath + "/Registration/Register"; //?param=" + encryptData(dataCnt);
    //callAPI(url);
    var header = "MACID:Browser,Path:" + hPath + "/Registration/Register";
    callAPI_POST(url, dataCnt, dataCnt.length, CryptoJS.HmacSHA1(header, api_key_enc));
});
b-anantha commented 2 years ago

The line you modified is special. It is where the secret key is provided and used later on in all the actual api calls. When you go to http(s)://192.168.0.6/tuxedoapi.html can you open up your DevTools and see what calls are being made? On my version I get https://{local_ipaddress}/TuxedoAPI which returns the secret key.

Your registerBtn and mine have one difference. Mine doesn't have the "/" at the end of the url generation. url += ":" + location.port; is what mine looks like. I also don't use that API call to register a devices mac address.

What does the beginning of your tuxedo.js file look like? Mine is below:

function pageload() {
    api_key_enc = document.getElementById("readit").value.substring(0,64);
    api_iv_enc = document.getElementById("readit").value.substring(64, 96);
    //$.ajaxSetup({headers:{"identity":api_iv_enc}});
}
dennislv commented 2 years ago

It looks identical to yours. I'll do some digging and look for an endpoint that returns a key

`var api_key_enc; var api_iv_enc;

function pageload() { api_key_enc = document.getElementById("readit").value.substring(0,64); api_iv_enc = document.getElementById("readit").value.substring(64, 96); //$.ajaxSetup({headers:{"identity":api_iv_enc}}); } var protocol = "https"; var apibasepath = "/system_http_api/API_REV01"; var hPath="API_REV01"; `

https://pastebin.com/dwsnYqCn

2022-04-28_20-15-41