denysdovhan / vacuum-card

Vacuum cleaner card for Home Assistant Lovelace UI
https://denysdovhan.com/smart-home
MIT License
923 stars 530 forks source link

Clarify shortcut usage in readme.md #745

Open elronzo opened 5 months ago

elronzo commented 5 months ago

One does not necessarily need a script. A direct service call is possible:


shortcuts:
  - name: kitchen
    service: mqtt.publish
    service_data:
      topic: valetudo/JustForDemonstration/MapSegmentationCapability/clean/set
      payload: '{"segment_ids": ["2"], "iterations": 1, "customOrder": true}'
svenove commented 5 months ago

I struggle a bit with getting this to work.

shortcuts:
  - name: Stue
    icon: mdi:sofa
    service: xiaomi_miio.vacuum_clean_segment
    service_data:
      target:
        device_id: 553a536e86e5b116d6d6f
      data:
        segments: 20

When clicking the icon, I get: Failed to call service xiaomi_miio/vacuum_clean_segment. extra keys not allowed @ data['target']

Any idea?

elronzo commented 5 months ago

'data:' before 'segements:' is superfluous.

svenove commented 5 months ago

'data:' before 'segements:' is superfluous.

Tried removing it, but it still throws the same error. I’ve tried all kinds of variants and believe I’m really close, but can’t seem to get it just right…

service_data:
  target:
    device_id: 553a536e86e5b116d6d6f
    segments: 20

And


service_data:
  target:
    device_id: 553a536e86e5b116d6d6f
  segments: 20
elronzo commented 5 months ago

Your config needs to either look exactly as provided here: https://github.com/denysdovhan/vacuum-card/ (= You need to create a script in HA that makes the MQTT call) or use my variant (= do mqtt.publish directly). But not a mix of both.

svenove commented 5 months ago

I’m not trying to do a mqtt.publish, but to call a different service (“service: xiaomi_miio.vacuum_clean_segment”).

Since the mqtt.push-service can be called directly, I expect all kinds of service calls can be called directly?

elronzo commented 5 months ago

Valetudo uses MQTT. So you'll definitely need the MQTT part somewhere.

svenove commented 5 months ago

Valetudo uses MQTT. So you'll definitely need the MQTT part somewhere.

I don’t use Valetudo, I use the Xiaomi Miio integration.

The same code works fine when used in an automation. It’s when copying it from an automation and to the shortcut-section of this cards it fails.

github-actions[bot] commented 3 months ago

There hasn't been any activity on this issue recently. This issue has now been marked as stale and will be closed if no further activity occurs. Please, update to the latest version and check if that solves the issue. Thank you for your contributions!

temtekmedia commented 2 months ago

I'm a first timer too and I have NO idea how to setup the scripts.. Its on the card like "script.clean_living_room" but I have no idea where do i define what cleaning area, where do i write the script and how.. Readme just says "You can defined custom scripts for custom actions i.e cleaning specific room" which doesnt help me at all. Neither does the HA official document. Complete noob here

github-actions[bot] commented 3 weeks ago

There hasn't been any activity on this issue recently. This issue has now been marked as stale and will be closed if no further activity occurs. Please, update to the latest version and check if that solves the issue. Thank you for your contributions!