Activer/Désactiver plusieurs automatisations par un seul bouton

Mon problème

Voici un bouton que j’utilise avec succès pour activer/désactiver une automatisation :

type: custom:button-card
entity: automation.chauffage_soir_on
name: Activation
layout: icon_name_state
state:
  - value: 'on'
    icon: mdi:calendar-clock
  - value: 'off'
    icon: mdi:calendar-clock

Je n’ai pas encore trouvé une façon d’ activer/désactiver 2 automatisations par un seul bouton!

Si tu fais quelque chose comme ça

Entity :

  • automatisation 1
  • automatisation 2
  • automatisation 3

Ça ne fonctionne pas ?

Bonjour,

Le plus simple, c’est de ne pas mettre d’entité et d’appeler un script sur le tap_action qui active ou désactive tes deux automatisations en fonction.

1 « J'aime »

Je ne crois pas. J’ai essayé plusieurs syntaxes qui sont refusées.

Oui mais que mettre dans l’action pour activer/désactiver une automation ?

Que fait (ou font) ton (tes) automatisation(s) ?

Pour te donner un exemple, j’ai une carte pour mon salon qui me permet de « piloter » l’éclairage et les volets par divers boutons (custom_fields). Sur cette carte, j’ai un bouton pour le plafonnier et des boutons pour diverses lampes. J’ai ajouté des boutons pour créer des ambiances particulières et notamment un bouton qui vient éteindre le plafonnier (trois ampoules connectées) et allumer (le cas échéant) deux des trois lampes sur pied en réglant l’intensité à 50% et éteindre la troisième :
image
Code de la carte :

