Bonjour tout le monde,
Débutant dans HA, j’ai essayé de comprendre et de m’aider d’IA pour définir la position de mes volets roulants, mais j’ai encore pas mal de mal…
Mon objectif est de connaitre le positionnement des volets en fonction de leur pourcentage d’ouverture dans home assistant. Les volets sont commandés avec des interrupteurs wifi loratap qui de base fonctionnent uniquement avec une durée pour chaque volet (sans position).
Voici un numéro device_id et l’ID pour le Volet SAM :
- ec3338296741a02c10f3a7ed6867694c => cover.fenetre_sam_rideau=>17 sec
J’ai donc éditer avec chatgpt le code suivant :
configuration.yaml:
cover:
- platform: template
covers:
sam_rideau:
friendly_name: "Volet SAM"
unique_id: "sam_rideau_cover_001"
position_template: "{{ states('input_number.sam_rideau_position') | int }}"
open_cover:
service: script.open_sam_rideau
close_cover:
service: script.close_sam_rideau
stop_cover:
service: script.stop_sam_rideau
set_cover_position:
service: script.set_position_sam_rideau
data:
position: "{{ position }}"
input_number:
sam_rideau_position:
name: "Position volet SAM"
initial: 0
min: 0
max: 100
step: 1
Script :
open_sam_rideau:
alias: "Ouvrir le volet SAM"
sequence:
- service: cover.open_cover
target:
entity_id: cover.fenetre_sam_rideau
close_sam_rideau:
alias: "Fermer le volet SAM"
sequence:
- service: cover.close_cover
target:
entity_id: cover.fenetre_sam_rideau
stop_sam_rideau:
alias: "Arrêter le volet SAM"
sequence:
- service: cover.stop_cover
target:
entity_id: cover.fenetre_sam_rideau
set_position_sam_rideau:
alias: "Définir la position du volet SAM"
sequence:
- service: input_number.set_value
data:
entity_id: input_number.sam_rideau_position
value: "{{ position | float }}"
Automations:
- alias: "Mise à jour position volet SAM"
trigger:
- platform: state
entity_id: cover.fenetre_sam_rideau
to: 'closing'
- platform: state
entity_id: cover.fenetre_sam_rideau
to: 'opening'
action:
- delay: "{{ (17 * (states('input_number.sam_rideau_position') | int) / 100) | int }}"
- service: input_number.set_value
target:
entity_id: input_number.sam_rideau_position
data:
value: >
{% if trigger.to_state.state == 'opening' %}
{{ (17 - (as_timestamp(now()) - as_timestamp(trigger.from_state.last_changed))) / 17 * 100 | int }}
{% else %}
{{ (as_timestamp(now()) - as_timestamp(trigger.from_state.last_changed)) / 17 * 100 | int }}
{% endif %}
Configuration Lovelace mise à jour pour le volet SAM
`type: entities
entities:
- entity: cover.fenetre_sam_rideau
- entity: input_number.sam_rideau_position`
Le script n’est pas trouvé.
Est ce que l’un d’entre vous à une idée ?
Merci bien
Ma configuration
[center]## System Information
version | core-2024.8.1 |
---|---|
installation_type | Home Assistant OS |
dev | false |
hassio | true |
docker | true |
user | root |
virtualenv | false |
python_version | 3.12.4 |
os_name | Linux |
os_version | 6.6.44-haos |
arch | aarch64 |
timezone | Europe/Paris |
config_dir | /config |
Home Assistant Community Store
GitHub API | ok |
---|---|
GitHub Content | ok |
GitHub Web | ok |
GitHub API Calls Remaining | 5000 |
Installed Version | 1.34.0 |
Stage | running |
Available Repositories | 1390 |
Downloaded Repositories | 5 |
HACS Data | ok |
Home Assistant Cloud
logged_in | false |
---|---|
can_reach_cert_server | ok |
can_reach_cloud_auth | ok |
can_reach_cloud | ok |
Home Assistant Supervisor
host_os | Home Assistant OS 13.0 |
---|---|
update_channel | stable |
supervisor_version | supervisor-2024.08.0 |
agent_version | 1.6.0 |
docker_version | 26.1.4 |
disk_total | 28.0 GB |
disk_used | 5.8 GB |
healthy | true |
supported | true |
host_connectivity | true |
supervisor_connectivity | true |
ntp_synchronized | true |
virtualization | |
board | green |
supervisor_api | ok |
version_api | ok |
installed_addons | File editor (5.8.0), Terminal & SSH (9.14.0), Duck DNS (1.18.0), Let’s Encrypt (5.1.0), Cloudflared (5.1.17), Linky (1.5.0) |
Dashboards
dashboards | 3 |
---|---|
resources | 2 |
views | 6 |
mode | storage |
Recorder
oldest_recorder_run | 14 août 2024 à 19:36 |
---|---|
current_recorder_run | 15 août 2024 à 14:03 |
estimated_db_size | 28.91 MiB |
database_engine | sqlite |
database_version | 3.45.3 |