Take output from sensor and put him in automation

Hi
how i take the output from : sensor.jewish_calendar_upcoming_shabbat_candle_lighting
its look like this :
image

I won’t take the state and put them in “%s” action data massage how I do it?

- id: '1544583463071'       
  alias: shabbat_candle
  trigger:
  - at: 11:00:00
    platform: time
  condition:       
     condition: time
     weekday: 
       - fri 
  action:
  - data:
      message: 'Candle Lighting Times %s '
    service: notify.mobile_app_mi9

“{{ ‘Candle Lighting Time’ ~ states(‘your sensor goes here’) }}”

i try it . its dosent work

- id: '1544583463071'       
  alias: shabbat_candle
  trigger:
  - at: 11:00:00
    platform: time
  condition:       
     condition: time
     weekday: 
       - fri 
  action:
  - data:
    message: "{{ 'Candle Lighting Time' ~ states('sensor.jewish_calendar_upcoming_shabbat_candle_lighting') }}"    
    service: notify.mobile_app_mi9

get this error cofigueration :

Invalid config for [automation]: Invalid time specified: 39600 for dictionary value @ data['trigger'][0]['at']. Got None
expected dict for dictionary value @ data['action'][0]['data']. Got None
extra keys not allowed @ data['action'][0]['message']. Got None. (See /config/configuration.yaml, line 90). Please check the docs at https://home-assistant.io/integrations/automatio

Sorry, you need data_template: rather than data:

This will put the whole of the value in the message, so you may need to use a custom format to get it as you require.

Edit: you can also use the template editor under development tools to test any templates (quicker than saving and reloading each time)

Ok
How it’s will look?

As shown in your image, under state:
You should not post images (too large) post code where you can using </> button

sensor.jewish_calendar_upcoming_candle_lighting
state 2019-11-15 14:24:00+00:00

timestamp: 1573827840
friendly_name: Jewish Calendar Upcoming Candle Lighting
icon: 'mdi:candle'
device_class: timestamp

you can show me please ? i am not success

- id: '1544583463071'       
  alias: shabbat_candle
  trigger:
  - at: 11:00:00
    platform: time
  condition:       
     condition: time
     weekday: 
       - fri 
  action:
  - data_template:
      message: "Candle Lighting Time {{ states('sensor.jewish_calendar_upcoming_shabbat_candle_lighting') }}"    
    service: notify.mobile_app_mi9

Thank you to the response.
I do copy paste
And still get configuration error :expressionless:

Invalid config for [automation]: Invalid time specified: 39600 for dictionary value @ data['trigger'][0]['at']. Got None. (See /config/configuration.yaml, line 90). Please check the docs at https://home-assistant.io/integrations/automation/

put the trigger ‘at’ time in quotes.

1 Like

The second condition spacing looks off, should be an even number, HST it does ‘look’ valid yaml.
Petro, it’s AE so quotes not always shown but what is in the file is another matter.

1 Like

Thanks its work :grinning: