-
Notifications
You must be signed in to change notification settings - Fork 47
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
v3 Climate Component #86
Conversation
✅ Deploy Preview for esphome-webserver ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Nice work, thanks so much for the contribution. Some small not important suggestions that are non-blocking.
if ( | ||
e?.currentTarget?.domain === "sensor" || | ||
e?.currentTarget?.domain === "climate" | ||
) { |
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.
Not important and not certain if this code is being transpiled, but if it is, a bit of redundant code can be reduced by doing something like if (!e?.currentTarget) return;
as the first line within this function. That way we're not repeatedly checking and ensuring that e
and currentTarget
exists (if it does the first time, it will the next n times). Then also TS shouldn't require ?
for each reference (e?.currentTarget?...
-> e.currentTarget...
).
I know this wasn't you, but a good opportunity for tiny clean up if you're willing.
let targetTemp = | ||
target === "high" | ||
? entity.target_temperature_high | ||
: entity.target_temperature || entity.target_temperature_low; |
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.
One small improvement might be caching this choice to something like const lowTemp = entity.target_temperature || entity.target_temperature_low;
and using that reference instead. Probably same for most of the Number
casts used multiple times.
This reverts commit b09657b.
v3 Climate component draft. Introduces:
It could do with a bit more design work, ideally just needs a little more horizontal space