bernikr / lovelace-notify-card

Send notifications directly from the dashboard
MIT License
45 stars 16 forks source link

`data` parameter is not at the right level #5

Closed Aohzan closed 3 years ago

Aohzan commented 3 years ago

Hello,

When I add data parameters for the service like this :

type: custom:notify-card
...
data:
  volume_level: 0.3
  title: Announce

it will send to a sub data key to the service.

You have to merge the msg with the data to provide only one data dict:

var service_data = Object.assign({}, this.config.data, { message: msg });
this.hass.callService(domain, target, service_data);
bernikr commented 3 years ago

As specified in the service documentation additional data for notification services is sent in dict named data inside of the main data dict.

You can check this integration example on how the payload should usually look.

Example:

automation:
  - alias: "Front door motion"
    trigger:
      platform: state
      entity_id: binary_sensor.front_door_motion
      to: "on"
    action:
      service: notify.livingroom_tv
      data:
        message: "Movement detected: Front Door"
        data:
          icon: "/home/homeassistant/images/doorbell.png"