Malgré l’aide, je n’arrive pas à faire des boutons switch pour passer d’un mode chauffage à un mode off et d’un mode confort à un mode eco et vice versa.
J’ai donc fait des boutons « button.press »
En mode arrêt et eco :
En mode chauffage et confort :
Il ne me reste plus qu’à faire varier le couleur lorsque le mode est activé pour plus de lisibilité.
Je mets le code si ca interresse du coup :
Fichier button.yaml :
############################################################
## MQTT BSB lan bouton ##
############################################################
# Mode Off
- unique_id: "PAC mode off"
name: "PAC mode off"
command_topic: "BSB-LAN"
payload_press: "S700=0"
availability:
- topic: "BSB-LAN/status"
qos: 0
retain: false
entity_category: "config"
# Mode Chauffage
- unique_id: "PAC mode Chauffage"
name: "PAC mode Chauffage"
command_topic: "BSB-LAN"
payload_press: "S700=3"
availability:
- topic: "BSB-LAN/status"
qos: 0
retain: false
entity_category: "config"
# Mode CONFORT
- unique_id: "PAC mode Confort"
name: "PAC mode Confort"
command_topic: "BSB-LAN"
payload_press: "S710=21.5"
availability:
- topic: "BSB-LAN/status"
qos: 0
retain: false
entity_category: "config"
# Mode ECO
- unique_id: "PAC mode ECO"
name: "PAC mode ECO"
command_topic: "BSB-LAN"
payload_press: "S710=18.0"
availability:
- topic: "BSB-LAN/status"
qos: 0
retain: false
entity_category: "config"
Fichier openhasp.yaml :
# Page 3: Thermostat
- obj: "p3b20" # arc slider
properties:
"val": "{{ state_attr('climate.pompe_a_chaleur','temperature') * 10 | int if not (is_state('climate.pompe_a_chaleur','unavailable')) }}"
"min": "{{ state_attr('climate.pompe_a_chaleur','min_temp') * 10 | int if not (is_state('climate.pompe_a_chaleur','unavailable')) }}"
"max": "{{ state_attr('climate.pompe_a_chaleur','max_temp') * 10 | int if not (is_state('climate.pompe_a_chaleur','unavailable')) }}"
"line_color1": >
{% if is_state('climate.pompe_a_chaleur', 'cool') %}
{{ "#346beb" }}
{%-elif is_state('climate.pompe_a_chaleur', 'heat_cool') %}
{{ "#34bdeb" }}
{%-elif is_state('climate.pompe_a_chaleur', 'heat') %}
{{ "#eb3434" }}
{%-elif is_state('climate.pompe_a_chaleur', 'dry') %}
{{ "#ebeb34" }}
{%-else %}
{{ "#9f96b0" }}
{% endif %}
event:
"changed":
- service: climate.set_temperature
target:
entity_id: climate.pompe_a_chaleur
data:
temperature: "{{ val | int / 10 }}"
"up":
- service: climate.set_temperature
target:
entity_id: climate.pompe_a_chaleur
data:
temperature: "{{ val | int / 10 }}"
- obj: "p3b21" # gauge current temp
properties:
"val": "{{ state_attr('climate.pompe_a_chaleur','temperature') * 10 | int if not (is_state('climate.pompe_a_chaleur','unavailable')) }}"
"min": "{{ state_attr('climate.pompe_a_chaleur','min_temp') * 10 | int if not (is_state('climate.pompe_a_chaleur','unavailable')) }}"
"max": "{{ state_attr('climate.pompe_a_chaleur','max_temp') * 10 | int if not (is_state('climate.pompe_a_chaleur','unavailable')) }}"
"critical_value": "{{ (state_attr('climate.pompe_a_chaleur','max_temp') * 10 | int + 1) if not (is_state('climate.pompe_a_chaleur','unavailable')) }}"
"label_count": "{{ (state_attr('climate.pompe_a_chaleur','max_temp') | int - state_attr('climate.pompe_a_chaleur','min_temp') | int + 1) if not (is_state('climate.pompe_a_chaleur','unavailable')) }}"
"line_count": "{{ ((state_attr('climate.pompe_a_chaleur','max_temp') | int - state_attr('climate.pompe_a_chaleur','min_temp') | int) * 2 + 1) if not (is_state('climate.pompe_a_chaleur','unavailable')) }}"
- obj: "p3b23" # label current temp (and +/- with short/long touch)
properties:
"text": >
{% if (is_state('sensor.netatmo_interieur_temperature','unavailable') or is_state('sensor.netatmo_interieur_temperature','unknown')) %}
{{ "--.-" }}
{%-else %}
{{ states('sensor.netatmo_interieur_temperature') | round(1,default=0) }}
{%- endif %}
"click": "{{ 'false' if (is_state('climate.pompe_a_chaleur','unavailable') or is_state('climate.pompe_a_chaleur','unknown')) else 'true' }}"
"opacity": "{{ 60 if (is_state('climate.pompe_a_chaleur','unavailable') or is_state('climate.pompe_a_chaleur','unknown')) else 255 }}"
event:
"up":
- service: climate.set_temperature
target:
entity_id: climate.pompe_a_chaleur
data:
temperature: "{{ state_attr('climate.pompe_a_chaleur','temperature') + state_attr('climate.pompe_a_chaleur','target_temp_step') | float(default=1)}}"
"long":
- service: climate.set_temperature
target:
entity_id: climate.pompe_a_chaleur
data:
temperature: "{{ state_attr('climate.pompe_a_chaleur','temperature') - state_attr('climate.pompe_a_chaleur','target_temp_step') | float(default=1)}}"
- obj: "p3b25" # label target temp
properties:
"text": "{{ state_attr('climate.pompe_a_chaleur','temperature') if not (is_state('climate.pompe_a_chaleur','unavailable')) }}"
# Informations thermostat
- obj: "p3b29" # Etat chauffage
properties:
"text": '{{ states("sensor.temperature_status_2") }}'
- obj: "p3b31" # Etat Confort/Eco
properties:
"text": '{{ states("sensor.temperature_status") }}'
# Boutton chauffage
- obj: "p3b2" # Boutton chauffage on
properties:
"val": '{{ 1 if is_state("switch.pac_on_off", "on") else 0 }}'
"text": '{{ "\uE438" if is_state("sensor.temperature_status_2", "Chauffage") else "\uEAD7" | e }}'
event:
"down":
- service: button.press
target:
entity_id: button.pac_mode_chauffage
data: {}
- obj: "p3b3" # Boutton off
properties:
"text": '{{ "\uE238" if is_state("sensor.temperature_status", "Arrêté") else "\uE425" | e }}'
event:
"down":
- service: button.press
target:
entity_id: button.pac_mode_off
data: {}
- obj: "p3b4" # Boutton Confort
event:
"down":
- service: button.press
target:
entity_id: button.pac_mode_confort
data: {}
- obj: "p3b5" # Boutton Eco
event:
"down":
- service: button.press
target:
entity_id: button.pac_mode_eco
data: {}
Fichier pages.jsonl
{"comment":"---------- Page 3 ----Thermostat ----------"}
{"page":3,"id":10,"obj":"obj","x":5,"y":35,"w":380,"h":420,"click":0,"border_side":0,"bg_color":"#000000"}
{"page":3,"id":20,"obj":"arc","x":5,"y":37,"w":380,"h":400,"min":170,"max":300,"val":250,"border_side":0,"type":0,"rotation":0,"start_angle":135,"end_angle":45,"adjustable":"true","line_width":21,"line_width1":21,"line_color1":"#34bdeb","bg_opa":0,"pad_top2":5,"pad_bottom2":5,"pad_left2":5,"pad_right2":5,"pad_top":5,"pad_bottom":5,"pad_left":5,"pad_right":5}
{"page":3,"id":21,"obj":"gauge","x":28,"y":28,"w":325,"h":345,"parentid":20,"min":170,"max":300,"val":224,"format":1,"critical_value":301,"label_count":14,"line_count":27,"border_width":0,"pad_top":2,"pad_bottom":2,"pad_left":2,"pad_right":2,"value_str":"°C","value_ofs_y":55,"value_font":28,"bg_opa":0,"line_width2":3,"line_rounded2":1,"line_color":"#348feb","line_color1":"#348feb","scale_grad_color":"#eb4934","scale_grad_color1":"#eb4934","scale_end_color1":"#eb4934"}
{"comment":"---temperature actuelle centrale---"}
{"page":3,"id":22,"obj":"obj","x":160,"y":160,"w":70,"h":70,"parentid":20,"click":0,"radius":30,"border_width":2,"border_opa":200}
{"page":3,"id":23,"obj":"label","x":160,"y":180,"w":70,"h":30,"parentid":20,"text":"22.4","text_font":28,"align":"center"}
{"comment":"---temperature consigne---"}
{"page":3,"id":25,"obj":"label","x":210,"y":360,"w":60,"h":50,"text":"25","text_font":26,"align":"center"}
{"page":3,"id":27,"obj":"label","x":90,"y":360,"w":150,"h":50,"text":"Consigne :", "text_font": 26}
{"page":3,"id":28,"obj":"label","x":270,"y":360,"w":40,"h":50,"text":"°C", "text_font": 26}
{"comment":"---Etat allumé-off---"}
{"page":3,"id":29,"obj":"label","x":60,"y":400,"w":150,"h":50,"text":"25","text_font":28,"align":1}
{"page":3,"id":30,"obj":"label","x":10,"y":400,"w":100,"h":50,"text":"Etat :", "text_font": 24}
{"comment":"---Etat Confort-Eco---"}
{"page":3,"id":31,"obj":"label","x":260,"y":400,"w":150,"h":50,"text":"25","text_font":28,"align":1}
{"page":3,"id":32,"obj":"label","x":220,"y":400,"w":100,"h":50,"text":"Mode :", "text_font": 24}
{"comment":"---Boutton---"}
{"page":3,"id":2,"obj":"btn","x":390,"y":35,"w":80,"h":95,"toggle":false,"text":"\uE335","text_font":32,"align":1,"bg_color":"#000000","border_side":1}
{"page":3,"id":3,"obj":"btn","x":390,"y":135,"w":80,"h":95,"toggle":false,"text":"\uE5A8","text_font":32,"align":1,"bg_color":"#000000","border_side":1}
{"page":3,"id":4,"obj":"btn","x":390,"y":235,"w":80,"h":95,"toggle":false,"text":"Conf","align":"center","bg_color":"#000000","border_side":1}
{"page":3,"id":5,"obj":"btn","x":390,"y":335,"w":80,"h":95,"toggle":false,"text":"Eco","mode":"break","align":"center","bg_color":"#000000","border_side":1}
Je ferais évoluer si on trouve une solution de switch à la place des button.press.
Merci pour l’aide en tout cas.