type: custom:button-card
aspect_ratio: 4/3.5
custom_fields:
  fond:
    card:
      type: custom:button-card
      styles:
        card:
          - background-color: rgba(255,255,255,0.0)
          - border: none
      tap_action:
        action: none
      hold_action:
        action: none
  ncarte:
    card:
      type: custom:button-card
      name: Salon
      styles:
        name:
          - font-size: 1.4em
          - font-weight: bold
          - justify-self: start
          - color: rgba(0,0,0,0.6)
        card:
          - background-color: rgba(255,255,255,0.0)
          - border: none
      tap_action:
        action: none
      hold_action:
        action: none
  eclairage:
    card:
      type: custom:button-card
      name: 'Éclairage :'
      styles:
        name:
          - font-size: 1.0em
          - font-weight: bold
          - color: rgba(0,0,0,0.6)
          - justify-self: start
        card:
          - background-color: rgba(255,255,255,0.0)
          - border: none
  nplafonnier:
    card:
      type: custom:button-card
      name: Plafonnier
      styles:
        name:
          - font-size: 0.7em
          - font-weight: bold
          - color: rgba(0,0,0,0.6)
        card:
          - background-color: rgba(255,255,255,0.0)
          - border-radius: 0%
          - border: none
      tap_action:
        action: none
      hold_action:
        action: none
  plafonnier:
    card:
      type: custom:button-card
      size: 80%
      entity: light.salon_plafonnier
      icon: phu:ceiling-fugato-three
      show_name: false
      state:
        - value: 'off'
          styles:
            icon:
              - color: dimgray
            card:
              - box-shadow: none
              - border-radius: 50%
              - background-color: rgba(242,242,242,0.7)
              - width: 48px
              - height: 48px
        - value: 'on'
          styles:
            icon:
              - color: rgb(255,255,128)
            card:
              - border-radius: 50%
              - box-shadow: 0px 0px 6px 3px rgba(255,255,128,0.8)
              - background-color: rgba(0,0,0,0.5)
              - width: 48px
              - height: 48px
  nlampadaire:
    card:
      type: custom:button-card
      name: Lampadaire
      styles:
        name:
          - font-size: 0.7em
          - font-weight: bold
          - color: rgba(0,0,0,0.6)
        card:
          - background-color: rgba(255,255,255,0.0)
          - border-radius: 0%
          - border: none
      tap_action:
        action: none
      hold_action:
        action: none
  lampadaire:
    card:
      type: custom:button-card
      size: 85%
      entity: light.salon_lampadaire_lumiere
      icon: mdi:floor-lamp-torchiere
      show_name: false
      state:
        - value: 'off'
          styles:
            icon:
              - color: dimgray
            card:
              - box-shadow: none
              - border-radius: 50%
              - background-color: rgba(242,242,242,0.7)
              - width: 48px
              - height: 48px
        - value: 'on'
          styles:
            icon:
              - color: rgb(255,255,128)
            card:
              - border-radius: 50%
              - box-shadow: 0px 0px 6px 3px rgba(255,255,128,0.8)
              - background-color: rgba(0,0,0,0.5)
              - width: 48px
              - height: 48px
  nlampe_poele:
    card:
      type: custom:button-card
      name: Lampe<br/>(poële)
      styles:
        name:
          - font-size: 0.7em
          - font-weight: bold
          - color: rgba(0,0,0,0.6)
        card:
          - background-color: rgba(255,255,255,0.0)
          - border-radius: 0%
          - border: none
      tap_action:
        action: none
      hold_action:
        action: none
  lampe_poele:
    card:
      type: custom:button-card
      size: 85%
      entity: light.salon_lampe_poele_lumiere
      icon: mdi:lamp
      show_name: false
      state:
        - value: 'off'
          styles:
            icon:
              - color: dimgray
            card:
              - box-shadow: none
              - border-radius: 50%
              - background-color: rgba(242,242,242,0.7)
              - width: 48px
              - height: 48px
        - value: 'on'
          styles:
            icon:
              - color: rgb(255,255,128)
            card:
              - border-radius: 50%
              - box-shadow: 0px 0px 6px 3px rgba(255,255,128,0.8)
              - background-color: rgba(0,0,0,0.5)
              - width: 48px
              - height: 48px
  nlampe_biblio:
    card:
      type: custom:button-card
      name: Lampe<br/>(bibliothèque)
      styles:
        name:
          - font-size: 0.7em
          - font-weight: bold
          - color: rgba(0,0,0,0.6)
        card:
          - background-color: rgba(255,255,255,0.0)
          - border-radius: 0%
          - border: none
      tap_action:
        action: none
      hold_action:
        action: none
  lampe_biblio:
    card:
      type: custom:button-card
      size: 85%
      entity: light.salon_lampe_bibliotheque_lumiere_2
      icon: mdi:lamp
      show_name: false
      state:
        - value: 'off'
          styles:
            icon:
              - color: dimgray
            card:
              - box-shadow: none
              - border-radius: 50%
              - background-color: rgba(242,242,242,0.7)
              - width: 48px
              - height: 48px
        - value: 'on'
          styles:
            icon:
              - color: rgb(255,255,128)
            card:
              - border-radius: 50%
              - box-shadow: 0px 0px 6px 3px rgba(255,255,128,0.8)
              - background-color: rgba(0,0,0,0.5)
              - width: 48px
              - height: 48px
  temp_value:
    card:
      type: custom:button-card
      entity: sensor.echo_salon_temperature
      show_name: false
      show_icon: false
      show_state: true
      tap_action: none
      styles:
        state:
          - font-size: 0.82em
          - font-weight: bold
          - color: dimgray
          - justify-self: end
          - padding-right: 3%
        card:
          - background-color: rgba(255,255,255,0.5)
  temp:
    card:
      type: custom:button-card
      aspect_ratio: 1/1
      show_name: false
      show_icon: false
      styles:
        card:
          - opacity: 1
          - background-image: url(/local/images/icones/temperature.png)
          - background-size: cover
          - background-position: center
          - background-color: rgba(0,0,0,0.0)
          - border: none
  ambiances:
    card:
      type: custom:button-card
      name: 'Ambiances :'
      styles:
        name:
          - font-size: 1.0em
          - font-weight: bold
          - color: rgba(0,0,0,0.6)
          - justify-self: start
        card:
          - background-color: rgba(255,255,255,0.0)
          - border: none
  ndiner:
    card:
      type: custom:button-card
      name: Dîner<br/>salon
      styles:
        name:
          - font-size: 0.7em
          - font-weight: bold
          - color: rgba(0,0,0,0.6)
        card:
          - background-color: rgba(255,255,255,0.0)
          - border-radius: 0%
          - border: none
      tap_action:
        action: none
      hold_action:
        action: none
  diner:
    card:
      type: custom:button-card
      size: 80%
      icon: mdi:silverware-clean
      show_name: false
      styles:
        icon:
          - color: dimgray
        card:
          - box-shadow: none
          - border-radius: 50%
          - background-color: rgba(242,242,242,0.7)
          - width: 48px
          - height: 48px
      tap_action:
        action: call-service
        service: script.salon_ambiance_diner
  ntv:
    card:
      type: custom:button-card
      name: Regarder la<br/>télévision
      styles:
        name:
          - font-size: 0.7em
          - font-weight: bold
          - color: rgba(0,0,0,0.6)
        card:
          - background-color: rgba(255,255,255,0.0)
          - border-radius: 0%
          - border: none
      tap_action:
        action: none
      hold_action:
        action: none
  tv:
    card:
      type: custom:button-card
      size: 80%
      icon: mdi:television-shimmer
      show_name: false
      styles:
        icon:
          - color: dimgray
        card:
          - box-shadow: none
          - border-radius: 50%
          - background-color: rgba(242,242,242,0.7)
          - width: 48px
          - height: 48px
      tap_action:
        action: call-service
        service: script.salon_ambiance_television
  neteindre:
    card:
      type: custom:button-card
      name: Tout<br/>éteindre
      styles:
        name:
          - font-size: 0.7em
          - font-weight: bold
          - color: rgba(0,0,0,0.6)
        card:
          - background-color: rgba(255,255,255,0.0)
          - border-radius: 0%
          - border: none
      tap_action:
        action: none
      hold_action:
        action: none
  eteindre:
    card:
      type: custom:button-card
      size: 70%
      icon: mdi:lightbulb-group-off
      show_name: false
      styles:
        icon:
          - color: dimgray
        card:
          - box-shadow: none
          - border-radius: 50%
          - background-color: rgba(242,242,242,0.7)
          - width: 48px
          - height: 48px
      tap_action:
        action: call-service
        service: script.salon_eteindre_toutes_les_lumieres
  volet_canape:
    card:
      type: custom:button-card
      name: 'Volet canapé :'
      styles:
        name:
          - font-size: 1.0em
          - font-weight: bold
          - color: rgba(0,0,0,0.6)
          - justify-self: start
        card:
          - background-color: rgba(255,255,255,0.0)
          - border-radius: 0%
          - border: none
      tap_action:
        action: none
      hold_action:
        action: none
  vcup:
    card:
      type: custom:button-card
      show_name: false
      styles:
        card:
          - background-color: rgba(255,255,255,0.0)
          - background-image: url(/local/images/icones/volet_ouvrir.png)
          - background-size: cover
          - height: 48px
          - width: 48px
          - border: none
      tap_action:
        action: call-service
        service: script.salon_volet_canape_ouvrir
  vcstop:
    card:
      type: custom:button-card
      show_name: false
      styles:
        card:
          - background-color: rgba(255,255,255,0.0)
          - background-image: url(/local/images/icones/volet_stopper.png)
          - background-size: cover
          - height: 48px
          - width: 48px
          - border: none
      tap_action:
        action: call-service
        service: script.salon_volet_canape_arreter
  vcdown:
    card:
      type: custom:button-card
      show_name: false
      styles:
        card:
          - background-color: rgba(255,255,255,0.0)
          - background-image: url(/local/images/icones/volet_fermer.png)
          - background-size: cover
          - height: 48px
          - width: 48px
          - border: none
      tap_action:
        action: call-service
        service: script.salon_volet_canape_fermer
  volet_biblio:
    card:
      type: custom:button-card
      name: 'Volet bibliothèque :'
      styles:
        name:
          - font-size: 1.0em
          - font-weight: bold
          - color: rgba(0,0,0,0.6)
          - justify-self: start
        card:
          - background-color: rgba(255,255,255,0.0)
          - border-radius: 0%
          - border: none
      tap_action:
        action: none
      hold_action:
        action: none
  vbup:
    card:
      type: custom:button-card
      show_name: false
      styles:
        card:
          - background-color: rgba(255,255,255,0.0)
          - background-image: url(/local/images/icones/volet_ouvrir.png)
          - background-size: cover
          - height: 48px
          - width: 48px
          - border: none
      tap_action:
        action: call-service
        service: script.salon_volet_bibliotheque_ouvrir
  vbstop:
    card:
      type: custom:button-card
      show_name: false
      styles:
        card:
          - background-color: rgba(255,255,255,0.0)
          - background-image: url(/local/images/icones/volet_stopper.png)
          - background-size: cover
          - height: 48px
          - width: 48px
          - border: none
      tap_action:
        action: call-service
        service: script.salon_volet_bibliotheque_arreter
  vbdown:
    card:
      type: custom:button-card
      show_name: false
      styles:
        card:
          - background-color: rgba(255,255,255,0.0)
          - background-image: url(/local/images/icones/volet_fermer.png)
          - background-size: cover
          - height: 48px
          - width: 48px
          - border: none
      tap_action:
        action: call-service
        service: script.salon_volet_bibliotheque_fermer
