Note de ce sujet :
  • Moyenne : 5 (1 vote(s))
  • 1
  • 2
  • 3
  • 4
  • 5
[TUTO] KNX --> Home Assistant via Node-Red
#2
Tuto 2
 
Objectif général : après le premier tuto relatif au passage d’informations de KNX vers HA via Node-Red, voici un exemple de passage d’informations de HA vers KNX via Node-Red.
 
Objectif du tuto : changer le mode de chauffage de tous les thermostats de la maison :
  • soit directement par sélection depuis le Dashboard HA ;
  • soit par une programmation calendaire effectuée depuis le Dashboard HA.
 
A noter que HA et Node Red ne font qu’écrire les données dans des GA (dates, heures, etc.) et que c’est le contrôleur logique ABB ABA/S 1.2.1 qui traite les données ; en cas de plantage de HA/Node Red ou du NUC, le changement de mode sera tout de même effectué par KNX en utilisant les dernières dates et heures saisies.

1) HA
- Dashboard
Avant d’insérer la carte ci-dessous dans le Dashboard, il faut auparavant créer depuis HA/Paramètres/Appareils et services/Entrées, les entrées :
  • Liste déroulante (une pour le mode Direct et une pour le mode PROG)
  • Entrée booléenne (Autorisation programmation Dates/Heures)
  • Date début période
  • Date fin de période
  • Heure ON
  • Heure OFF
    [Image: p8g2.jpg]


- Automations
Il faut créer une première automation liée à la liste déroulante « Sélection mode de chauffage (Direct) » puis une seconde liée à « Sélection mode de chauffage (PROG) ».
[Image: v66b.jpg]
automations.yaml
Code :
- id: '1671667431895'
 alias: Mode chauffage
 description: ''
 trigger:
 - platform: state
   entity_id:
   - input_select.choix_mode_chauffage
 action:
 - choose:
   - conditions:
     - condition: state
       entity_id: input_select.choix_mode_chauffage
       state: Confort
     sequence:
     - service: input_number.set_value
       target:
         entity_id: input_number.mode_chauffage
       data:
         value: 1
   - conditions:
     - condition: state
       entity_id: input_select.choix_mode_chauffage
       state: Absent
     sequence:
     - service: input_number.set_value
       target:
         entity_id: input_number.mode_chauffage
       data:
         value: 2
   - conditions:
     - condition: state
       entity_id: input_select.choix_mode_chauffage
       state: Nuit
     sequence:
     - service: input_number.set_value
       target:
         entity_id: input_number.mode_chauffage
       data:
         value: 3
   - conditions:
     - condition: state
       entity_id: input_select.choix_mode_chauffage
       state: Hors-gel
     sequence:
     - service: input_number.set_value
       target:
         entity_id: input_number.mode_chauffage
       data:
         value: 4
- Procéder de façon similaire pour créer l’automation « Sélection mode de chauffage (PROG) »

2) Définir les GA dans ETS
[Image: x6cm.jpg]

3) Node -Red

[Image: ajal.jpg]
Pour insérer le flux dans Node Red

