Commit graph

30 commits

Author SHA1 Message Date
0477d0772d Bump version to 0.3.2
Some checks failed
Validate / validate-hacs (push) Has been cancelled
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 07:06:49 +00:00
cddc1e9d72 Allow per-device removal from the integration
Some checks are pending
Validate / validate-hacs (push) Waiting to run
HA blocks "Delete device" (and the equivalent
config/device_registry/remove_config_entry WS call) unless an
integration implements async_remove_config_entry_device. Add the
hook returning True so users can prune devices that are gone from
their Samsung Find account without editing the registry by hand.
A returning device with the same dvceID will be recreated on the
next coordinator setup.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 07:02:31 +00:00
4c26792c37 Fix cookie-jar pollution; remove dead QR login code; add tests
The reauth flow ran validate_jsessionid against HA's shared aiohttp
session, then update_cookies({"JSESSIONID": ...}) added the new value
with no domain. aiohttp's cookie jar still held the previous
JSESSIONID pinned to smartthingsfind.samsung.com (set via Set-Cookie
during the previous load), and aiohttp prefers the more-specific
domain match — so the *stale* cookie went out, Samsung returned no
_csrf header, and the user saw "Cookie was rejected by SmartThings
Find" even though their cookie was fine.

Two fixes:

* validate_jsessionid now runs in an isolated aiohttp.ClientSession
  with its own jar, so the shared HA jar can't shadow the cookie
  under test.

* async_setup_entry clear_domain()s the smartthingsfind.samsung.com
  cookies before reseating JSESSIONID with response_url, otherwise
  the same shadowing breaks the entry reload that follows a
  successful UI reauth.

Also remove the QR-code login code (do_login_stage_one / _two,
gen_qr_code_base64, the legacy URL constants and qrcode/base64/
random/string/re/asyncio/io/timedelta imports) — Samsung migrated
account.samsung.com to a SPA-driven IAM/OAuth2 flow months ago, so
the QR scrape no longer works and nothing in the integration
references those helpers anymore. Drops the qrcode/pillow/requests
manifest requirements.

Tests: a minimal conftest stubs the homeassistant.* imports the
integration uses, and four async tests cover validate_jsessionid
including the regression case where a domain-bound stale cookie
sits in the shared jar.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 06:44:59 +00:00
7457a8284b Fix coordinator wiring after refactor
Two bugs left from the hass.data move that surfaced as soon as the
integration ran on the live HA:

* In async_setup_entry, devices were stored in hass.data AFTER
  coordinator.async_config_entry_first_refresh(), but
  _async_update_data reads them from hass.data — so the very first
  refresh raised KeyError 'devices' and the entry stayed in
  setup_retry. Move the hass.data update before first_refresh.

* SmartThingsDeviceTracker called self.async_on_update(...) which
  isn't a method on TrackerEntity. Without a working listener
  registration the tracker stayed restored=true / unavailable
  forever. Subscribe in async_added_to_hass and use async_on_remove
  for cleanup, which is the documented pattern.

Verified end-to-end on a live HA: phones/watch produce GPS, battery
sensors populate, and the Ring button triggers a SmartTag.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 02:01:05 +00:00
73aa86cfb5 Gitignore .env
The local .env holds a long-lived HA token used for development;
keep it out of any push.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 01:22:14 +00:00
13ff5a534e Replace broken QR login with manual JSESSIONID cookie
Samsung rebuilt account.samsung.com as a JS SPA backed by /iam/oauth2,
so the integration's HTML-scraping QR flow can no longer find the
signin URL and /accounts/v1/FMM2/signInWithQrCode now 404s. The STF
backend (chkLogin.do, getDeviceList.do, ...) is unchanged.

Replace the multi-step QR config flow with a single form that asks
the user to paste the JSESSIONID cookie copied from a logged-in
browser session at smartthingsfind.samsung.com. validate_jsessionid
hits chkLogin.do to verify the cookie before accepting it.

Also bundle in earlier compatibility fixes for newer HA: store
devices in hass.data so the coordinator can look them up by
entry_id, and use async_on_update on the device_tracker entity.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 01:16:22 +00:00
Vedeneb
13bd1dabe0
Add archive notice 2024-09-11 14:12:03 +02:00
freybene
2962498fc0 Bump version 2024-07-27 09:26:15 +02:00
freybene
922af5aea7 Allow manual reauth (fixes #16) 2024-07-27 09:25:59 +02:00
Vedeneb
ee87236579
Small README.md improvements 2024-06-20 06:43:38 +02:00
freybene
a5c832d080 Bump version 2024-06-19 12:17:26 +02:00
freybene
065163fdcc Add option to enable/disable active mode and make update_interval configurable (closes #11) 2024-06-19 12:15:05 +02:00
freybene
6f17edae14 Unescape device names (fixes #12) 2024-06-19 10:32:47 +02:00
freybene
6e4285f824 Use entry_id for local data (fixes #10, #13) 2024-06-19 09:11:56 +02:00
freybene
a2a9150a9b Bump version 2024-05-29 16:27:13 +02:00
freybene
0d1984558f Fix error when disabling single entity 2024-05-29 16:26:25 +02:00
freybene
9418cc61e6 Don't fetch data for disabled devices 2024-05-29 15:27:53 +02:00
freybene
8d68bbac4a Bump version 2024-05-29 14:24:50 +02:00
freybene
1e2b4c796c Add attribute last_seen 2024-05-29 14:24:31 +02:00
Vedeneb
9ba8f1dd76
Bump version for first release 2024-05-28 12:21:00 +02:00
freybene
65927af44e Add HACS support 2024-05-28 12:13:44 +02:00
freybene
47b65a802f Add hacs.json, prepare manifest for HACS 2024-05-28 12:02:52 +02:00
freybene
30b234945d Remove temporary logging 2024-05-28 11:53:01 +02:00
Vedeneb
0172067315
Create validate.yaml in preparation to HACS support 2024-05-28 11:50:25 +02:00
freybene
17184ed014 Fix encoding issues by adding 'Accept'-Header. Closes #1 2024-05-25 12:10:46 +02:00
freybene
0f9ae570f6 Add battery_level 'VERY_LOW', reduce some log levels, bump version_number 2024-05-25 08:20:20 +02:00
Vedeneb
5ba3e2848d
Update README.md 2024-05-24 22:11:26 +02:00
freybene
a8110339e6 Add screenshot 2024-05-24 22:10:35 +02:00
Vedeneb
6e20691976
Create LICENSE 2024-05-24 21:42:14 +02:00
freybene
ac2b38ad81 Initial commit 2024-05-24 21:39:41 +02:00