#Want to send push messages from devices with device name

1 messages Β· Page 1 of 1 (latest)

hallow flame
#

HI.
Im pretty new πŸ™‚
Im trying top make a automation that if my 2 ikea water sensor get wet they will sent me a push message. But i dont want to make a automation for both sensors πŸ™‚
Can i somehow put the "device name" in the message that it is wet? Hope it makes sense πŸ˜‰

finite fern
#

You'll need to use a template. Something like {{ state_attr(trigger.to_state.entity_id, 'friendly_name') }} in the message.

hallow flame
#

Hi πŸ™‚
Something like

#

Damn im not good at this πŸ˜„
alias: Test vand sensor
description: ""
triggers:

  • type: moist
    device_id: dd852ab5c133e7e96d45165afedfc079
    entity_id: 753dbcc6f6f36e2498edf7fe6dd642cc
    domain: binary_sensor
    trigger: device
  • type: moist
    device_id: aada74b15891636ecd27c7cb0d1d8674
    entity_id: dff7d5ed298a9cece61a670521c7405c
    domain: binary_sensor
    trigger: device
    conditions: []
    actions:
  • action: notify.send_message
    title: "{{ state_attr(trigger.event.data.entity_id, 'friendly_name') }}"
    metadata: {}
    data: {}
    mode: single
    That dosent work
#

Hmm either this
actions:

  • action: notify.send_message
    metadata: {}
    data:
    message: title: "{{ state_attr(trigger.event.data.entity_id, 'friendly_name') }}"
    mode: single
finite fern
#

Ah, you're using device triggers. If you use entity triggers then putting the template in the message should work.

hallow flame
#

Hmm i get
string value is None for dictionary value @ data['message']
With
``alias: Test vand
description: ""
triggers:

  • type: moist
    device_id: aada74b15891636ecd27c7cb0d1d8674
    entity_id: dff7d5ed298a9cece61a670521c7405c
    domain: binary_sensor
    trigger: device
    conditions: []
    actions:
  • action: notify.mobile_app_daniels_s24
    metadata: {}
    data:
    message: null
    mode: single
    ``
#

huh? I removed my {{ state_attr(trigger.to_state.entity_id, 'friendly_name') }} in the message ?

jade crestBOT
#

To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

hallow flame
#

{{ state_attr(trigger.to_state.entity_id, 'friendly_name') }}

finite fern
#

You need to use three of them around the big blocks πŸ˜‰

hallow flame
#

Ahhh ddd

#

Okay the "message" should that contain " {{ state_attr(trigger.to_state.entity_id, 'friendly_name') }}" ? πŸ™‚

finite fern
#

Yes, but you're still using a device trigger, not an entity trigger πŸ™‚

hallow flame
#

Not sure what the diffrence is? It seems pretty complex to use a entity?

finite fern
#

Entities are actually much simpler. For example, I have a Netatmo climate sensor next to me. It's one device, but it has a temperature sensor, humidity sensor, CO2 sensor, and even a volume sensor. Each of those sensors are 1 entity.

hallow flame
#

Okay πŸ™‚ But i cant find "is wet" now?

#

Sorry for the danish langugage πŸ˜‰

#

Ouh sorry have to go to bed 😁

hallow flame
#

Any good ideas to get this to sende a message? πŸ™‚