styles:
  custom_fields:
    fond:
      - background-image: url(/local/images/salon.png)
      - position: absolute
      - left: 0
      - top: 0
      - width: 100%
      - height: 100%
      - background-size: cover
      - background-position: center
      - opacity: 0.5
    ncarte:
      - position: absolute
      - left: 10px
      - top: '-3px'
    eclairage:
      - position: absolute
      - left: 11%
      - top: 20%
    nplafonnier:
      - position: absolute
      - left: 32%
      - top: 6%
    plafonnier:
      - position: absolute
      - left: 33%
      - top: 17%
    nlampadaire:
      - position: absolute
      - left: 45%
      - top: 11%
    lampadaire:
      - position: absolute
      - left: 47%
      - top: 17%
    nlampe_poele:
      - position: absolute
      - left: 65%
      - top: 6%
    lampe_poele:
      - position: absolute
      - left: 64%
      - top: 17%
    nlampe_biblio:
      - position: absolute
      - left: 78%
      - top: 6%
    lampe_biblio:
      - position: absolute
      - left: 80%
      - top: 17%
    temp_value:
      - width: 19%
      - position: absolute
      - left: 11%
      - top: 35%
    temp:
      - width: 40px
      - height: 40px
      - position: absolute
      - left: 5%
      - top: 32%
    ambiances:
      - position: absolute
      - left: 11%
      - top: 48%
    ndiner:
      - position: absolute
      - left: 43%
      - top: 34%
    diner:
      - position: absolute
      - left: 41%
      - top: 45%
    ntv:
      - position: absolute
      - left: 59%
      - top: 34%
    tv:
      - position: absolute
      - left: 61%
      - top: 45%
    neteindre:
      - position: absolute
      - left: 80%
      - top: 34%
    eteindre:
      - position: absolute
      - left: 79%
      - top: 45%
    volet_canape:
      - position: absolute
      - left: 11%
      - top: 68%
    vcup:
      - position: absolute
      - left: 42%
      - top: 65%
    vcstop:
      - position: absolute
      - left: 57%
      - top: 65%
    vcdown:
      - position: absolute
      - left: 72%
      - top: 65%
    volet_biblio:
      - position: absolute
      - left: 11%
      - top: 85%
    vbup:
      - position: absolute
      - left: 53%
      - top: 82%
    vbstop:
      - position: absolute
      - left: 68%
      - top: 82%
    vbdown:
      - position: absolute
      - left: 83%
      - top: 82%

