Disane87 / spoolman-homeassistant

Spoolman home assistant integration 🏠
MIT License
54 stars 4 forks source link

Connection to spoolman fails (http and https) #64

Closed gschmidl closed 10 months ago

gschmidl commented 10 months ago

System Health details

System Information

version core-2023.11.3
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.6
os_name Linux
os_version 6.1.21-v8
arch aarch64
timezone Europe/Vienna
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4986 Installed Version | 1.33.0 Stage | running Available Repositories | 1350 Downloaded Repositories | 36
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 11.1 -- | -- update_channel | stable supervisor_version | supervisor-2023.11.6 agent_version | 1.6.0 docker_version | 24.0.6 disk_total | 228.5 GB disk_used | 24.7 GB healthy | true supported | true board | yellow supervisor_api | ok version_api | ok installed_addons | TimescaleDB (3.0.2), Studio Code Server (5.14.2), ESPHome (2023.11.6), Whisper (1.0.0), Piper (1.4.0), pgAdmin4 (2.1.1), Samba share (12.2.0), Terminal & SSH (9.8.1), AdGuard Home (4.8.17), Duck DNS (1.15.0), Grocy (0.20.1), Vaultwarden (Bitwarden) (0.20.1), RaspberryMatic CCU (3.73.9.20231130), NGINX Home Assistant SSL proxy (3.5.0), Mealie (Omni): (v1.0.0-RC1.1), Home Assistant Google Drive Backup (0.112.1), Mosquitto broker (6.4.0), WireGuard (0.9.0), chrony (2.6.2), openWakeWord (1.8.2)
Dashboards dashboards | 1 -- | -- resources | 18 views | 14 mode | storage
Miele component_version | 0.1.19 -- | -- reach_miele_cloud | ok
Recorder oldest_recorder_run | November 29, 2023 at 7:46 AM -- | -- current_recorder_run | December 6, 2023 at 4:30 PM estimated_db_size | 1180.78 MiB database_engine | postgresql database_version | 15.3

Checklist

Describe the issue

I tried to connect to my Spoolman instance. It runs on a Raspberry Pi Zero 2 W, both on http and https via caddy. I can connect to the web interface both on http and https.

This happens when I try to add the integration:

image image

At first I thought it was a problem with http, which is why I went through the trouble of setting up caddy, but it fails the exact same with both http and https.

Reproduction steps

  1. Add Spoolman integration
  2. Enter URL in the "Host" field.

I tried https://actual.local:7999/, http://actual.local:7912/ and http://192.168.1.178:7912/, all of them also without the trailing slash.

Debug logs

Set the spoolman component to debug logging, but since I can't set it up...

