Skip to content

Conversation

@dfries
Copy link
Contributor

@dfries dfries commented Mar 10, 2025

I just got bit by a couple things and wanted to contribute back to improve the documentation.
I think they are all minor changes or formatting and straight forward.

The biggest hurdle I had was trying to query the history, I was wanting yesterday's value, and everything in Home Assistant is geared around the most recent value. In my case I was monitoring my car's TPMS and was wanting the leak rate, so now - yesterday. I tried the Derivative sensor, but it does weighted averages for the time period, and since there's a large block of time each day that the car isn't available to get the pressure completely throws off the average leak rate.

instance = get_instance(hass)
future = await instance.async_add_executor_job(history.get_significant_states, hass, start, stop, ids)

I see the asyncio Futures page list print(await fut) for getting the future value, but that doesn't seem to work. The best I've done is future.add_done_callback with all the drawbacks of needing to pass a compiled python function or lambda, it does work for what I need.

dfries added 2 commits March 9, 2025 18:54
It says four variables, but lists five, removed "four".
I was tripped up by a null message with a payload_obj listed as a required function parameter, give a hint for not specifying it as a required parameter.
Moved qos before payload as I listed the arguments in order, and needed it to not be last for payload_obj to be optional and qos not.
Fixed the Wildcard formatting, the two bullet points were all made into one paragraph with "- + matches" confusing as I didn't think - was a wildcard, it needed the blank line to render them as bullet points.
Give @pyscript_compile and lambda as another work around for
python callback functions.
@craigbarratt craigbarratt merged commit 2127188 into custom-components:master Mar 10, 2025
1 check passed
@craigbarratt
Copy link
Member

Thanks for the doc updates!

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