-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Improving Aqara SRTS-A01 converter and general export tidying #6922
Conversation
… switch to binary; Added entity_category
For child_lock, I propose to use the
They can access all packages that zhc has access to, can you provide the details? |
@Koenkk Thanks for the suggestion about lock.
Buffer was stubborn, but I managed to import it using Did some testing and it looks to be working. Still need some work done though. I kinda want to replace stateless enum with something, that would show as a button entity (that can be pressed from the interface) in Home Assistant. How is it defined in the converter context? |
Looks good to go, except for the proposed stateless enum ( |
Added device categories from here and did a lot of general export tidying. |
src/lib/utils.ts
Outdated
@@ -584,6 +584,31 @@ export function getFromLookup<V>(value: unknown, lookup: {[s: number | string]: | |||
return result ?? defaultValue; | |||
} | |||
|
|||
// Silly hack, but boolean is not supported as index | |||
export function getFromLookupBool(value: unknown, lookup: {[s: string | number]: string | number}): boolean | number { |
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.
Instead of adding a new function, could we maybe extend getFromLookup
like this:
export function getFromLookup<V>(value: unknown, lookup: {[s: number | string]: V}, defaultValue: V=undefined, keyIsBool: boolean=false): V {
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.
Merged them together
Thanks! |
Thanks for these nice improvements. Unfortunately, the renaming of I agree the old name was ambiguous and renaming is a good idea. Also, this isn't the first name change that happened in Z2M, so what I'm asking generally applies to all changes of this type, and I'm using this PR only as an example and placeholder for any similar case. Would it make sense to find a way of handling such breaking changes more gracefully and user-friendly? What's your opinion on this, @Koenkk? |
Oh, I didn’t realize that this introduced breaking changes. I even made some duplicate exports to leave other trvs alone because they used some of those broken exposes. But somehow forgot that name change will definitely brake some things. I think there should be a breaking changes section in the release notes. And they probably should be minimized. But in this case I intended to share it as a standard temperature input expose for other devices too. |
Yes, this would be a great start. Maybe also contributor guidelines with the best practices that you mentioned (focus on minimization and standardization). In the longer term, there could also be a kind of deprecation period, e.g., supporting old and new names in parallel for a few months, displaying deprecation notices in the UI, or detecting the use of old/deprecated names and displaying update prompts in the UI (similar to HA Repairs). Anyway, I didn't mean to hijack this PR. In case this fits the roadmap of Z2M, we may continue in a dedicated discussion thread. |
locale temperature no longer shows the external sensor temperature when sensor is set to EXTERNAL. I rolled back to previous version and there all is working fine. |
I've had a lot of problems with cashing after updating this converter. Had to restart, re-pair and clear mqtt topics several times before the new converter was actually applied. Maybe you have the same problem? No code, responsible for temperature data was changed, only the name of temperature input from |
Thanks, I'll try that. But for me it is clearly now showing the local sensor temperature of the SRTS instead of the external sensor temperature. Doesn't sound to be caching to me but more of ignoring passing on the external sensor temperature to the local sensor reading. I use Better Thermostat on top of this and have more communication and adjusting going on since this update which reduces batterie lifetime even more than it already is. My external sensors are more stable in regards to reported temperature while the SRTS build in sensor changes a lot obviously. |
If you look at entity id in HA and name of the temperature input in z2m dashboard, are they updated to the new name? |
Thanks external_temperature_input was key. Am in the process of changing all my automations to the new sensor name. I Wish this could have been more obvious as a breaking change. Best would have been to have kept the old sensor name for a while to let users transition. seems like child lock e.t.c. is broken too as my automations show unknown value for those. Well while I am at it I might as well make all the changes needed after this update. Again, thanks a lot for the speedy response and help. Took me a little bit to get back into understanding my own automations for my really cool room climate automation system. :=) |
This PR attempts to fix issues, found in #6887. All secondary exports received
device_category
.However, I can't seem to figure out, how to set
device_category
forchild_lock
andlock
in general.I've tried setting their
access
toALL
on defenition, usingwithAccess
and usingsetAccess
. But generateDefenition test always fails like this:Also I need help with testing in general, is there a way to use this modified converter on an active installation as HA OS Add-on without buying additional hardware? External converters seem to be limited and can't handle the usage of additional npm packages in the source code.