DBuit / switch-popup-card

10 stars 7 forks source link

Service calls miss entity_id (or area_id) #4

Closed kaosmagix closed 4 years ago

kaosmagix commented 4 years ago

I try to use the popup card as a popup for a template sensor button (the sensor has a state depending on the status of a few input_boolean's). In the popup I try to set a specific input_boolean on/off. But I cannot get that to work the issue is always an error that the service input_boolean.turn_on is missing the entity_id. The popup opens with the correct state selected (so reading the correct state of the sensor works, but the service call doesn't.

This is my code:

  rows:
  - row: 1
    columns:
    - column: 1
      tileOnRow: 3
      entities:
      - title: Algemeen
        entities:
        - entity: sensor.mode_home
          popup:
            type: custom:switch-popup-card
            noActiveState: '-'
            entity_value_path: state
            entities:
            - sensor.mode_home
            buttons:
            - icon: "mdi:white-balance-sunny"
              value: "day"
              name: "Day"
              color: "#FFF"
              icon_color: "rgba(255,255,255,1)"
            - icon: "mdi:home-export-outline"
              value: "away"
              name: "Away"
              color: "#FFF"
              icon_color: "rgba(255,255,255,1)"
            - icon: "mdi:account-question"
              value: "guest"
              name: "Guest"
              color: "#FFF"
              icon_color: "rgba(255,255,255,1)"
            - icon: "mdi:weather-night"
              value: "sleep"
              name: "Sleep"
              color: "#FFF"
              icon_color: "rgba(255,255,255,1)"
              service: input_boolean.turn_on
              service_data:
              entity_id: input_boolean.mode_sleep
            - icon: "mdi:power-sleep"
              value: "goodnight"
              name: "Goodnight"
              color: "#FFF"
              icon_color: "rgba(255,255,255,1)"
              service: input_boolean.turn_on
              service_data:
              entity_id: input_boolean.mode_goodnight

Do I something wrong or is this just not possible? Any help appreciated.

kaosmagix commented 4 years ago

I created a workaround by creating a script to turn the input_boolean on and calling the script in your popup card. This way I do not need to pass the entity_id:

              service: script.set_home_state_sleep
              service_data:

This works. It would be nice if it could be done without this work around by being able to pass an entity_id

kodifan commented 2 years ago

hello kaosmagix

I want to configure this switch popup card depending on the sensor state as in your config: type: custom:switch-popup-card noActiveState: '-' entity_value_path: state

thats mine: type: custom:switch-popup-card noActiveState: '-' entity_value_path: state entities:

and it does not working. in other popup that uses attributes of vacuum entity - everything is ok. could you please tell me maybe what im doing wrong or what is your sensor configured.