{"id":4917,"date":"2023-09-01T19:51:17","date_gmt":"2023-09-01T17:51:17","guid":{"rendered":"https:\/\/www.sigalou-domotique.fr\/?p=4917"},"modified":"2026-01-02T17:01:02","modified_gmt":"2026-01-02T15:01:02","slug":"je-pilote-les-relais-du-fil-pilote-de-mon-chauffage-avec-des-input_select-de-home-assistant","status":"publish","type":"post","link":"https:\/\/www.sigalou-domotique.fr\/en\/je-pilote-les-relais-du-fil-pilote-de-mon-chauffage-avec-des-input_select-de-home-assistant","title":{"rendered":"I control the relays of the pilot wire of my heating with input_select from Home Assistant"},"content":{"rendered":"<p>&nbsp;<\/p>\r\n<p><span style=\"color: initial; font-size: revert;\">As I explained in:<\/span><\/p>\r\n<ul>\r\n<li><a href=\"https:\/\/www.sigalou-domotique.fr\/en\/commander-chauffage-fil-pilote-avec-sonoff-4ch-pro-r2-multi-zones\/\" target=\"_blank\" rel=\"noopener\">Order your heating with a Sonoff 4CH Pro R2 in multi-zones<\/a><\/li>\r\n<\/ul>\r\n<p>I control my heating on two zones thanks to pilot wires. As part of the switch from Jeedom to Home Assistant, I have to manage these relays with Home Assistant.<\/p>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2018\/03\/filpiloteprincipe.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-40\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2018\/03\/filpiloteprincipe.jpg\" alt=\"filpiloteprincipe\" width=\"294\" height=\"248\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2018\/03\/filpiloteprincipe.jpg 597w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2018\/03\/filpiloteprincipe-300x253.jpg 300w\" sizes=\"auto, (max-width: 294px) 100vw, 294px\" \/><\/a><!--more--><\/p>\r\n<p>For now, the Sonoff 4CH Pro is driven by ESP Easy, I will soon switch it to ESP Home, but for now ESP Easy allows you to interface with Jeedom ET Home Assistant via MQTT.<\/p>\r\n<p>For the configuration, I refer to this Retex:<\/p>\r\n<ul>\r\n<li><a href=\"https:\/\/www.sigalou-domotique.fr\/en\/migration-jeedom-vers-home-assistant-le-lien-des-esp-sous-esp-easy-vers-ha\/\" target=\"_blank\" rel=\"noopener\">Jeedom migration to Home Assistant, ESP link under ESP-Easy to HA<\/a><\/li>\r\n<\/ul>\r\n<h3>I drive relays via MQTT<\/h3>\r\n<p>As explained in the <a href=\"https:\/\/www.sigalou-domotique.fr\/en\/migration-jeedom-vers-home-assistant-le-lien-des-esp-sous-esp-easy-vers-ha\/\" target=\"_blank\" rel=\"noopener\">Retex above<\/a>, it is necessary to configure the entities that will allow to recover the relays in Home Assistant, this is done in the file mqtt.yaml<\/p>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">- name: \"Relay 1 Heating\" unique _id: switch.heating.relais1 command_topic: \"Heating\/gpio\/12\" state_topic: \"Heating\/Relay1\/Relay1\" payload_on: \"1\" payload _off: \"0\" retains: true device_class: outlet device: name: \"Heating\" identifiers: \"heating\" - name: \"Relay 2 Heating\" unique _id: switch.heating.relais2 command_topic: \"Heating\/gpio\/5\" state_topic: \"Heating\/Relay2\/Relay2\" payload_on: \"1\" payload _off: \"0\" retains: true device_class: outlet device: name: \"Heating\" identifiers: \"heating\" - name: \"Relay 3 Heating\" unique _id: switch.heating.relais3 command_topic: \"Heating\/gpio\/4\" state_topic: \"Heating\/Relay3\/Relay3\" payload_on: \"1\" payload _off: \"0\" retains: true device_class: outlet device: name: \"Heating\" identifiers: \"heating\" - name: \"Relay 4 Heating\" unique _id: switch.heating.relais4 command_topic: \"Heating\/gpio\/15\" state_topic: \"Heating\/Relay4\/Relay4\" payload_on: \"1\" payload _off: \"0\" retains: true device_class: outlet device: name: \"Heating\" identifiers: \"heating\" \r\n<\/pre>\r\n<p>In HA, these 4 entities are easily recovered\u00a0<\/p>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/chauffage1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4924\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/chauffage1.png\" alt=\"\" width=\"508\" height=\"231\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/chauffage1.png 508w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/chauffage1-300x136.png 300w\" sizes=\"auto, (max-width: 508px) 100vw, 508px\" \/><\/a><\/p>\r\n<h3>I create _select input<\/h3>\r\n<p>It is in the configuration.yaml file that I declare the two entities of the zones by allowing them to have 4 possible states.<\/p>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">input_select: heating_etage_mode: name: Heating Zone Floor - Mode options: - \"Comfort\" - \"Eco\" - \"Out of Gel\" - \"Off\" icon: mdi:help-circle-outline heating _rdc _mode: name: Heating Zone Ground floor - Mode options: - \"Comfort\" - \"Eco\" - \"Out of Gel\" - \"Off\" icon: mdi:help-circle-outline<\/pre>\r\n<p>This adds the two entities:<\/p>\r\n<ul>\r\n<li>input_select.heating_rdc_mode<\/li>\r\n<li>input_select.heating_etage_mode<\/li>\r\n<\/ul>\r\n<h3>I customize input_select<\/h3>\r\n<p>I always try to make visually pleasing the tiles of the dasboard, for this, to put color and put beautiful icons that correspond to the states seems indispensable.<\/p>\r\n<p>Customization is achieved by adding these lines in customize.yaml<\/p>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">input_select.heating_etage_mode: templates: icon: &gt; if (state == 'Comfort') return 'mdi:fire'; if (state == 'Eco') return 'mdi:leaf'; if (state == 'Hors Gel') return 'mdi:snowflake-thermometer'; if (state == 'Off') return 'mdi:power'; return 'mdi:help-circle-outline'; icon_color: &gt; if (state == 'Comfort') return 'yellow'; if (state == 'Eco') return 'green'; if (state == 'Outside Gel') return '#2196f3'; if (state == 'Off') return 'red'; input_select.heating_rdc_mode: templates: icon: &gt; if (state == 'Comfort') return 'mdi:fire'; if (state == 'Eco') return 'mdi:leaf'; if (state == 'Hors Gel') return 'mdi:snowflake-thermometer'; if (state == 'Off') return 'mdi:power'; return 'mdi:help-circle-outline'; icon_color: &gt; if (state == 'Comfort') return 'yellow'; if (state == 'Eco') return 'green'; if (state == 'Outside Gel') return '#2196f3'; if (state == 'Off') return 'red';    <\/pre>\r\n<h3>I drive relays from input_select<\/h3>\r\n<p>The correspondence between the Zones (Etage and Ground Floor) must be done in Home Assistant, the choice of relays to control the zone mode must be transparent for the user.<\/p>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/chauffage2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4927\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/chauffage2.png\" alt=\"\" width=\"728\" height=\"281\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/chauffage2.png 728w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/chauffage2-600x232.png 600w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/chauffage2-300x116.png 300w\" sizes=\"auto, (max-width: 728px) 100vw, 728px\" \/><\/a><\/p>\r\n<p>For this, an automation will be triggered by a change of state of input_select.heating_rdc_mode and another by input_select.heating_etage_mode.<\/p>\r\n<p>This automation will change the status of the relays in order to send the order that corresponds to the coding of the pilot wire. This is explained <a href=\"https:\/\/www.sigalou-domotique.fr\/en\/commander-chauffage-fil-pilote-avec-sonoff-4ch-pro-r2-multi-zones\/#scenarii\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\r\n<h4>Automation Pilotage Heating Ground Floor<\/h4>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">alias: Pilotage Heating Ground Floor description: \"\" trigger: - platform: state entity _id: - input_select.heating_rdc_mode condition: [] action: - if: - condition: state entity _id: input_select.heating_rdc_mode state: Comfort then: - service: switch.turn _off data: {} entity _id: - switch.heating_relais_3_heating - switch.heating_relais_4_heating - stop: \"\" - if: - condition: state entity _id: input_select.heating_rdc_mode state: Eco then: - service: switch.turn_on data: {} entity _id: - switch.heating_relais_3_heating - switch.heating_relais_4_heating - stop: \"\" - if: - condition: state entity _id: input_select.heating_rdc_mode state: Excluding Gel then: - service: switch.turn _off data: {} entity _id: - switch.heating_relais_4_heating - service: switch.turn_on data: {} entity _id: - switch.heating_relais_3_heating - stop: \"\" - if: - condition: state entity _id: input_select.heating_rdc_mode state: \"Off\" then: - service: switch.turn _off data: {} entity _id: - switch.heating_relais_3_heating - service: switch.turn_on data: {} entity _id: - switch.heating_relais_4_heating - stop: \"\" mode: single\r\n<\/pre>\r\n<h4>Automation Pilotage Heating Floor<\/h4>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">alias: Pilotage Heating Floor description: \"\" trigger: - platform: state entity _id: - input_select.heating_etage_mode condition: [] action: - if: - condition: state entity _id: input_select.heating_etage _mode state: Comfort then: - service: switch.turn _off data: {} entity _id: - switch.heating_relais_2_heating - switch.heating_relais_1_heating - stop: \"\" - if: - condition: state entity _id: input_select.heating_etage _mode state: Eco then: - service: switch.turn_on data: {} entity _id: - switch.heating_relais_2_heating - switch.heating_relais_1_heating - stop: \"\" - if: - condition: state entity _id: input_select.heating_etage _mode state: Excluding Gel then: - service: switch.turn _off data: {} entity _id: - switch.heating_relais_2_heating - service: switch.turn_on data: {} entity _id: - switch.heating_relais_1_heating - stop: \"\" - if: - condition: state entity _id: input_select.heating_etage _mode state: \"Off\" then: - service: switch.turn _off data: {} entity _id: - switch.heating_relais_1_heating - service: switch.turn_on data: {} entity _id: - switch.heating_relais_2_heating - stop: \"\" mode: single<\/pre>\r\n<h3>I make a nice map for the dashboard<\/h3>\r\n<p>Here is the result of what I want as a card:<\/p>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/chauffage3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4930\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/chauffage3.png\" alt=\"\" width=\"506\" height=\"270\" srcset=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/chauffage3.png 506w, https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/chauffage3-300x160.png 300w\" sizes=\"auto, (max-width: 506px) 100vw, 506px\" \/><\/a><\/p>\r\n<p>At this point, I don't know if I'll keep the drop-down list or the buttons\/selectors, both work.<\/p>\r\n<h4>Map code for the ground floor area\u00a0<\/h4>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">Type: custom:stack-in-card mode: vertical cards: - type: custom:auto-entities show _empty: false card: Type: custom:mushroom-chips-card view_layout: grid-area: chips alignment: center card_param: chips filter: template: &gt; {% set ns = namespace(select=[],entity=\"input_select.heating_rdc_mode\") %} {% for opt in state_attr(ns.entity, 'options') %} {% set icon = iif(opt== 'Comfort', 'mdi:fire', icon) %} {% set icon_color _select = iif(opt== 'Comfort', 'yellow', icon_color _select) %} {% set icon = iif(opt== 'Off', 'mdi:power', icon) %} {% set icon_color _select = iif(opt== 'Off', 'red', icon_color _select) %} {% set icon = iif(opt== 'Eco', 'mdi:leaf', icon) %} {% set icon_color _select = iif(opt== 'Eco', 'green', icon_color _select) %} {% set icon = iif(opt== 'Out of Gel', 'mdi:snowflake-thermometer', icon) %} {% set icon_color _select = iif(opt== 'Out of Gel', 'blue', icon_color _select) %} {% set ns.select = ns.select + [ { \"type\": \"template\", \"icon\": icon, \"entity\": ns.entity, \"icon _color\": '{{ iif(is _state(\"' ~ ns.entity ~ '\", \"' ~ opt ~ '\"), \"' ~ icon_color _select ~ '\", \"disabled\") }', \"tap _action\": { \"action\": \"call-service\", \"service\": \"input_select.select _option\", \"_data service\": { \"entity _id\": ns.entity, \"option\": opt } }, \"card _mod\": { \"style\": 'ha-card { {% if is _state( \"' ~ ns.entity ~ '\" , \"' ~ opt ~ '\" ) %} --chip-background: rgba(var(--rgb-grey), 0.1); {% else %} --chip-background: rgba(var(--mush-rgb-state-entity), 0.3); {% endif %} }' } } ] %} {% endfor %} {{ ns.select }} - type: entities entities: - entity: input_select.heating_rdc_mode\r\n<\/pre>\r\n<h4>Map code for the Floor area<\/h4>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\">Type: custom:stack-in-card mode: vertical cards: - type: custom:auto-entities show _empty: false card: Type: custom:mushroom-chips-card view_layout: grid-area: chips alignment: center card_param: chips filter: template: &gt; {% set ns = namespace(select=[],entity=\"input_select.heating_etage _mode\") %} {% for opt in state_attr(ns.entity, 'options') %} {% set icon = iif(opt== 'Comfort', 'mdi:fire', icon) %} {% set icon_color _select = iif(opt== 'Comfort', 'yellow', icon_color _select) %} {% set icon = iif(opt== 'Off', 'mdi:power', icon) %} {% set icon_color _select = iif(opt== 'Off', 'red', icon_color _select) %} {% set icon = iif(opt== 'Eco', 'mdi:leaf', icon) %} {% set icon_color _select = iif(opt== 'Eco', 'green', icon_color _select) %} {% set icon = iif(opt== 'Out of Gel', 'mdi:snowflake-thermometer', icon) %} {% set icon_color _select = iif(opt== 'Out of Gel', 'blue', icon_color _select) %} {% set ns.select = ns.select + [ { \"type\": \"template\", \"icon\": icon, \"entity\": ns.entity, \"icon _color\": '{{ iif(is _state(\"' ~ ns.entity ~ '\", \"' ~ opt ~ '\"), \"' ~ icon_color _select ~ '\", \"disabled\") }', \"tap _action\": { \"action\": \"call-service\", \"service\": \"input_select.select _option\", \"_data service\": { \"entity _id\": ns.entity, \"option\": opt } }, \"card _mod\": { \"style\": 'ha-card { {% if is _state( \"' ~ ns.entity ~ '\" , \"' ~ opt ~ '\" ) %} --chip-background: rgba(var(--rgb-grey), 0.1); {% else %} --chip-background: rgba(var(--mush-rgb-state-entity), 0.3); {% endif %} }' } } ] %} {% endfor %} {{ ns.select }} - type: entities entities: - entity: input_select.heating_etage_mode\r\n<\/pre>\r\n<h3>Conclusion<\/h3>\r\n<p>I am finishing here an important step in the integration of my heating with Home Assistant. I will now tackle the control of this heating depending on who is present or not, hours, days and periods of absence (\u2026 holidays)<\/p>\r\n<p><a href=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/chauffage.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4918\" src=\"https:\/\/www.sigalou-domotique.fr\/wp-content\/uploads\/2023\/09\/chauffage.gif\" alt=\"\" width=\"502\" height=\"244\" \/><\/a><\/p>\r\n<p>&nbsp;<\/p>\r\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>&nbsp; As I explained in: Control its heating with a Sonoff 4CH Pro R2 in multi-zones I control my heating on two zones thanks to pilot wires. As part of the switch from Jeedom to Home Assistant, I must therefore manage to manage these relays with Home Assistant.<\/p>","protected":false},"author":1,"featured_media":4918,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[14,53,166],"tags":[85,81],"class_list":["post-4917","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-domotique","category-home-assistant","category-retex","tag-chauffage","tag-developpement"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/posts\/4917","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/comments?post=4917"}],"version-history":[{"count":0,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/posts\/4917\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/media\/4918"}],"wp:attachment":[{"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/media?parent=4917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/categories?post=4917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sigalou-domotique.fr\/en\/wp-json\/wp\/v2\/tags?post=4917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}