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
Add edl21 component for SML-based smart meters #27962
Conversation
Rebased and updated pysml dependency from 0.0.1 to 0.0.2. |
Thanks for this very nice component! I tested it and it works very well! For the documentation that is still to be added, I suggest to mention also
A useful feature in my opinion would be to customize the update interval. For instance, my smart meter reports the power to 0.01 W and energy to 0.1 mWh precision every second, which is really excessive. Every 10 or 30 seconds would be more than enough for me (and fill the history less). I think this could be achieved easily by adding a |
Already done, see home-assistant/home-assistant.io#11325.
I'm not sure about this. It is a feature of pyserial in general and applies to many more components supported by Home Assistant.
I'll look into it. |
FYI, I tested adding from datetime import timedelta
from homeassistant.util import Throttle
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=30)
# ...
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update_telegram(self, telegram: dict) -> bool:
# ... and it works as expected. When using a config option for the update interval (rather than hard-coding it), I guess one cannot use the decorator but can patch the method after instantiating the |
Thank you, David! Would you mind creating a PR on my branch, to preserve your authorship? I'd prefer 60 seconds, however, because that would match the interval used by the |
[edl21] Add 1 minute throttle to the sensor
Fix documentation URL Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
This comment has been minimized.
This comment has been minimized.
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. One final comment 🎉
Thank you for your reviews! I hope to have addressed everything by now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Just a question.
self._last_update = utcnow() | ||
self._state_attrs = { | ||
"status": "status", | ||
"valTime": "val_time", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of time is this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an optional timestamp which indicates when the measurement was performed. My device doesn't use it, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok 👍
Absolute timestamps are ok and they should be UTC.
Description:
This PR integrates EDL21 compatible smart meters as used in Germany. These smart meters use SML protocol messages to transmit various „OBIS“ values.
Pull request with documentation for home-assistant.io: home-assistant/home-assistant.io#11325
Example entry for
configuration.yaml
:Checklist:
tox
. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
python3 -m script.hassfest
.requirements_all.txt
by runningpython3 -m script.gen_requirements_all
..coveragerc
.If the code does not interact with devices: