Nerwyn/service-call-tile-feature

Selector doesn't select

jherby2k opened this issue · 5 comments

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue:

4.0.4

Last working release (if known):

N/A

Browser and Operating System:

Edge / Windows 11

Description of problem:

Not sure if this is just doc confusion or an actual bug, but i i set up a real simple selector here that isn't selecting anything. It highlights the current selection correctly - it just doesn't appear to actually change the selection when i click the buttons. Do we have to explicitly implement input_select.select_option via tap_action? That's not clear in the readme - sounds like it should be implicit. All the examples do seem to implement it, but they're much more complicated than what i'm trying to do here.

features:
  - type: vacuum-commands
    commands:
      - start_pause
      - locate
      - return_home
      - stop
  - type: custom:service-call
    entries:
      - type: selector
        entity_id: select.valetudo_rosie_mode
        options:
          - option: vacuum_and_mop
            icon: mdi:water
          - option: vacuum
            icon: mdi:water-off

this seems to be the minimum working config. The examples have an extra entity_id under each option that doesn't seem necessary.

features:
  - type: vacuum-commands
    commands:
      - start_pause
      - locate
      - return_home
      - stop
  - type: custom:service-call
    entries:
      - type: selector
        entity_id: select.valetudo_rosie_mode
        options:
          - option: vacuum_and_mop
            icon: mdi:water
            tap_action:
              action: call-service
              service: select.select_option
              data:
                option: vacuum_and_mop
              target:
                entity_id: select.valetudo_rosie_mode
          - option: vacuum
            icon: mdi:water-off
            tap_action:
              action: call-service
              service: select.select_option
              data:
                option: vacuum
              target:
                entity_id: select.valetudo_rosie_mode

Do your options match the state of the vacuum? Is there an attribute they're supposed to match instead?

By default the config will autofill with the tile or parent entity ID and the select option service, but autofill can be disabled and the actions of each button overwritten.

no they don't match the state of the vacuum at all - there is a separate select entity for controlling this - select.valetudo_rosie_mode. I figured that by setting entity_id at the selector level that's what it would be selecting. Not the vacuum parent.

Ah gotcha. I just tried with a select entity on my Home Assistant instance and it's working fine. I misread your original post. Yes, you have to define the service the selector options call. The configuration UI will autopopulate the entity ID (which isn't necessary but it's easier to do so than to not since it autofills for all custom features using the same code) and the tap action select/input_select.select_option service if you provide a select or input_select entity. Previously it was assumed that these services should be used if none was provided, but I should update the README to make it clear that it's now done by autofilling the tap action service call information.

Updated the README to mention that selector options do need their action fields filled out, whether by autofilled by the UI or by the user.