jbergler / hass-ttlock

Home Assistant integration for TTLock locks
54 stars 12 forks source link

Webhook notification not going away #65

Closed karlc28 closed 5 months ago

karlc28 commented 1 year ago

Describe the bug

I followed all the steps now i can access the lock in home assistant but the we hook notification keeps coming back

Expected behavior

The notification to stay away

Diagnostic info

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.7.3",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.11.4",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/London",
    "os_name": "Linux",
    "os_version": "6.1.34",
    "supervisor": "2023.07.1",
    "host_os": "Home Assistant OS 10.3",
    "docker_version": "23.0.6",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "keymaster": {
      "version": "v0.0.85",
      "requirements": []
    },
    "moonraker": {
      "version": "0.9.2",
      "requirements": [
        "moonraker-api==2.0.5"
      ]
    },
    "sonoff": {
      "version": "3.5.2",
      "requirements": [
        "pycryptodome>=3.6.6"
      ]
    },
    "average": {
      "version": "2.3.0",
      "requirements": []
    },
    "ttlock": {
      "version": "v0.5.4",
      "requirements": [
        "pydantic"
      ]
    },
    "watchman": {
      "version": "0.5.1",
      "requirements": [
        "prettytable==3.0.0"
      ]
    },
    "composite": {
      "version": "2.8.4",
      "requirements": []
    },
    "hacs": {
      "version": "1.32.1",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    }
  },
  "integration_manifest": {
    "domain": "ttlock",
    "name": "TTLock",
    "after_dependencies": [
      "cloud"
    ],
    "codeowners": [
      "@jbergler"
    ],
    "config_flow": true,
    "dependencies": [
      "application_credentials",
      "persistent_notification",
      "webhook"
    ],
    "documentation": "https://github.com/jbergler/hass-ttlock",
    "homekit": {},
    "iot_class": "cloud_polling",
    "issue_tracker": "https://github.com/jbergler/hass-ttlock/issues",
    "requirements": [
      "pydantic"
    ],
    "ssdp": [],
    "version": "v0.5.4",
    "zeroconf": [],
    "is_built_in": false
  },
  "data": {
    "config_entry": {
      "entry_id": "fbea64f440d55e8209737fe2dab1dde0",
      "version": 1,
      "domain": "ttlock",
      "title": "Front Door",
      "data": {
        "auth_implementation": "ttlock_23cd8641b2714bb2b29f7febef6649fb",
        "token": "**REDACTED**",
        "webhook_id": "b311dde904612616d3e04b63f3406e8ecb1aeefb53a88b6c1c223d7a20cb23d5"
      },
      "options": {},
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "unique_id": null,
      "disabled_by": null
    },
    "locks": [
      {
        "unique_id": "ttlock-8176862",
        "device": {
          "name": "Front Door",
          "mac": "33:B4:FC:4D:2E:F1",
          "model": "SN9206-01-FS_PV53",
          "battery_level": 100,
          "hardware_version": "1.6.1",
          "firmware_version": "6.4.18.221017",
          "features": 3429670792787447,
          "locked": false,
          "action_pending": false,
          "last_user": null,
          "last_reason": null,
          "auto_lock_seconds": 5,
          "passage_mode_config": {
            "__type": "<class 'custom_components.ttlock.models.PassageModeConfig'>",
            "repr": "PassageModeConfig(enabled=<OnOff.off: 2>, start_minute=0, end_minute=0, all_day=<OnOff.unknown: 0>, week_days=[], auto_unlock=<OnOff.off: 2>)"
          }
        },
        "entities": [
          {
            "entity_id": "lock.front_door",
            "state": "unlocked",
            "attributes": {
              "friendly_name": "Front Door",
              "supported_features": 0
            },
            "last_changed": "2023-08-01T14:38:46.828232+00:00",
            "last_updated": "2023-08-01T14:38:46.828232+00:00",
            "context": {
              "id": "01H6RRJZK0PDK1KF16N77JRCC4",
              "parent_id": null,
              "user_id": "44a03e8036354cd589369eddf2b0e7a4"
            }
          },
          {
            "entity_id": "sensor.front_door_battery",
            "state": "100",
            "attributes": {
              "unit_of_measurement": "%",
              "device_class": "battery",
              "friendly_name": "Front Door Battery"
            },
            "last_changed": "2023-08-01T14:34:27.057237+00:00",
            "last_updated": "2023-08-01T14:34:27.057237+00:00",
            "context": {
              "id": "01H6RRB3BHBPEVH08SP0EG5SGH",
              "parent_id": null,
              "user_id": null
            }
          },
          {
            "entity_id": "sensor.front_door_last_operator",
            "state": "Unknown",
            "attributes": {
              "friendly_name": "Front Door Last Operator"
            },
            "last_changed": "2023-08-01T14:34:27.057631+00:00",
            "last_updated": "2023-08-01T14:34:27.057631+00:00",
            "context": {
              "id": "01H6RRB3BHGBN6MSDAA8X1HZ0X",
              "parent_id": null,
              "user_id": null
            }
          },
          {
            "entity_id": "sensor.front_door_last_trigger",
            "state": "Unknown",
            "attributes": {
              "friendly_name": "Front Door Last Trigger"
            },
            "last_changed": "2023-08-01T14:34:27.058031+00:00",
            "last_updated": "2023-08-01T14:34:27.058031+00:00",
            "context": {
              "id": "01H6RRB3BJDWQX0HGEEVPDCC0B",
              "parent_id": null,
              "user_id": null
            }
          },
          {
            "entity_id": "binary_sensor.front_door_passage_mode",
            "state": "off",
            "attributes": {
              "friendly_name": "Front Door Passage Mode"
            },
            "last_changed": "2023-08-01T14:34:27.058429+00:00",
            "last_updated": "2023-08-01T14:34:27.058429+00:00",
            "context": {
              "id": "01H6RRB3BJN7QYH1Y9FBRJQCFX",
              "parent_id": null,
              "user_id": null
            }
          }
        ]
      }
    ]
  }
}
karlc28 commented 1 year ago

