home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.3k stars 30.61k forks source link

Can establish a connection with SABnzbd #124248

Closed me1337me closed 1 month ago

me1337me commented 2 months ago

The problem

Hey guys,

I have the SABnzbd addon installed and it runs well. Now, I wanted to also add the integration. It asks me for API keys and URL. I took the API key from SABnzbds configuration page and for the URL i tried nearly everything I could think of:

I also tried to add the port 8080 and path /sabnzdb or /a0d7b954_sabnzbd.

But none of these combinations worked for me.

During my research i found people adding configs to their configuration.yaml, so i tried that as well, without any success:

sabnzbd: api_key: xxxx host: 192.168.178.33 port: 8080 name: sabnzbd sensors:

Can anyone help me setting up the integration? I was also checking the code on github, but since i'm not really a programming pro I couldn't find anything that helped me.

Thanks a lot!

What version of Home Assistant Core has the issue?

2024.8.2

What was the last working version of Home Assistant Core?

2024.8.2

What type of installation are you running?

Home Assistant OS

Integration causing the issue

sabnzbd

Link to integration documentation on our website

https://www.home-assistant.io/integrations/sabnzbd

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 2 months ago

Hey there @shaiu, @jpbede, mind taking a look at this issue as it has been labeled with an integration (sabnzbd) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `sabnzbd` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign sabnzbd` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


sabnzbd documentation sabnzbd source (message by IssueLinks)

shaiu commented 2 months ago

@me1337me can you check the home assistant logs and see if there is anything related to the sabnzbd integration? if so attach it here

me1337me commented 2 months ago

@shaiu All I see in the HA Core full protocol is 2024-08-20 08:29:20.029 ERROR (MainThread) [homeassistant.core] Connection to SABnzbd API failed: Unable to communicate with Sabnzbd API

shaiu commented 2 months ago

@me1337me can you try to communicate with the API without home assistant? using Postman or Curl? Follow the instructions here: https://sabnzbd.org/wiki/configuration/4.3/api

me1337me commented 2 months ago

@shaiu postman gives me the following:

https://homeassistant.local:8123/sabnzbd/api?output=json&apikey=xxxx 404: Not Found

But.. https://homeassistant.local:8123/a0d7b954_sabnzbd/api?output=json&apikey=XXXX

<!DOCTYPE html>
<html>

<head>
    <title>Home Assistant</title>
    <meta charset="utf-8">
    <link rel="manifest" href="/manifest.json" crossorigin="use-credentials">
    <link rel="icon" href="/static/icons/favicon.ico">
    <link rel="modulepreload" href="/frontend_latest/core.ydYtuXnHVAs.js" crossorigin="use-credentials">
    <link rel="modulepreload" href="/frontend_latest/app.okM55PX7yEE.js" crossorigin="use-credentials">
    <link rel="mask-icon" href="/static/icons/mask-icon.svg" color="#18bcf2">
    <link rel="apple-touch-icon" href="/static/icons/favicon-apple-180x180.png">
    <meta name="apple-itunes-app" content="app-id=1099568401">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="default">
    <meta name="apple-mobile-web-app-title" content="Home Assistant">
    <meta name="msapplication-config" content="/static/icons/browserconfig.xml">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="application-name" content="Home Assistant">
    <meta name="referrer" content="same-origin">
    <meta name="theme-color" content="#03A9F4">
    <meta name="color-scheme" content="dark light">
    <meta name="viewport" content="width=device-width,user-scalable=no,viewport-fit=cover,initial-scale=1">
    <style>
        body {
            font-family: Roboto, Noto, Noto Sans, sans-serif;
            -moz-osx-font-smoothing: grayscale;
            -webkit-font-smoothing: antialiased;
            font-weight: 400;
            margin: 0;
            padding: 0;
            height: 100%
        }
    </style>
    <style>
        html {
            background-color: var(--primary-background-color, #fafafa);
            color: var(--primary-text-color, #212121);
            height: 100vh
        }

        @media (prefers-color-scheme:dark) {
            html {
                background-color: var(--primary-background-color, #111);
                color: var(--primary-text-color, #e1e1e1)
            }
        }

        #ha-launch-screen {
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center
        }

        #ha-launch-screen svg {
            width: 112px;
            flex-shrink: 0
        }

        #ha-launch-screen .ha-launch-screen-spacer-top {
            flex: 1;
            margin-top: calc(2 * max(env(safe-area-inset-bottom), 48px) + 46px);
            padding-top: 48px
        }

        #ha-launch-screen .ha-launch-screen-spacer-bottom {
            flex: 1;
            padding-top: 48px
        }

        .ohf-logo {
            margin: max(env(safe-area-inset-bottom), 48px) 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            opacity: .66
        }

        @media (prefers-color-scheme:dark) {
            .ohf-logo {
                filter: invert(1)
            }
        }
    </style>
</head>

<body>
    <div id="ha-launch-screen">
        <div class="ha-launch-screen-spacer-top"></div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240">
            <path fill="#18BCF2"
                d="M240 224.762a15 15 0 0 1-15 15H15a15 15 0 0 1-15-15v-90c0-8.25 4.77-19.769 10.61-25.609l98.78-98.7805c5.83-5.83 15.38-5.83 21.21 0l98.79 98.7895c5.83 5.83 10.61 17.36 10.61 25.61v90-.01Z" />
            <path fill="#F2F4F9"
                d="m107.27 239.762-40.63-40.63c-2.09.72-4.32 1.13-6.64 1.13-11.3 0-20.5-9.2-20.5-20.5s9.2-20.5 20.5-20.5 20.5 9.2 20.5 20.5c0 2.33-.41 4.56-1.13 6.65l31.63 31.63v-115.88c-6.8-3.3395-11.5-10.3195-11.5-18.3895 0-11.3 9.2-20.5 20.5-20.5s20.5 9.2 20.5 20.5c0 8.07-4.7 15.05-11.5 18.3895v81.27l31.46-31.46c-.62-1.96-.96-4.04-.96-6.2 0-11.3 9.2-20.5 20.5-20.5s20.5 9.2 20.5 20.5-9.2 20.5-20.5 20.5c-2.5 0-4.88-.47-7.09-1.29L129 208.892v30.88z" />
        </svg>
        <div id="ha-launch-screen-info-box" class="ha-launch-screen-spacer-bottom"></div>
        <div class="ohf-logo"><img src="/static/images/ohf-badge.svg" alt="Home Assistant is a project by the Open Home Foundation" height="46">
        </div>
    </div>
    <home-assistant></home-assistant>
    <script>
        function _ls(d,e){var o=document.createElement("script");return e&&(o.crossOrigin="use-credentials"),o.src=d,document.head.appendChild(o)}window.polymerSkipLoadingFontRoboto=!0,"customElements"in window&&"content"in document.createElement("template")||_ls("/static/polyfills/webcomponents-bundle.js",!0);var isModern=/Edge?\/(1{2}[6-9]|1[2-9]\d|[2-9]\d{2}|\d{4,})\.\d+(\.\d+|)|Firefox\/(1{2}[5-9]|1[2-9]\d|[2-9]\d{2}|\d{4,})\.\d+(\.\d+|)|Chrom(ium|e)\/(109|1[1-9]\d|[2-9]\d{2}|\d{4,})\.\d+(\.\d+|)|(Maci|X1{2}).+ Version\/(17\.\d+|(1[89]|[2-9]\d|\d{3,})\.\d+)([,.]\d+|)( \(\w+\)|)( Mobile\/\w+|) Safari\/|Chrome.+OPR\/(10[2-9]|1[1-9]\d|[2-9]\d{2}|\d{4,})\.\d+\.\d+|(CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS|CPU iPad OS)[ +]+(15[._]([6-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})[._]\d+)([._]\d+|)|Android:?[ /-](1{2}[6-9]|1[2-9]\d|[2-9]\d{2}|\d{4,})(\.\d+|)(\.\d+|)|Mobile Safari.+OPR\/([89]\d|\d{3,})\.\d+\.\d+|Android.+Firefox\/(1{2}[7-9]|1[2-9]\d|[2-9]\d{2}|\d{4,})\.\d+(\.\d+|)|Android.+Chrom(ium|e)\/(1{2}[6-9]|1[2-9]\d|[2-9]\d{2}|\d{4,})\.\d+(\.\d+|)|SamsungBrowser\/(2[3-9]|[3-9]\d|\d{3,})\.\d+/.test(navigator.userAgent)&&"findLast"in Array.prototype
    </script>
    <script>
        if(-1===navigator.userAgent.indexOf("Android")&&-1===navigator.userAgent.indexOf("CrOS")){function _pf(o,t){var n=document.createElement("link");n.rel="preload",n.as="font",n.type="font/woff2",n.href=o,n.crossOrigin="anonymous",document.head.appendChild(n)}_pf("/static/fonts/roboto/Roboto-Regular.woff2"),_pf("/static/fonts/roboto/Roboto-Medium.woff2")}
    </script>
    <script crossorigin="use-credentials">
        isModern&&(import("/frontend_latest/core.ydYtuXnHVAs.js"),import("/frontend_latest/app.okM55PX7yEE.js"),window.customPanelJS="/frontend_latest/custom-panel.bH4v-RXAj2Q.js",window.latestJS=!0)
    </script>
    <script>
        import("/hacsfiles/iconset.js");
    </script>
    <script>
        window.latestJS||(window.customPanelJS="/frontend_es5/custom-panel.GkcKBadxyGs.js",_ls("/frontend_es5/core.L51L-TyUzRQ.js",!0),_ls("/frontend_es5/app.RkfJfYDyXHM.js",!0))
    </script>
    <script>
        if (!window.latestJS) {}
    </script>
</body>

</html>

I then used this URL for the integration, but that failed ;(

me1337me commented 2 months ago

some more infos from the addons config:

Config File: /config/api/hassio_ingress/SJ0JVHDGE8nJmyrM5bK4M1nsCJoYxWivWmnIVHCs3mQ/sabnzbd.ini

Parameters: "/opt/api/hassio_ingress/SJ0JVHDGE8nJmyrM5bK4M1nsCJoYxWivWmnIVHCs3mQ/sabnzbd.py" "--config-file" "/config" "--server" "0.0.0.0" "--console" "--disable-file-log"

shaiu commented 2 months ago

@me1337me go to the Sabnzbd addon page in home assistant and search for the Hostname (see screenshot)

Screenshot 2024-08-20 at 11 01 21

Please try with that hostname for the integration connection

me1337me commented 2 months ago

@shaiu thats what i did in the 2nd call: https://homeassistant.local:8123/a0d7b954_sabnzbd/api?output=json&apikey=XXXX

a0d7b954_sabnzbd is the hostname grafik

shaiu commented 2 months ago

@me1337me just the hostname.. without "homeassistant.local:8123"

Screenshot 2024-08-20 at 14 41 49

me1337me commented 2 months ago

@shaiu same issue, can't establish connection.

If you like, we can make a remote session so i can share you my screen.

shaiu commented 2 months ago

We can try later. What is your discord name?

me1337me commented 2 months ago

.doublex

me1337me commented 2 months ago

@shaiu Did you already wrote me on discord? havent seen a message yet.

jpbede commented 2 months ago

Have you tried a0d7b954_sabnzbd or a0d7b954-sabnzbd? It is very important that the hostname is written with a hyphen, not an underscore.

So please try http://a0d7b954-sabnzbd:8080

shaiu commented 1 month ago

@me1337me can you try @jpbede's suggestion?

me1337me commented 1 month ago

@shaiu Sorry for late response. Thanks to @jpbede that made the trick! Now its works. IMHO, its quite unintuitive and might be added to the SabNZB documentation.

shaiu commented 1 month ago

@me1337me what exactly was your input? So I can update the docs

me1337me commented 1 month ago

@me1337me what exactly was your input? So I can update the docs

grafik

me1337me commented 1 month ago

And here which entites are available and how they "look" like on a dashboard grafik

jpbede commented 1 month ago

I'm going to close this, as this is "fixed" 🙂 There will be a hint below the URL with the next release.