Hypfer / lovelace-valetudo-map-card

Display the map from a valetudo-enabled robot in a home assistant dashboard card.
MIT License
243 stars 36 forks source link

custom_buttons not working, missing 'data' #97

Closed bruvv closed 3 years ago

bruvv commented 3 years ago

When adding a custom button as follows:

type: custom:valetudo-map-card
entity: camera.map_data
vacuum_entity: vacuum.valetudo
custom_buttons:
  - service: mqtt.publish
  - service_data:
      topic: /valetudo/robot/GoToLocationCapability/go/set
      payload: ae0ccd4b-b077-4a94-8c54-511441da18aa

I get the error: Failed to call service mqtt/publish. required key not provided @ data['topic'] I also tried data instead of service_data am I doing something wrong? Also it doesn't matter what kind of icon I use it will always use: mdi:radiobox-blank

TheLastProject commented 3 years ago

You have a - in your yaml too much, so you're creating 2 different list entries.

List entry one:

service: mqtt.publish

List entry two:

service_data:
  topic: /valetudo/robot/GoToLocationCapability/go/set
  payload: ae0ccd4b-b077-4a94-8c54-511441da18aa

Remove the second -, so, use this as your YAML:

type: custom:valetudo-map-card
entity: camera.map_data
vacuum_entity: vacuum.valetudo
custom_buttons:
  - service: mqtt.publish
    service_data:
     topic: /valetudo/robot/GoToLocationCapability/go/set
     payload: ae0ccd4b-b077-4a94-8c54-511441da18aa
bruvv commented 3 years ago

Oops that's true. Thanks ! But the icon is still an issue.

TheLastProject commented 3 years ago

Works fine for me:

custom_buttons:
  - service: mqtt.publish
    icon: mdi:home
    service_data:
      topic: /valetudo/robot/GoToLocationCapability/go/set
      payload: ae0ccd4b-b077-4a94-8c54-511441da18aa
eratnik commented 2 years ago

I would like to create custom card which will choose power level of my vacuum. It is real? This code don't work:

custom_buttons:
  - service: vacuum.set_fan_speed
    icon: mdi:fan-speed-1
    service_data:
      fan_speed: "{{ state_attr('vacuum.valetudo_slipperyprestigiouskudu', 'fan_speed_list') }}"
TheLastProject commented 2 years ago

You're probably best of waiting for or helping with #108.

bertoldini commented 2 years ago

I would like to create custom card which will choose power level of my vacuum. It is real? This code don't work:

custom_buttons:
  - service: vacuum.set_fan_speed
    icon: mdi:fan-speed-1
    service_data:
      fan_speed: "{{ state_attr('vacuum.valetudo_slipperyprestigiouskudu', 'fan_speed_list') }}"

would be great if you tag me if you got a solution for that. struggling with the same issue