Skip to content
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

Real time updates #13

Merged
merged 4 commits into from
Feb 11, 2025
Merged

Real time updates #13

merged 4 commits into from
Feb 11, 2025

Conversation

Delmael
Copy link
Collaborator

@Delmael Delmael commented Feb 10, 2025

Hello hello
I've finaly managed to have real time data through the websocket.
It's not the coordinator but we have a full cycle of update.

Previous state:

  • Creating the entities with data from API
  • Receive data from websocket and update the data into model
  • Waiting hass to perform the entity data update to see current data

New state:

  • Creating the entities with data from API and register a callback
  • Receive data from websocket, updating data into model, sending custom hass event to be catch by callback
  • Entities receive this callback and perform a async_write_ha_state

I've also patch the node.update_status method.
Test it, and if there some errors please let me know 😄

Copy link

codecov bot commented Feb 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.29%. Comparing base (9257964) to head (fb966e1).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #13      +/-   ##
==========================================
+ Coverage   99.27%   99.29%   +0.02%     
==========================================
  Files          10       10              
  Lines         828      854      +26     
==========================================
+ Hits          822      848      +26     
  Misses          6        6              
Files with missing lines Coverage Δ
custom_components/smartbox/__init__.py 98.27% <100.00%> (ø)
custom_components/smartbox/climate.py 97.05% <100.00%> (-0.06%) ⬇️
custom_components/smartbox/const.py 100.00% <100.00%> (ø)
custom_components/smartbox/entity.py 97.67% <100.00%> (+0.90%) ⬆️
custom_components/smartbox/model.py 100.00% <100.00%> (ø)
custom_components/smartbox/number.py 100.00% <100.00%> (ø)
custom_components/smartbox/sensor.py 99.27% <100.00%> (+<0.01%) ⬆️
custom_components/smartbox/switch.py 100.00% <100.00%> (ø)

@Delmael
Copy link
Collaborator Author

Delmael commented Feb 10, 2025

I thinks we should plan a release after this merge (including smartob package), and do a PR on the HACS repo

@Delmael Delmael self-assigned this Feb 10, 2025
@Delmael Delmael requested a review from ajtudela February 11, 2025 16:43
@ajtudela
Copy link
Owner

LGTM!

@ajtudela ajtudela merged commit 2261102 into ajtudela:main Feb 11, 2025
5 checks passed
@ajtudela
Copy link
Owner

I thinks we should plan a release after this merge (including smartob package), and do a PR on the HACS repo

Agreed. I think all the work done deserve a release.

@ajtudela
Copy link
Owner

@Delmael I made a realease with the las changes and force ppull from my HACS integration, but I have some errors that didn't had before.

pydantic_core._pydantic_core.ValidationError: 19 validation errors for NodeSetup
user_duty_factor
Field required [type=missing, input_value={'sync_status': 'ok', 'co...: 0, 'power_factor': 0}}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.10/v/missing
flash_version
Field required [type=missing, input_value={'sync_status': 'ok', 'co...: 0, 'power_factor': 0}}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.10/v/missing
factory_options.boost_config
Field required [type=missing, input_value={'temp_compensation_enabl...': 0, 'power_factor': 0}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.10/v/missing

I think this is related to pushing a new version of smartbox to PyPI?

@Delmael
Copy link
Collaborator Author

Delmael commented Feb 11, 2025

Hum okay i know where it came from
I was afraid of this error 😢
To summarize, the API did not return the same data format of setup for devices.
I'll have to deactivate the validation I put in place (in the future i will have to found a way to test with more types of devices...)

But i wonder why it happen right now as this modification was already présent before this PR 🤔

Here the plan :

  • you should delete the release of hass-smartbox to not let other people downloading it
  • tomorrow i'll patch the smartbox pypi package to bypass the validation only for setup data
  • i'll made and push a new beta release on pypi
  • i'll do the PR on hass-smartbox to update the version of the smartbox package
  • you test

If everything is ok, for the full release, we will have to decide If we bump to 3.0.0 or to 2.1.0 all the projects

@ajtudela
Copy link
Owner

I have removed the last release.

I'll leave it in your hands ;)

@Delmael Delmael deleted the real-time-updates branch February 22, 2025 14:09
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