-
You’re using a Device Trigger which doesn’t support templates for any of its options (neither does a Device Condition or a Device Action).
-
Even if you were to use a Numeric State Trigger, which does support templates, it doesn’t support templates for its below
option.
What a Numeric State Trigger does support for its below
option is a direct reference to a sensor
entity. Therefore I suggest you create a Template Sensor and then reference it in a Numeric State Trigger.
Example: Template Sensor
template:
- sensor:
- name: Battery Threshold
state: "{{ [100,100,80,80,60,40,0,0,10,60,100,100][now().month - 1] }}"
Example: Numeric State Trigger
trigger:
- platform: numeric_state
entity_id: sensor.givtcp_ce2142g314_soc
below: sensor.battery_threshold
for:
minutes: 15
NOTE
The Battery Threshold sensor only needs to update its template at the start of every day. The example posted above will update the template every minute which is far more than necessary. The following is an example of Trigger-based Template Sensor and will update just once a day and can be used instead of the Template Sensor example.
Example: Trigger-based Template Sensor
template:
- trigger:
- platform: time
at: '00:00:01'
sensor:
- name: Battery Threshold
state: "{{ [100,100,80,80,60,40,0,0,10,60,100,100][now().month - 1] }}"