@jbergler How do I fix this as every time home assistant restarts I get the webhook request

jbergler commented 1 year ago

@karlc28 hello - the notification will go away once you successfully receive a webhook from the ttlock cloud. I suggest you double check that the url you have setup in the ttlock portal is reachable from the internet.

karlc28 commented 1 year ago

Sorry to sound stupid but how do I check that

jbergler commented 1 year ago

An easy way is to open the webhook url in a web browser when you're not connected to your home internet. If it times out or says connection refused then it's not working.

I can't really provide much support for this, given there's so many little details that vary from setup to setup. If you have a nabu casa cloud subscription, their remote access provides a proxy service for webhooks that this integration will use. Otherwise I'd say look into however you have remote access to your home assistant setup.

karlc28 commented 1 year ago

I am using cloudflared When I go to the url it just shows a white screen The lock works correctly but the notification keeps returning

ggiannotti commented 12 months ago

i can reach my webhook from outside my network, but don't know why the notification don't go away... the url is corrent at ttlock webhook :( and i'm using cloudflared too... anyone knows how to make a better test?

karlc28 commented 12 months ago

An easy way is to open the webhook url in a web browser when you're not connected to your home internet. If it times out or says connection refused then it's not working.

I can't really provide much support for this, given there's so many little details that vary from setup to setup.

If you have a nabu casa cloud subscription, their remote access provides a proxy service for webhooks that this integration will use. Otherwise I'd say look into however you have remote access to your home assistant setup.

Cannot access the webhook at all Not sure where to go from here I'm using cloudflare to access remotely and would appreciate any help

ggiannotti commented 12 months ago

Callback url test failed:javax.net.ssl.SSLHandshakeException : sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

i see this error when click on test... but i do have ssl with this url

illusive-c commented 11 months ago

Callback url test failed:javax.net.ssl.SSLHandshakeException : sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

i see this error when click on test... but i do have ssl with this url

You might have some sort of access control to your CloudFlare tunnel. I had a geography based one. I'm living in the UK and the WebHook notifications were being sent from Germany. After allowing German IPs to bypass the tunnel, the notification disapeared for me.

J4YRD commented 11 months ago

Yeah I think I've got it.

Copy the webhook link from the notification in Home Assistant.

Login to Open.lock.com

Open the app you created.

Past that link into the Callback URL field.

Done.

jbergler commented 10 months ago

Thanks everyone who chimed in with help! @karlc28 or anyone else who reported problems - are you still having issues?

jbergler commented 10 months ago

I've also just spotted that there is now a "test" link over at euopen.ttlock.com

image
karlc28 commented 10 months ago

Callback url test failed:javax.net.ssl.SSLHandshakeException : sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

i see this error when click on test... but i do have ssl with this url

You might have some sort of access control to your CloudFlare tunnel. I had a geography based one. I'm living in the UK and the WebHook notifications were being sent from Germany. After allowing German IPs to bypass the tunnel, the notification disapeared for me.

How do you do that I'm on cloudflare too

Kevin4999 commented 10 months ago

An easy way is to open the webhook url in a web browser when you're not connected to your home internet. If it times out or says connection refused then it's not working.

I can't really provide much support for this, given there's so many little details that vary from setup to setup. If you have a nabu casa cloud subscription, their remote access provides a proxy service for webhooks that this integration will use. Otherwise I'd say look into however you have remote access to your home assistant setup.

Hey. I have the same webhook issue. I use duck dns to connect to HA outside of my network. I noticed that the webhook is trying to access through https://xxxxxxxx.duckdns.org:8213/api/webhook/xxxxxxxxxxxxxxxxxxxx. But i only use the duck dns url withour the port 8123. Maybe that is why i'm getting the webhook url notification. How can i resolve this and make it call https://xxxxxxxx.duckdns.org only and not :8123 at the end?

jbergler commented 10 months ago

The notification only makes a guess at the url based on what home assistant knows. If you're using port 443, then you can just change the url in the ttlock portal and it should work.

Kevin4999 commented 10 months ago

The notification only makes a guess at the url based on what home assistant knows. If you're using port 443, then you can just change the url in the ttlock portal and it should work. - Jonas

I got it to work by entering it without the port number in the callback url. Thanks

AlexZeGamer commented 6 months ago

Callback url test failed:javax.net.ssl.SSLHandshakeException : sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

i see this error when click on test... but i do have ssl with this url

I have the same error when I try to add the generated webhook URL on the TTLock portal. (Also using Cloudflared) image

I tried configuring Cloudflare but I didn't find anything useful...

I think the webhooks on my instance of HA are exposed through Cloudflared and I haven't been successful in trying to expose them image

jbergler commented 5 months ago

There doesn't appear to be anything wrong with the integration here, so I'm closing this.