2023-12-06 17:57:53.660 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration tuya_local 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
2023-12-06 17:57:53.662 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration becker 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
2023-12-06 17:57:53.663 WARNING (SyncWorker_4) [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
2023-12-06 17:57:53.664 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration worlds_air_quality_index 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
2023-12-06 17:57:53.665 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration miele 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
2023-12-06 17:57:53.667 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration adaptive_lighting 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
2023-12-06 17:57:53.669 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration nuki_ng 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
2023-12-06 17:57:53.671 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration var 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
2023-12-06 17:57:53.673 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration powercalc 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
2023-12-06 17:57:53.676 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration thermal_comfort 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
2023-12-06 17:57:53.679 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration homematicip_local 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
2023-12-06 17:57:53.682 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration moonraker 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
2023-12-06 17:57:53.683 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration fontawesome 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
2023-12-06 17:57:53.686 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration sun2 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
2023-12-06 17:57:53.688 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration spoolman 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
2023-12-06 17:57:53.689 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration asusrouter 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
2023-12-06 17:57:53.691 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration presence_simulation 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
2023-12-06 17:57:53.693 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration watchman 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
2023-12-06 17:58:23.331 WARNING (MainThread) [homeassistant.util.async_] Detected blocking call to sleep inside the event loop by custom integration 'tuya_local' at custom_components/tuya_local/device.py, line 77: self._api = tinytuya.Device(dev_id, address, local_key), please create a bug report at https://github.com/make-all/tuya-local/issues
2023-12-06 17:58:24.247 WARNING (MainThread) [homeassistant.util.async_] Detected blocking call to sleep inside the event loop by custom integration 'tuya_local' at custom_components/tuya_local/device.py, line 77: self._api = tinytuya.Device(dev_id, address, local_key), please create a bug report at https://github.com/make-all/tuya-local/issues
2023-12-06 17:58:36.353 WARNING (MainThread) [zigpy.ota.provider] Salus: Couldn't download 'https://eu.salusconnect.io/demo/default/status/firmware': 403/Forbidden
2023-12-06 17:58:36.391 WARNING (MainThread) [zigpy.ota.provider] Salus: Couldn't download 'https://eu.salusconnect.io/demo/default/status/firmware': 403/Forbidden
2023-12-06 17:58:43.116 WARNING (MainThread) [zigpy.ota.provider] Salus: Couldn't download 'https://eu.salusconnect.io/demo/default/status/firmware': 403/Forbidden
2023-12-06 17:58:43.189 WARNING (MainThread) [aioesphomeapi.reconnect_logic] Can't connect to ESPHome API for m5stack-atom-echo @ 192.168.1.221: Error connecting to ('192.168.1.221', 6053): [Errno 113] Connect call failed ('192.168.1.221', 6053) (SocketAPIError)
2023-12-06 17:59:11.342 ERROR (MainThread) [homeassistant.components.homekit] HomeKit OctoPrint Camera cannot startup: entity not available: {'include_domains': [], 'exclude_domains': [], 'include_entities': ['camera.octoprint_camera'], 'exclude_entities': [], 'include_entity_globs': [], 'exclude_entity_globs': []}


### Diagnostics dump

Impossible, as the component cannot be installed.
Disane87 commented 10 months ago

Thank you for this issue. This seems pretty weird. Could you please open your Spoolman url with /api/v1/info at the end? It seems there is no connection to the api. Is there anything answering with a json response like this?

{
    "version": "0.13.1",
    "debug_mode": false,
    "automatic_backups": true,
    "data_dir": "/home/app/.local/share/spoolman",
    "backups_dir": "/home/app/.local/share/spoolman/backups",
    "db_type": "sqlite",
    "git_commit": "33b1c4f",
    "build_date": "2023-10-24T18:51:51Z"
}

Which version of spoolman do you use?

gschmidl commented 10 months ago

Tried them with the http and https endpoints:

/api/v1/info returns

{
    "version": "0.14.0",
    "debug_mode": false,
    "automatic_backups": true,
    "data_dir": "/home/app/.local/share/spoolman",
    "logs_dir": "/home/app/.local/share/spoolman",
    "backups_dir": "/home/app/.local/share/spoolman/backups",
    "db_type": "sqlite",
    "git_commit": "286e519",
    "build_date": "2023-12-02T11:16:35Z"
}

And here's /api/v1/filament:

[
    {
        "id": 1,
        "registered": "2023-12-05T20:10:13Z",
        "name": "EcoPLA Black",
        "vendor": {
            "id": 1,
            "registered": "2023-12-05T20:09:06Z",
            "name": "3DJake"
        },
        "material": "PLA",
        "price": 21.99,
        "density": 1.24,
        "diameter": 1.75,
        "weight": 1000,
        "spool_weight": 230,
        "settings_extruder_temp": 230,
        "settings_bed_temp": 45,
        "color_hex": "000000"
    }
]
gschmidl commented 10 months ago

If it helps, it might be that this version of spoolman breaks other stuff as the Moonraker plugin is also currently not working, despite their spoolman.py being updated yesterday (https://github.com/Arksine/moonraker/issues/762)

Disane87 commented 10 months ago

If it helps, it might be that this version of spoolman breaks other stuff as the Mainsail plugin is also currently not working, despite their spoolman.py being updated yesterday (Arksine/moonraker#762)

That was my first assumption when I saw you use the latest version. But I updated my spoolman to the newest version and its working flawlessly. Shouldn't be a problem of spoolman at all as it seems.

I have read your issue on moonraker but I also can't reproduce this issue you've described there with the latest version of spoolman.

But it seems there is an issue with your ssl/docker. In my use case I use nginx proxy manager and it's working. Event with the blank ip/port (http://192.168.7.11:8000) it could connect without any problems.

gschmidl commented 10 months ago

Should it work with the http version (my HA is on https)?

Edit: it works with the IP address! I think I know what's going on - presumably HA doesn't use itself as the DNS server and doesn't know what actual.local is...

Disane87 commented 10 months ago

Should it work with the http version (my HA is on https)?

That shouldn't be a problem. I tested this with my production HA with http and ip/port and its working too.

Disane87 commented 10 months ago

Edit: it works with the IP address! I think I know what's going on - presumably HA doesn't use itself as the DNS server and doesn't know what actual.local is...

For that reason I use a local DNS (AdGuard Home) and have my external subdomains locally available so that I can access my spoolman as I would when I connect externally.

Should I consider this as solved?

gschmidl commented 10 months ago

Yes, thank you (and sorry!)

Disane87 commented 10 months ago

Yes, thank you (and sorry!)

No problem :) glad you found the issue! Have fun with the integration