Skip to content

fp2: During initialization, raise the init value instead of refresh #2269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hdlee27
Copy link
Contributor

@hdlee27 hdlee27 commented Jul 18, 2025

Check all that apply

Type of Change

  • WWST Certification Request
    • If this is your first time contributing code:
      • I have reviewed the README.md file
      • I have reviewed the CODE_OF_CONDUCT.md file
      • I have signed the CLA
    • I plan on entering a WWST Certification Request or have entered a request through the WWST Certification console at developer.smartthings.com
  • Bug fix
  • New feature
  • Refactor

Checklist

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have verified my changes by testing with a device or have communicated a plan for testing
  • I am adding new behavior, such as adding a sub-driver, and have added and run new unit tests to cover the new behavior

Description of Change

do_refresh operates in two parts:

  1. state_update (updates values via REST API)
  2. Initializes some capabilities (values not handled by state_update).

Currently, during initialization, state_update() is called redundantly:

  1. initupdate_connectioncreate_sse → (SSE) on_createstate_update
  2. initdo_refreshstate_update

This duplication may cause conflicts. This can cause more issues, especially if the network conditions are poor.
To prevent this, instead of performing do_refresh at the end of init, I propose updating only impotant initialization values.

Summary of Completed Tests

Verified operation with 3 FP2 devices connected at the same time to:

  • SmartThings Hub V2
  • SmartThings Hub V3
  • SmartThings Station
  • SmartMonitor M5's built-in hub

Copy link

@hdlee27
Copy link
Contributor Author

hdlee27 commented Jul 18, 2025

@cjswedes @NoahCornell
Could you please review this PR?

Copy link

Test Results

   68 files    446 suites   0s ⏱️
2 324 tests 2 324 ✅ 0 💤 0 ❌
3 920 runs  3 920 ✅ 0 💤 0 ❌

Results for commit e34cc8d.

Copy link

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against e34cc8d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants