voici un exemple concret d’un package que j’utilise, et qui fonctionne:
tiko:
climate:
- platform: generic_thermostat
name: Bureau 1
heater: switch.radiateurs_on_off
target_sensor: sensor.bureau_1_temperature
- platform: generic_thermostat
name: Entrée
heater: switch.radiateurs_on_off
target_sensor: sensor.entree_temperature
- platform: generic_thermostat
name: Bureau 2
heater: switch.radiateurs_on_off
target_sensor: sensor.bureau_2_temperature
shell_command:
bureau_1_set_temp: '/usr/bin/curl -X POST https://mondomaine.com/tiko.php?hash=montoken&room_id=room1&temperature={{ state_attr("climate.bureau_1", "temperature") }}'
entree_set_temp: '/usr/bin/curl -X POST https://mondomaine.com/tiko.php?hash=montoken&room_id=room2&temperature={{ state_attr("climate.entree", "temperature") }}'
bureau_2_set_temp: '/usr/bin/curl -X POST https://mondomaine.com/tiko.php?hash=montoken&room_id=room3&temperature={{ state_attr("climate.bureau_2", "temperature") }}'
automation:
- id: sync_status_on_bureau_1
alias: sync_status_on_bureau_1
description: >
on H.A startup or heater status change,
check if heater is currently on to
update the climate object in HA
trigger:
- platform: homeassistant
event: start
- platform: state
entity_id: binary_sensor.bureau_1_chauffage
condition:
- condition: state
entity_id: binary_sensor.bureau_1_chauffage
state: 'on'
action:
- service: climate.turn_on
target:
entity_id: climate.bureau_1
mode: single
- id: sync_status_off_bureau_1
alias: sync_status_off_bureau_1
description: >
on H.A startup or heater status change,
check if heater is currently off to
update the climate object in HA
trigger:
- platform: homeassistant
event: start
- platform: state
entity_id: binary_sensor.bureau_1_chauffage
condition:
- condition: state
entity_id: binary_sensor.bureau_1_chauffage
state: 'off'
action:
- service: climate.turn_off
target:
entity_id: climate.bureau_1
mode: single
- id: sync_temp_bureau_1
alias: sync_temp_bureau_1
description: >
on H.A startup or temp change, update
the climate object in HA
trigger:
- platform: homeassistant
event: start
- platform: state
entity_id: sensor.bureau_1_temperature_target
condition: [ ]
action:
- service: climate.set_temperature
target:
entity_id: climate.bureau_1
data:
temperature: "{{ states('sensor.bureau_1_temperature_target') }}"
mode: single
- id: set_temp_bureau_1
alias: set_temp_bureau_1
description: >
on climate update, send update command
to endpoint
trigger:
- platform: state
entity_id:
- climate.bureau_1
attribute: temperature
condition:
- condition: and
conditions:
- condition: state
entity_id: switch.radiateurs_off
state: 'off'
- condition: state
entity_id: switch.radiateurs_hors_gel
state: 'off'
- condition: state
entity_id: switch.radiateurs_absence
state: 'off'
action:
- service: shell_command.bureau_1_set_temp
mode: single
- id: sync_status_on_entree
alias: sync_status_on_entree
description: >
on H.A startup or heater status change,
check if heater is currently on to
update the climate object in HA
trigger:
- platform: homeassistant
event: start
- platform: state
entity_id: binary_sensor.entree_chauffage
condition:
- condition: state
entity_id: binary_sensor.entree_chauffage
state: 'on'
action:
- service: climate.turn_on
target:
entity_id: climate.entree
mode: single
- id: sync_status_off_entree
alias: sync_status_off_entree
description: >
on H.A startup or heater status change,
check if heater is currently off to
update the climate object in HA
trigger:
- platform: homeassistant
event: start
- platform: state
entity_id: binary_sensor.entree_chauffage
condition:
- condition: state
entity_id: binary_sensor.entree_chauffage
state: 'off'
action:
- service: climate.turn_off
target:
entity_id: climate.entree
mode: single
- id: sync_temp_entree
alias: sync_temp_entree
description: >
on H.A startup or temp change, update
the climate object in HA
trigger:
- platform: homeassistant
event: start
- platform: state
entity_id: sensor.entree_temperature_target
condition: [ ]
action:
- service: climate.set_temperature
target:
entity_id: climate.entree
data:
temperature: "{{ states('sensor.entree_temperature_target') }}"
mode: single
- id: set_temp_entree
alias: set_temp_entree
description: >
on climate update, send update command
to endpoint
trigger:
- platform: state
entity_id:
- climate.entree
attribute: temperature
condition:
- condition: and
conditions:
- condition: state
entity_id: switch.radiateurs_off
state: 'off'
- condition: state
entity_id: switch.radiateurs_hors_gel
state: 'off'
- condition: state
entity_id: switch.radiateurs_absence
state: 'off'
action:
- service: shell_command.entree_set_temp
mode: single
- id: sync_status_on_bureau_2
alias: sync_status_on_bureau_2
description: >
on H.A startup or heater status change,
check if heater is currently on to
update the climate object in HA
trigger:
- platform: homeassistant
event: start
- platform: state
entity_id: binary_sensor.bureau_2_chauffage
condition:
- condition: state
entity_id: binary_sensor.bureau_2_chauffage
state: 'on'
action:
- service: climate.turn_on
target:
entity_id: climate.bureau_2
mode: single
- id: sync_status_off_bureau_2
alias: sync_status_off_bureau_2
description: >
on H.A startup or heater status change,
check if heater is currently off to
update the climate object in HA
trigger:
- platform: homeassistant
event: start
- platform: state
entity_id: binary_sensor.bureau_2_chauffage
condition:
- condition: state
entity_id: binary_sensor.bureau_2_chauffage
state: 'off'
action:
- service: climate.turn_off
target:
entity_id: climate.bureau_2
mode: single
- id: sync_temp_bureau_2
alias: sync_temp_bureau_2
description: >
on H.A startup or temp change, update
the climate object in HA
trigger:
- platform: homeassistant
event: start
- platform: state
entity_id: sensor.bureau_2_temperature_target
condition: [ ]
action:
- service: climate.set_temperature
target:
entity_id: climate.bureau_2
data:
temperature: "{{ states('sensor.bureau_2_temperature_target') }}"
mode: single
- id: set_temp_bureau_2
alias: set_temp_bureau_2
description: >
on climate update, send update command
to endpoint
trigger:
- platform: state
entity_id:
- climate.bureau_2
attribute: temperature
condition:
- condition: and
conditions:
- condition: state
entity_id: switch.radiateurs_off
state: 'off'
- condition: state
entity_id: switch.radiateurs_hors_gel
state: 'off'
- condition: state
entity_id: switch.radiateurs_absence
state: 'off'
action:
- service: shell_command.bureau_2_set_temp
mode: single
sensor:
- platform: template
sensors:
bureau_1_temperature:
friendly_name: Bureau 1 temperature
value_template: "{{ state_attr('sensor.tiko_settings','bureau_1_cur')}}"
unit_of_measurement: °C
device_class: temperature
- platform: template
sensors:
bureau_1_humidity:
friendly_name: Bureau 1 humidité
value_template: "{{ state_attr('sensor.tiko_settings','bureau_1_dry')}}"
unit_of_measurement: '%'
device_class: humidity
- platform: template
sensors:
bureau_1_temperature_target:
friendly_name: Bureau 1 temperature target
value_template: "{{ state_attr('sensor.tiko_settings','bureau_1_tar')}}"
unit_of_measurement: °C
device_class: temperature
- platform: template
sensors:
entree_temperature:
friendly_name: Entrée temperature
value_template: "{{ state_attr('sensor.tiko_settings','entree_cur')}}"
unit_of_measurement: °C
device_class: temperature
- platform: template
sensors:
entree_humidity:
friendly_name: Entrée humidité
value_template: "{{ state_attr('sensor.tiko_settings','entree_dry')}}"
unit_of_measurement: '%'
device_class: humidity
- platform: template
sensors:
entree_temperature_target:
friendly_name: Entrée temperature target
value_template: "{{ state_attr('sensor.tiko_settings','entree_tar')}}"
unit_of_measurement: °C
device_class: temperature
- platform: template
sensors:
bureau_2_temperature:
friendly_name: Bureau 2 temperature
value_template: "{{ state_attr('sensor.tiko_settings','bureau_2_cur')}}"
unit_of_measurement: °C
device_class: temperature
- platform: template
sensors:
bureau_2_humidity:
friendly_name: Bureau 2 humidité
value_template: "{{ state_attr('sensor.tiko_settings','bureau_2_dry')}}"
unit_of_measurement: '%'
device_class: humidity
- platform: template
sensors:
bureau_2_temperature_target:
friendly_name: Bureau 2 temperature target
value_template: "{{ state_attr('sensor.tiko_settings','bureau_2_tar')}}"
unit_of_measurement: °C
device_class: temperature
- platform: template
sensors:
tiko_consumption_vs_lastmonth:
friendly_name: Écart conso. vs mois dernier
value_template: "{{ (((state_attr('sensor.tiko_consumption', 'this_month_total_wh') - state_attr('sensor.tiko_consumption', 'last_month_total_same_day_wh')) / state_attr('sensor.tiko_consumption', 'last_month_total_same_day_wh')) * 100)|round(0) }}"
unit_of_measurement: '%'
- platform: template
sensors:
tiko_consumption_vs_yesterday:
friendly_name: Écart conso. vs hier
value_template: "{{ (((state_attr('sensor.tiko_consumption', 'today_total_wh') - state_attr('sensor.tiko_consumption', 'yesterday_total_same_time_wh')) / state_attr('sensor.tiko_consumption', 'yesterday_total_same_time_wh')) * 100)|round(0) }}"
unit_of_measurement: '%'
binary_sensor:
- platform: template
sensors:
bureau_1_chauffage:
friendly_name: Bureau 1 chauffage
value_template: "{{ is_state_attr('sensor.tiko_settings','bureau_1_on', true)}}"
device_class: heat
- platform: template
sensors:
entree_chauffage:
friendly_name: Entrée chauffage
value_template: "{{ is_state_attr('sensor.tiko_settings','entree_on', true)}}"
device_class: heat
- platform: template
sensors:
bureau_2_chauffage:
friendly_name: Bureau 2 chauffage
value_template: "{{ is_state_attr('sensor.tiko_settings','bureau_2_on', true)}}"
device_class: heat
command_line:
- sensor:
name: Tiko_consumption
json_attributes:
- today_total_wh
- yesterday_total_same_time_wh
- yesterday_total_same_time_wh
- last_month_total_wh
- this_month_total_wh
- last_month_total_same_day_wh
command: "curl -s 'https://mondomaine.com/tiko.php?hash=montoken&consumption=true'"
unit_of_measurement: W
scan_interval: 3600
value_template: 1
- sensor:
name: Tiko_settings
json_attributes:
- boost
- frost
- absence
- disableHeating
- bureau_1_cur
- bureau_1_tar
- bureau_1_dry
- bureau_1_on
- entree_cur
- entree_tar
- entree_dry
- entree_on
- bureau_2_cur
- bureau_2_tar
- bureau_2_dry
- bureau_2_on
command: "curl -s 'https://mondomaine.com/tiko.php?hash=montoken'"
scan_interval: 60
value_template: 1
- switch:
name: Radiateurs on/off
command_on: "curl -g 'https://mondomaine.com/tiko.php?hash=montoken&mode=0'"
command_off: "curl -g 'https://mondomaine.com/tiko.php?hash=montoken&mode=disableHeating'"
command_state: "curl -g 'https://mondomaine.com/tiko.php?hash=montoken'"
value_template: '{{value_json["disableHeating"]}}'
icon: '{% if (value_json.disableHeating) %} mdi:radiator-off {% else %} mdi:radiator-off {% endif %}'
- switch:
name: Radiateurs off
command_on: "curl -g 'https://mondomaine.com/tiko.php?hash=montoken&mode=disableHeating'"
command_off: "curl -g 'https://mondomaine.com/tiko.php?hash=montoken&mode=0'"
command_state: "curl -g 'https://mondomaine.com/tiko.php?hash=montoken'"
value_template: '{{value_json["disableHeating"]}}'
icon: '{% if (value_json.disableHeating) %} mdi:radiator-off {% else %} mdi:radiator-off {% endif %}'
- switch:
name: Radiateurs boost
command_on: "curl -g 'https://mondomaine.com/tiko.php?hash=montoken&mode=boost'"
command_off: "curl -g 'https://mondomaine.com/tiko.php?hash=montoken&mode=0'"
command_state: "curl -g 'https://mondomaine.com/tiko.php?hash=montoken'"
value_template: '{{value_json["boost"]}}'
icon: '{% if (value_json.boost) %} mdi:sun-thermometer {% else %} mdi:lightning-bolt-outline {% endif %}'
- switch:
name: Radiateurs absence
command_on: "curl -g 'https://mondomaine.com/tiko.php?hash=montoken&mode=absence'"
command_off: "curl -g 'https://mondomaine.com/tiko.php?hash=montoken&mode=0'"
command_state: "curl -g 'https://mondomaine.com/tiko.php?hash=montoken'"
value_template: '{{value_json["absence"]}}'
icon: '{% if (value_json.absence) %} mdi:door-closed-lock {% else %} mdi:door {% endif %}'
- switch:
name: Radiateurs hors gel
command_on: "curl -g 'https://mondomaine.com/tiko.php?hash=montoken&mode=frost'"
command_off: "curl -g 'https://mondomaine.com/tiko.php?hash=montoken&mode=0'"
command_state: "curl -g 'https://mondomaine.com/tiko.php?hash=montoken'"
value_template: '{{value_json["frost"]}}'
icon: '{% if (value_json.frost) %} mdi:snowflake-thermometer {% else %} mdi:snowflake-thermometer {% endif %}'
@Abel dans ton cas, tu veux charger des sensor input_number, depuis un package qui s’appelle input_number si j’ai bien compris. tu devrais donc avoir dans ton package test :
input_number: (le nom du package)
input_number:
test_position:
name: "Test - Position désirée"
min: -1
max: 100
step: 1
unit_of_measurement: "%"```
le but du package est plus de permettre de regrouper tout ce qui est lié à un périphérique ou une fonction dans un même package (exemple, des scripts, sensor, automation, etc… tous liés. Comme dans mon exemple lié aux fonctionnalités de gestion des mes radiateurs).
celà me semble avoir moins d’intérêt si un package est uniquement lié à un type d’objet H.A (comme ton exemple avec un package input_number qui ne charge que des input_number), pour cet usage, les includes semblent une meilleure solution.