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

Create a sensor foreach attribute #75

Merged
merged 16 commits into from
Jun 28, 2022
Merged

Create a sensor foreach attribute #75

merged 16 commits into from
Jun 28, 2022

Conversation

edenhaus
Copy link
Collaborator

@edenhaus edenhaus commented Apr 10, 2022

Fixes #40
Fixes #55 long term statistics are available for sensors
Fixes #25

Fixes #51 Introducing a dependency model between each sensor/attribute and therefore we can only update some sensors/attributes.
This also gives the possibility, that we take only at most 60 seconds old values into the calculation.
Example use case:

  1. The last state change of the weight and impedance sensor is a day old
  2. A new state for the weight sensor is reported
  3. Only sensor/attributes, that depend on the weight only will be updated. The impedance value is to old to take into account.
  4. 30 seconds delay
  5. A new state for the impdeance sensor is reported
  6. Sensors who depends on impedance or weight and impedance will be updated, as the weight state is newer than 60 seconds.

@edenhaus edenhaus marked this pull request as draft April 10, 2022 20:58
@dckiller51
Copy link
Owner

I just tested your version. I have the sensors to create but they are in unknown.

@edenhaus
Copy link
Collaborator Author

@dckiller51 This PR is marked as draft as it is not ready yet :) I have to fix first the error, when not all data is available (which is your problem currently)
When it's ready for testing, I will request a review from you (Hopefully by the end of this week)

@edenhaus
Copy link
Collaborator Author

Fixes #51 Introducing a dependency model between each sensor/attribute and therefore we can only update some sensors/attributes. This also gives the possibility, that we take only at most 60 seconds old values into the calculation. Example use case:

1. The last state change of the weight and impedance sensor is a day old

2. A new state for the weight sensor is reported

3. Only sensor/attributes, that depend on the weight only will be updated. The impedance value is to old to take into account.

4. 30 seconds delay

5. A new state for the impdeance sensor is reported

6. Sensors who depends on impedance or weight and impedance will be updated, as the weight state is newer than 60 seconds.

@borpin @dckiller51 Do you think 60 seconds is enough?

P.S. This PR is still a draft, so not everything is working correctly (only be advised if you test this change)

@dckiller51
Copy link
Owner

To me that seems correct. Sometimes with our scale we have to go back on it because it was not at 0.

@edenhaus edenhaus linked an issue May 28, 2022 that may be closed by this pull request
@edenhaus edenhaus marked this pull request as ready for review June 24, 2022 20:51
@edenhaus edenhaus requested a review from dckiller51 June 24, 2022 20:51
@edenhaus
Copy link
Collaborator Author

@dckiller51 Sorry my notebook was broken so it took a little bit longer. Can you please review and test it?

@dckiller51
Copy link
Owner

@dckiller51 Sorry my notebook was broken so it took a little bit longer. Can you please review and test it?
@edenhaus
Hello,
Overall it seems to me that it works well.

  1. The weight is with many decimal.
  2. When you create a new user you have to restart the system to update the data otherwise you get unknow.

Your again did an amazing job

@edenhaus
Copy link
Collaborator Author

@dckiller51 Thanks for your feedback :) I have fixed your findings.
Can you please retest it

@dckiller51
Copy link
Owner

@dckiller51 Thanks for your feedback :) I have fixed your findings. Can you please retest it

Just one last correction. The ideal weight is with many decimal.

@edenhaus
Copy link
Collaborator Author

I fixed your last finding too and will merge it now :)

@edenhaus edenhaus merged commit 5f7252e into main Jun 28, 2022
@edenhaus edenhaus deleted the sensors branch June 28, 2022 14:11
@dckiller51
Copy link
Owner

@edenhaus
Hello, I just realized that we are losing information in the components bodymiscale.name
Sans titre

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