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

Home Assistant entity generic toggle #2015

Merged
merged 1 commit into from
May 6, 2024

Conversation

tuggan
Copy link
Contributor

@tuggan tuggan commented Apr 18, 2024

Added support for generic toggle on Home Assistant entities that support it. For entities that does not support toggle the feature will silently fail. This way matches how Home Assistant handles it.

Category

Feature

Overview

Currently when enabling both toggle and automation both will run on click. I am not sure what the best way of handling this is so that it is intuitive for the user. Personally i do not mind if it runs both when you have configured both but I'd love input on this.

Issue Number

#1848

New Vars

Entity toggle switch on the home assistant entity card.

@manuel-rw
Copy link
Collaborator

I'm currently unable to review this because I'm in holidays. I will be back on the 22 April but may not review this until a few days later. Please remind me to review this PR.

},
"genericToggle": {
"label": "Entity toggle",
"info": "Perform a generic Home Assistant toggle action on entity when clicked."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would make sense to mention that you should enable this for switches, light, ...

Comment on lines 97 to 109
if (!widget.properties.automationId && !widget.properties.genericToggle) {
return;
}

await mutateTriggerAutomationAsync({
configName: configName as string,
widgetId: widget.id,
});
if (widget.properties.genericToggle) {
await mutateTriggerToggleSync({
configName: configName as string,
widgetId: widget.id,
});
}

if (widget.properties.automationId) {
await mutateTriggerAutomationAsync({
configName: configName as string,
widgetId: widget.id,
});
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is weird. You're doing the same check twice.
Why not the following:

if (genericToggle) {
  // trigger generic toggle
  return;
}

// trigger automation

@manuel-rw
Copy link
Collaborator

This is really cool. I'm looking forward for this change for my private instance!

@tuggan
Copy link
Contributor Author

tuggan commented May 1, 2024

Ah yes, I'll go through that logic again and try to see what i was thinking

Added support for generic toggle on Home Assistant entities that support
it. For entities that does not support toggle the feature will silently
fail. This way matches how Home Assistant handles it.
@tuggan tuggan force-pushed the feature-homassistant-entity-toggle branch from a856fd3 to 857063a Compare May 6, 2024 13:14
@tuggan
Copy link
Contributor Author

tuggan commented May 6, 2024

The first if statement was redundant I just didn't remove it at first because i didn't want to change too much and then probably forgot it. The other two are needed to only execute the configured actions

@manuel-rw manuel-rw merged commit 18cd1f9 into ajnart:dev May 6, 2024
2 checks passed
truecharts-admin added a commit to truecharts/charts that referenced this pull request May 8, 2024
…c270b55 by renovate (#21754)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ghcr.io/ajnart/homarr](https://togithub.com/ajnart/homarr) | patch |
`0.15.2` -> `0.15.3` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>ajnart/homarr (ghcr.io/ajnart/homarr)</summary>

### [`v0.15.3`](https://togithub.com/ajnart/homarr/releases/tag/v0.15.3)

[Compare
Source](https://togithub.com/ajnart/homarr/compare/v0.15.2...v0.15.3)

> \[!NOTE]\
> We've been working actively on working torwards version 1.0 which will
include many improvements to performance, security and the overall look
& feel of Homarr. It will greatly overhaul the technical architecture of
Homarr. This work is done by volunteers. Please consider supporting our
work via donations at https://opencollective.com/homarr

#### Support for generic Home Assistant switches (lights, fans, ...)

Want to toggle your kitchen lights or shut off the music? Using the
brand new support for generic switches you can toggle now almost
anything:

![homeassistant-lights](https://togithub.com/ajnart/homarr/assets/30572287/2cd79222-ca7d-4773-95e8-845cb382468c)

#### Promox integration

Homarr now features a Promox widget that can display CPU, RAM and more
information directly on your dashboard:

![305290159-b6ed7b8a-335b-41d0-b5c8-8edb736db3ee](https://togithub.com/ajnart/homarr/assets/30572287/cfc6f949-16f8-4add-a4eb-668c258c3305)

#### Tdarr widget

Homarr now also integrates with Tdarr to display the status of your
workers and the queue:

![Untitled](https://togithub.com/ajnart/homarr/assets/30572287/b368c4ae-7b6e-42d7-9bfc-58a110646dbe)

#### Add placeholder for dynamic URLs

When using advanced reverse proxy setups, sometimes the hostname is not
known yet.
We have added a new feature that enables you to replace certain
placeholders: <img width="598"
alt="326171056-a55c3e49-9cd6-4523-90cf-16e91b2c7502"
src="https://github.com/ajnart/homarr/assets/30572287/53cf7469-586a-4fda-9dbf-3651cf3e2189">

#### Usability improvements to the torrent widget

The torrent widget has received a major upgrade and should scale now
better on most devices with improved customizability:


![image](https://togithub.com/ajnart/homarr/assets/30572287/8dbcd786-03ed-49da-b4ef-8a7b5b5bdd46)

![image](https://togithub.com/ajnart/homarr/assets/26098587/325ec664-c0cc-4cfa-bfb5-717d3674bda4)

#### Other bugfixes

-   Fixed overlapping of the grid elements and the navbar
-   Fixed video playback for iOS and Apple devices
- Fixed issues with the certificates for the avatars (this will also
resolve issues with the page being shown as "not secure")

#### What's Changed

- fix: health monitoring hotfix by
[@&#8203;hillaliy](https://togithub.com/hillaliy) in
[ajnart/homarr#1970
- fix: change media request TV poster and movie name by
[@&#8203;SeDemal](https://togithub.com/SeDemal) in
[ajnart/homarr#1983
- fix: weather widget does not refresh automatically by
[@&#8203;hillaliy](https://togithub.com/hillaliy) in
[ajnart/homarr#1981
- fix: [#&#8203;1976](https://togithub.com/ajnart/homarr/issues/1976)
lower debounce time by
[@&#8203;manuel-rw](https://togithub.com/manuel-rw) in
[ajnart/homarr#1979
- chore: new Crowdin updates by
[@&#8203;ajnart](https://togithub.com/ajnart) in
[ajnart/homarr#1968
- feat: add Proxmox integration/widget by
[@&#8203;dslatt](https://togithub.com/dslatt) in
[ajnart/homarr#1903
- feat: columns customize by
[@&#8203;hillaliy](https://togithub.com/hillaliy) in
[ajnart/homarr#1975
- feat: added playsInline to VideoBackground by
[@&#8203;spkesDE](https://togithub.com/spkesDE) in
[ajnart/homarr#1996
- fix: ping indicators floating above header in board customization page
by [@&#8203;krishnamuppaneni](https://togithub.com/krishnamuppaneni) in
[ajnart/homarr#1998
- fix: OIDC Timeout by
[@&#8203;catrielmuller](https://togithub.com/catrielmuller) in
[ajnart/homarr#2002
- fix: Pass axios error into log call for proxmox. Please include in
v0.15.3 by [@&#8203;dslatt](https://togithub.com/dslatt) in
[ajnart/homarr#2012
- feat: add romanian language support by
[@&#8203;Meierschlumpf](https://togithub.com/Meierschlumpf) in
[ajnart/homarr#2017
- fix: missing romanian language in next-i18next.config.js by
[@&#8203;Meierschlumpf](https://togithub.com/Meierschlumpf) in
[ajnart/homarr#2018
- feat: add Tdarr integration and widget by
[@&#8203;jbruell](https://togithub.com/jbruell) in
[ajnart/homarr#1882
- feat: torrent widget: polishing UI and improve popover interactions by
[@&#8203;SeDemal](https://togithub.com/SeDemal) in
[ajnart/homarr#2016
- fix: Modals titles nested headers and edit mode nested buttons errors
by [@&#8203;SeDemal](https://togithub.com/SeDemal) in
[ajnart/homarr#2019
- fix: Avatar host by [@&#8203;SeDemal](https://togithub.com/SeDemal) in
[ajnart/homarr#2027
- feat: Home Assistant entity generic toggle by
[@&#8203;tuggan](https://togithub.com/tuggan) in
[ajnart/homarr#2015
- feat: add logout callback URL and session expiration environment
variables by [@&#8203;SeDemal](https://togithub.com/SeDemal) in
[ajnart/homarr#2023
- fix: ldap filters by [@&#8203;SeDemal](https://togithub.com/SeDemal)
in
[ajnart/homarr#2033
- chore: new Crowdin updates by
[@&#8203;ajnart](https://togithub.com/ajnart) in
[ajnart/homarr#1984
- feat: add `[homarr_base]` replacement for external urls by
[@&#8203;j3lte](https://togithub.com/j3lte) in
[ajnart/homarr#2024
- core: increase version to 0.15.3 by
[@&#8203;Meierschlumpf](https://togithub.com/Meierschlumpf) in
[ajnart/homarr#2007

#### New Contributors

- [@&#8203;dslatt](https://togithub.com/dslatt) made their first
contribution in
[ajnart/homarr#1903
- [@&#8203;krishnamuppaneni](https://togithub.com/krishnamuppaneni) made
their first contribution in
[ajnart/homarr#1998
- [@&#8203;catrielmuller](https://togithub.com/catrielmuller) made their
first contribution in
[ajnart/homarr#2002
- [@&#8203;jbruell](https://togithub.com/jbruell) made their first
contribution in
[ajnart/homarr#1882
- [@&#8203;j3lte](https://togithub.com/j3lte) made their first
contribution in
[ajnart/homarr#2024

**Full Changelog**:
ajnart/homarr@v0.15.2...v0.15.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNDkuMyIsInVwZGF0ZWRJblZlciI6IjM3LjM0OS4zIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbImF1dG9tZXJnZSIsInVwZGF0ZS9kb2NrZXIvZ2VuZXJhbC9ub24tbWFqb3IiXX0=-->
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.

None yet

2 participants