landroid_cloud icon indicating copy to clipboard operation
landroid_cloud copied to clipboard

[FR]: Party Mode Setter to Enable/Disable (not just toggling)

Open Johnson145 opened this issue 2 years ago • 7 comments

Is your feature request related to a problem? Please describe. Currently, the party mode can only get toggled.

Toggling only makes certain automations quite complicated. For instance, I'd like to enable the party mode whenever someone gets home and disable it when the house is empty. Currently, I either need to fetch the current party mode state manually before each action (which may be quite unconvenient e.g. in Home Assistant) or the automation result depends "randomly" on the last state.

Describe the solution you'd like In addition to toggling, it would be really cool, if one can explicitly request to enable or disable the party mode. If the requested state already equals the current one, nothing happens. Otherwise, it gets updated.

Describe alternatives you've considered As described above, one could workaround this by checking the current state manually each time on the client side.

Additional context I just had a quick look at your implementation and it looks like your toggling feature is actually using a regular setter method already. Thus, I hope there isn't any limiting API issue and an implementation should be quite straight forward?

Johnson145 avatar Sep 04 '22 10:09 Johnson145

Define 'unconvinient' - it's no problem fetching the current state in a selector ;)

MTrab avatar Sep 04 '22 11:09 MTrab

If my goal is to "set the party mode to on", I feel like it is indeed inconvenient having to replace that action with "is the party mode on already? then don't do anything, otherwise toggle". Of course that shouldn't be a too big deal to live with this limitation. However, in my opinion the basic setter is a low-level-feature which rather makes sense to include it in the API instead of letting the user deal with it.

I tried setting it up in Home Assistant with Node Red. As a Home Assistant beginner, I found it very easy to just trigger an existing service. However, I completely failed when trying to get the attribute of an entity in the first place. It's at least more tricky than just dealing with the state of an entity or calling a service. Probably I'm missing something obvious there and it's easy for a non-noob user.

Moreover, the atomic setter could prevent race conditions, which may occur in the workaround (assuming that the worx API has an atomic setter).

Just thinking out loud. If you agree with me and like to add it to your project, great! If you just don't have time to add it, I may propose a PR at some time? If you don't like that feature in the first place, feel free to close this issue.

Johnson145 avatar Sep 04 '22 14:09 Johnson145

Point taken - will make the change, althou this will be a low priority :)

MTrab avatar Sep 05 '22 15:09 MTrab

Awesome. I appreciate that!

Johnson145 avatar Sep 06 '22 08:09 Johnson145

Hello i´d also like to have the party mode as a entities, so i can toggle with the condition . I like to set party modus when the weather sensor reports rain. so the landroid don´t hs to start from the garage and if party mode is set - this will work.

mwalter665 avatar Sep 16 '22 15:09 mwalter665

Hello i´d also like to have the party mode as a entities, so i can toggle with the condition . I like to set party modus when the weather sensor reports rain. so the landroid don´t hs to start from the garage and if party mode is set - this will work.

It will be as a service, not an entity

MTrab avatar Sep 19 '22 18:09 MTrab

Hello for the Partymode i now have the Solution if it is raining. And so the toggle is no problem if the condition looks how the party mode is:

Here is my YAML: alias: Regen-Partymodus Landroid an description: "" trigger:

  • type: moist platform: device device_id: 9b041cdb8f10a636e4dd211441ac19ab entity_id: binary_sensor.hip_wettersensor_raining domain: binary_sensor condition:
  • condition: numeric_state entity_id: vacuum.mower attribute: party_mode_enabled below: 1 action:
  • service: landroid_cloud.partymode data: {} target: entity_id: vacuum.mower mode: single.

in visuell it looks likes like that:

2022-10-12 08_47_23-Einstellungen – Home Assistant

i hope this will help other users to find how to look for the service

mwalter665 avatar Oct 12 '22 06:10 mwalter665

@Johnson145 it is in the latest beta version. Can you test so this issue can be closed?

maartendamen avatar Apr 22 '23 07:04 maartendamen

Hey,

I just started to use the implementation today and habe 3.0.0b5. If I got it right, now the service is always a toggle, right? I played arround in the DEVL section, and nevertheless what I choose, if enabled true or false, there is a toggle.

I was wondering how to react realy on the state. Or is this a bug?

Set to on:

service: landroid_cloud.partymode
data:  
   party_mode_enabled: true
target:  
   entity_id: vacuum.james

Set to off:

service: landroid_cloud.partymode
data:  
   party_mode_enabled: false
target:  
   entity_id: vacuum.james

Without having a look to the current state, it will always toggle.

Phoenix-DH avatar Apr 24 '23 12:04 Phoenix-DH

It is meant to do both, toggle if no party_mode_enabled is provided and set otherwise. I looked into this and found that I introduced a bug. I just put out a PR to fix this. Have to wait for @MTrab to merge this into a new beta.

maartendamen avatar Apr 24 '23 13:04 maartendamen

Ah, good to know, that means I was not that stupid :) In the meanwhile I tried to check it in forhand.

Thanks for your work on this.

Phoenix-DH avatar Apr 24 '23 13:04 Phoenix-DH

Thanks for the update and the information! I'll wait for the associated bugfix and will be glad to test the feature afterwards, too.

Johnson145 avatar Apr 25 '23 17:04 Johnson145

Fixed in #353

MTrab avatar May 16 '23 18:05 MTrab

Thanks for the fix, it is working.

Phoenix-DH avatar May 17 '23 09:05 Phoenix-DH