thanks for the reply i’ll try this when i’ll link this template to my automation wich i don’t know if its possible to do… its more complex than i thought, i made a automation to let the user enter the hour to turn the system OFF and to turn the system ON again, so far its working
code;
alias: 'Horaire 1 ON '
description: ''
trigger:
- platform: time
at: input_datetime.horaire_on
id: input_datetime.horaire_on
condition: []
action:
- service: switch.turn_on
target:
entity_id:
- switch.eau
- switch.plancher
mode: single
- id: '1641587395939'
alias: Horaire 1 Off
description: ''
trigger:
- platform: time
at: input_datetime.horaire_off
id: input_datetime.horaire_off
condition: []
action:
- service: switch.turn_off
target:
entity_id:
- switch.eau
- switch.plancher
mode: single
- id: '1641587490579'
alias: Horaire 1 ON switch
description: ''
trigger:
- platform: state
entity_id: input_boolean.activation
from: 'off'
to: 'on'
condition: []
action:
- service: automation.turn_on
target:
entity_id:
- automation.horaire_1_on
- automation.horaire_off_1
mode: single
- id: '1641587682135'
alias: Horaire 1 Off switch
description: ''
trigger:
- platform: state
entity_id: input_boolean.activation
from: 'on'
to: 'off'
condition: []
action:
- service: automation.turn_off
target:
entity_id:
- automation.horaire_1_on
- automation.horaire_off_1
mode: single
- id: '1641588836184'
alias: Horaire 2 ON
description: ''
trigger:
- platform: time
at: input_datetime.horaire_2_on
condition: []
action:
- service: switch.turn_on
target:
entity_id:
- switch.eau
- switch.plancher
mode: single
- id: '1641588881434'
alias: Horaire 2 OFF
description: ''
trigger:
- platform: time
at: input_datetime.horaire_2_off
condition: []
action:
- service: switch.turn_off
target:
entity_id:
- switch.eau
- switch.plancher
mode: single
- id: '1641588937454'
alias: Horaire 2 Switch ON
description: ''
trigger:
- platform: state
entity_id: input_boolean.activation_2
from: 'off'
to: 'on'
condition: []
action:
- service: automation.turn_on
target:
entity_id:
- automation.horaire_2_on
- automation.horaire_2_off
mode: single
- id: '1641588990528'
alias: Horaire 2 Switch OFF
description: ''
trigger:
- platform: state
entity_id: input_boolean.activation_2
from: 'on'
to: 'off'
condition: []
action:
- service: automation.turn_off
target:
entity_id:
- automation.horaire_2_on
- automation.horaire_2_off
mode: single
- id: '1641709497154'
so this board:
let the user set the hour to control those switch:
and the objective is to make the template wich is reading the mail with hours data to use this data and change the hour of the first board…
template:
template:
- sensor:
- name: "hour1_OFF"
unit_of_measurement: "h"
state: >
{{ state_attr('sensor.energy_gmail','body')
| regex_findall_index("lieu de: ([0-9]+) h") }}
- name: "hour1_ON"
unit_of_measurement: "h"
state: >
{{ state_attr('sensor.energy_gmail','body')
| regex_findall_index("a ([0-9]+) h") }}
The “mail reader” read the value: 3 h for hour1_OFF and 5 h for hour1_ON and i don’t know what kind of template i could do to make it interact to take this value and set it up in the first board
state:
[sensor.hour1_OFF(Home Assistant)
hour1 3
unit_of_measurement: h friendly_name: hour1off
sensor.hour1_ON
hour2 5 unit_of_measurement: h friendly_name: hour1on
In the developper tool i tried some test but am stoll lost to make the link between the mail data to the board…
{% set time = {
"hour1_ON": 5,
"hour1_OFF": 2,
} %}
this month: : {{ now().month }} , to this day: {{now().day+1}} , the system turn off at {{ time.hour1_OFF }} the system turn on at {{ time.hour1_ON }}
output:
this month: : 1 , to this day: 11 , the system turn off at 2 the system turn on at 5 h
Am really sorry for all those questions… am kinda new to home assistant and am struggling learning template, am really gratefull for the time you are taking!