-  Copier le code ci-dessous
Code :
[{"id":"ac078a80b3e083a0","type":"tab","label":"Chauffage","disabled":false,"info":"","env":[]},{"id":"1af2d64ac81f8162","type":"server-state-changed","z":"ac078a80b3e083a0","name":"","server":"f462add6.8e0bc","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_number.mode_chauffage","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":400,"y":220,"wires":[["77eb487c5f7d5f7b"]]},{"id":"ddeb2d00c531fad5","type":"knxUltimate","z":"ac078a80b3e083a0","server":"e91643e.d9013c","topic":"4/2/20","outputtopic":"","dpt":"5.100","initialread":0,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"4/2/20 Mode chauffage PROG","outputtype":"write","outputRBE":true,"inputRBE":false,"formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","x":840,"y":280,"wires":[[]]},{"id":"519882efaba0d0ec","type":"server-state-changed","z":"ac078a80b3e083a0","name":"Mode Chauffage Validation ","server":"c45201c8a1aa256f","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.validation_prog_chauffage","entityidfiltertype":"exact","outputinitially":false,"state_type":"habool","haltifstate":"unavailable","halt_if_type":"str","halt_if_compare":"is_not","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":270,"y":100,"wires":[["e195ad2ce92cf84b"],[]]},{"id":"e195ad2ce92cf84b","type":"knxUltimate","z":"ac078a80b3e083a0","server":"e91643e.d9013c","topic":"4/2/21","outputtopic":"","dpt":"1.002","initialread":false,"notifyreadrequest":true,"notifyresponse":false,"notifywrite":false,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"4/2/21 ABA/S 1.2.1","outputtype":"write","outputRBE":false,"inputRBE":false,"formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","x":610,"y":100,"wires":[[]]},{"id":"1efdb8a5f3d22764","type":"knxUltimate","z":"ac078a80b3e083a0","server":"e91643e.d9013c","topic":"4/2/24","outputtopic":"","dpt":"10.001","initialread":false,"notifyreadrequest":true,"notifyresponse":false,"notifywrite":false,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"4/2/24 ABA/S 1.2.1","outputtype":"write","outputRBE":false,"inputRBE":false,"formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","x":530,"y":460,"wires":[[]]},{"id":"aa552cbf98e7a0ba","type":"server-state-changed","z":"ac078a80b3e083a0","name":"Mode chauffage Heure OFF","server":"c45201c8a1aa256f","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_datetime.heure_fin_mode_chauffage","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"unavailable","halt_if_type":"str","halt_if_compare":"is_not","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":240,"y":520,"wires":[["7c3ae40ee9516463"],[]]},{"id":"7c3ae40ee9516463","type":"knxUltimate","z":"ac078a80b3e083a0","server":"e91643e.d9013c","topic":"4/2/25","outputtopic":"","dpt":"10.001","initialread":false,"notifyreadrequest":true,"notifyresponse":false,"notifywrite":false,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"4/2/25 ABA/S 1.2.1","outputtype":"write","outputRBE":false,"inputRBE":false,"formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","x":530,"y":520,"wires":[[]]},{"id":"aec122b1446fea59","type":"server-state-changed","z":"ac078a80b3e083a0","name":"Mode chauffage - Heure ON","server":"c45201c8a1aa256f","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_datetime.heure_debut_mode_chauffage","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"unavailable","halt_if_type":"str","halt_if_compare":"is_not","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":240,"y":460,"wires":[["1efdb8a5f3d22764"],[]]},{"id":"724ded923c2930db","type":"knxUltimate","z":"ac078a80b3e083a0","server":"e91643e.d9013c","topic":"4/2/22","outputtopic":"","dpt":"11.001","initialread":false,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"4/2/22 ABA/1.2.1","outputtype":"write","outputRBE":false,"inputRBE":false,"formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","x":530,"y":340,"wires":[[]]},{"id":"c6c8dea083966592","type":"server-state-changed","z":"ac078a80b3e083a0","name":"Mode chauffage - Date ON","server":"c45201c8a1aa256f","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_datetime.date_debut_mode_chauffage","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"unavailable","halt_if_type":"str","halt_if_compare":"is_not","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":210,"y":340,"wires":[["724ded923c2930db"],[]]},{"id":"20180881365c7a90","type":"knxUltimate","z":"ac078a80b3e083a0","server":"e91643e.d9013c","topic":"4/2/23","outputtopic":"","dpt":"11.001","initialread":false,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"4/2/23 ABA/1.2.1","outputtype":"write","outputRBE":false,"inputRBE":false,"formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","x":510,"y":400,"wires":[[]]},{"id":"b82a95a670a21aec","type":"server-state-changed","z":"ac078a80b3e083a0","name":"Mode chauffage- Date OFF","server":"c45201c8a1aa256f","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_datetime.date_fin_mode_chauffage","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"unavailable","halt_if_type":"str","halt_if_compare":"is_not","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":210,"y":400,"wires":[["20180881365c7a90"],[]]},{"id":"244b79147c454205","type":"server-state-changed","z":"ac078a80b3e083a0","name":"","server":"f462add6.8e0bc","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_number.mode_chauffage_prog","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":410,"y":280,"wires":[["ddeb2d00c531fad5"]]},{"id":"77eb487c5f7d5f7b","type":"knxUltimate","z":"ac078a80b3e083a0","server":"e91643e.d9013c","topic":"4/2/19","outputtopic":"","dpt":"5.100","initialread":0,"notifyreadrequest":false,"notifyresponse":false,"notifywrite":true,"notifyreadrequestalsorespondtobus":false,"notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized":"0","listenallga":false,"name":"4/2/19 Mode chauffage DIRECT","outputtype":"write","outputRBE":true,"inputRBE":false,"formatmultiplyvalue":1,"formatnegativevalue":"leave","formatdecimalsvalue":999,"passthrough":"no","x":850,"y":220,"wires":[[]]},{"id":"f462add6.8e0bc","type":"server","name":"Home Assistant","addon":true},{"id":"e91643e.d9013c","type":"knxUltimate-config","host":"192.168.1.100","port":"3671","physAddr":"15.15.22","hostProtocol":"TunnelUDP","suppressACKRequest":false,"csv":"","KNXEthInterface":"Auto","KNXEthInterfaceManuallyInput":"","statusDisplayLastUpdate":true,"statusDisplayDeviceNameWhenALL":true,"statusDisplayDataPoint":false,"stopETSImportIfNoDatapoint":"skip","loglevel":"error","name":"Passerelle IP-KNX","localEchoInTunneling":true,"delaybetweentelegrams":"40","delaybetweentelegramsfurtherdelayREAD":"1","ignoreTelegramsWithRepeatedFlag":false},{"id":"c45201c8a1aa256f","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]
- Node Red/menu/Import
- Coller le code dans la zone rose et sélectionner "new flow" puis import et Import copy
- Effectuer les modifications pour l'adapter à votre configuration
- Cliquer sur "Deploy"

4) ABA/1.2.1
[Image: m92i.jpg]

[Image: 65bg.jpg]

Calendar_S jour et Nuit : télécharger le bloc fonction ici
Répondre


Messages dans ce sujet
RE: [TUTO] KNX --> Home Assistant via Node-Red - par Ives - 15/01/2023, 18:16:40

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)