swiss-army-knife-card icon indicating copy to clipboard operation
swiss-army-knife-card copied to clipboard

Can't use notify service because of entity_id being added

Open Khaos66 opened this issue 2 months ago • 2 comments

Bug report notice

Before you file a bug, make sure that you did not make a configuration mistake. The Swiss Army Knife in its current state does not yet have full configuration sanity checks!

So make sure your problem is not related to that!

  • [x] Yes, I'm sure that it is not a configuration mistake

Swiss Army Knife version

The version you are using. See HACS or the Browser console 2.5.1

Bug description

call-service action will always add entity_id to service_data which is not allowed when notify.* services are called.

Failed to call service notify/mobile_app_oneplus_open. extra keys not allowed @ data['entity_id']

To Reproduce

Steps to reproduce the behavior:

  1. You need a notify service, so connect the Android companion app. This adds notify.mobile_app_* as a service.
  2. Add a tool with the user_actions below
  3. Click on the tool in a dashboard
user_actions:
  tap_action:
    haptic: success
    actions:
      - action: call-service
        service: "notify.mobile_app_*"
        service_data:
          message: message
          data:
            title: "Test"

Expected behavior

Instead of a message on the Android phone an HA error message is shown in the dashboard

Screenshots

None

Desktop browser (please complete the following information):

  • Microsoft Edge | 124.0.2478.80 (Offizielles Build) (64-Bit)
  • Revision | b05b378d17057fdf79080fa82d92e1370adf2627
  • Chromium-Version | 124.0.6367.118
  • Betriebssystem | Windows 11 Version 23H2 (Build 22631.3527)
  • JavaScript | V8 12.4.22.11

Companion App on Smartphone/Tablet (please complete the following information):

  • Device: OnePlus Open
  • OS: Android
  • Browser: stock browser
  • Version: 14

Additional context https://github.com/AmoebeLabs/swiss-army-knife-card/blob/b19d4d8d353aba86f88ab2efd05e7f11bf7d0b64/src/base-tool.js#L586

(Optional): Suggested Solution

I need a switch to deaktivate the addition of missing entity_id. Maybe likte this

user_actions:
  tap_action:
    haptic: success
    actions:
      - action: call-service
        service: "notify.mobile_app_*"
        no_entity_id: true
        service_data:
          message: message
          data:
            title: "Test"

Khaos66 avatar May 11 '24 18:05 Khaos66