Hello
I need a help to create a not distrub sensor. I want a sensor to become on between let’s say midnight and 6 in the morning
Anyone who can help?
Hello
I need a help to create a not distrub sensor. I want a sensor to become on between let’s say midnight and 6 in the morning
Anyone who can help?
template:
- binary_sensor:
- name: "Do Not Disturb"
icon: "mdi:volume-off"
state: "{{ now().hour < 6 }}"
This goes in your configuration.yaml file, not your sensors.yaml file.
Thanks a lot mate. It is working. And if I want to make it from 23.30 until 6 in the morning
state: "{{ (now() - timedelta(minutes=30)).hour >= 23 or now().hour < 6 }}"
Hi Tom, pls explain… why not there or e.g. in template.yaml ?
Because it is not a sensor platform. It is a template integration.
If you have includes set up to use the template integration feel free to put it there, but the template integation uses a mix of lists and dictionaries so it is not straight forward, like includes for automations or sensors.
thanks for the info !