Le script (ambiance télévision) :

alias: Salon - Ambiance télévision
sequence:
  - type: turn_off
    device_id: 9c6c48da71fafd4bec3f60d54c540f12
    entity_id: 4cdecd8d641d427fb99caa34fdf225d9
    domain: light
  - type: turn_off
    device_id: 7878354036bac5f2522de2e321786934
    entity_id: bd4bedf5045c1da48e2aa7f238487ffc
    domain: light
  - type: turn_off
    device_id: 5d4e61cb81665d40d69092197b27e4b8
    entity_id: 98cd5e4f958ee03e0a995c4820512efc
    domain: light
  - type: turn_on
    device_id: 1fcbb34779f6861a98324f3845b4f1ff
    entity_id: cc5b99d9b702c7c650b9820462e56aeb
    domain: light
    brightness_pct: 50
  - type: turn_on
    device_id: 63e22ccb5cad7bbaa0549445c267f1ff
    entity_id: 59512ac56d7436d8f9e90003ee8ed657
    domain: light
    brightness_pct: 50
  - type: turn_off
    device_id: 1d932f01381fc8c0e6342c46ee145973
    entity_id: ef73a3336e9f9dd7fe9dbed95786c080
    domain: light
mode: single

Salut,
J’ai, pour mon chauffage, plusieurs automatisation.
J’ai un mode OFF pour mon chauffage.
Lorsque j’utilise ce mode OFF, je désactive certaines automatisations.
J’ai établi une scène et il me suffit de la lancer pour mettre les automatisations en question à OFF

scene:  

#############################################################
####  Scene pour passer les automations chauffage à off  ####
#############################################################
  - name: automation_chauff_off
    entities:
      automation.chauffage_presences_family:
        state: 'off'
      automation.reglage_chauffage_pour_nuit:
        state: 'off'
      automation.reglage_chauffage_pour_le_matin:
        state: 'off'
      automation.set_chauff_present_eco:
        state: 'off'
      automation.reglage_chauffage_confort:
        state: 'off'

J’ai une autre scène pour les remettre à ON

#############################################################
####  Scene pour passer les automations chauffage à on   ####
#############################################################

  - name: automation_chauff_on
    entities:
      automation.chauffage_presences_family:
        state: 'on'
      automation.reglage_chauffage_pour_nuit:
        state: 'on'
      automation.reglage_chauffage_pour_le_matin:
        state: 'on'
      automation.set_chauff_present_eco:
        state: 'on'
      automation.reglage_chauffage_confort:
        state: 'on'

Voici un extrait d’une automatisation qui active la scène

...
  action:
  - service: scene.turn_on
    data: {}
    target:
      entity_id: scene.automation_chauff_off
...

Tu as essayé d’utiliser le service « Automatisation: Basculer » ?

service: automation.toggle
target:
  entity_id:
    - automation.1
    - automation.2

Oui, c’est une bonne solution. Dans mon cas ça donne ça :

type: custom:button-card
name: Activation
layout: icon_name_state
icon: mdi:calendar-clock
tap_action:
  action: call-service
  service: automation.toggle
  target:
    entity_id:
      - automation.chauffage_soir_on
      - automation.chauffage_soir_off

Mets la solution sur le post d’ @Idaho947 et pas sur ta réponse, ça sera mieux…