This is probably a stupid question and or was aswered a thousand times by now but I just can’t find it and I kind of reached my end of the line…
I have a custom sensor, that I connected to a custom button, for different displays based on the sensors state. So far so good thats runnung fine…
If I want to tap the button I want to see the state of the sensor. (would love to have here a better few but for now more-info works just fine) Thats also working!
But when I try to set the hold_action (by button “1 direkt”) I recive this error message: “Error at calling a service input_datetime/set_datetime. Could not parse date for dictionary value @ data[‘date’]”. So I was like: Fine I put it in an automation so I can trigger it from there and the automation in of itself runs like a treat if I trigger it but when I try to trigger it over the cutom button card this error emerges: “Error at calling a service automation/trigger. must contain at least one of entity_id, device_id, area_id.” I just can’f figure it out and need help!
I attached my button yaml code. I’m only keeping one of the buttons and I would prefere it to be the “1 direkt” one but at this point I think I settle for anything.
square: true
type: grid
columns: 3
cards:
- type: custom:button-card
entity: sensor.chore_vacuumcomputer_office
icon: mdi:desktop-tower
name: 1 direkt
aspect_ratio: '1'
size: 70%
tap_action:
action: more-info
hold_action:
action: call-service
service: input_datetime.set_datetime
target:
entity_id: input_datetime.chore_vacuumcomputer_office
service_data:
date: >-
{% set old_date = now().replace(year =
state_attr('input_datetime.chore_vacuumcomputer_office', 'year'),
month = state_attr('input_datetime.chore_vacuumcomputer_office',
'month'), day =
state_attr('input_datetime.chore_vacuumcomputer_office', 'day')) %} {%
set pos_new_date = now().replace(year = now().year + 1) %} {% set
weekday_index = old_date.weekday() - pos_new_date.weekday()%}
{% if weekday_index > -1 and weekday_index < 3%}
{{pos_new_date.replace(day = now().day - (pos_new_date.weekday() + 2)).strftime('%Y-%m-%d')}}
{% else %}
{{pos_new_date.replace(day = now().day + weekday_index).strftime('%Y-%m-%d')}}
{% endif %}
show_state: false
styles:
card:
- filter: opacity(30%)
- font-size: 12px
- font-weight: bold
- '--mdc-ripple-color': white
- '--mdc-ripple-press-opacity': 0.5
icon:
- color: green
state:
- value: due
styles:
card:
- filter: opacity(100%)
icon:
- color: red
- value: overdue
styles:
card:
- background-color: red
- filter: opacity(100%)
- animation: blink 2s ease infinite
icon:
- color: white
- type: custom:button-card
entity: sensor.chore_vacuumcomputer_office
icon: mdi:desktop-tower
name: 2 automation
aspect_ratio: '1'
size: 70%
tap_action:
action: more-info
hold_action:
action: call-service
service: automation.trigger
target:
entity_id: automation.chore_vacuumcomputer_office
service_data:
skip_condition: true
show_state: false
styles:
card:
- filter: opacity(30%)
- font-size: 12px
- font-weight: bold
- '--mdc-ripple-color': white
- '--mdc-ripple-press-opacity': 0.5
icon:
- color: green
state:
- value: due
styles:
card:
- filter: opacity(100%)
icon:
- color: red
- value: overdue
styles:
card:
- background-color: red
- filter: opacity(100%)
- animation: blink 2s ease infinite
icon:
- color: white
Thanks for your help in advance