Configurazioni varie

Version 1.1 by Micky Grillo on 2023/02/24 00:35

esphome:
 name: kc868-e16s-1
  #limita uso risorse per device con poca ram
 compile_process_limit: 1

esp32:
 board: esp32dev
 framework:
   type: arduino
   version: 2.0.6

# Enable logging
logger:

# Enable Home Assistant API
api:
 encryption:
   key: !secret encryption_key

ota:
 password: !secret ota

ethernet:
 domain: ".snoopy.lan"
 type: LAN8720
 mdc_pin: GPIO23
 mdio_pin: GPIO18
 clk_mode: GPIO17_OUT
 phy_addr: 0

  # IP statico
 manual_ip:
   static_ip: 192.168.82.201
   gateway: 192.168.82.1
   subnet: 255.255.255.0  
 
 

# Abilita Bluetooth
#esp32_ble_tracker:
#bluetooth_proxy:

# Enable Web server (optional).
web_server:
 port: 80
 auth:
   username: !secret web_username
   password: !secret web_password
   
# Enable i2c
i2c:
 sda: 16
 scl: 15
 scan: true
 id: bus_a

sensor:
 - platform: uptime
   name: ${device_name} Uptime
 - platform: adc
   pin: GPIO36
   name: "test1"
   update_interval: 10s

text_sensor:
# Text sensors with general information.
  # Expose ESPHome version as sensor.
 - platform: version
   name: ${device_name} ESPHome Version
    # Riporta IP del device
 - platform: ethernet_info
   ip_address:
     name: ${device_name} IP

 - platform: template
   id: e16s_input1_action
   name: e16s_01_input1 Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: e16s_input1_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: e16s_input1_action
               state: !lambda 'return "";'  

 - platform: template
   id: e16s_input2_action
   name: e16s_01_input2 Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: e16s_input2_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: e16s_input2_action
               state: !lambda 'return "";'  

 - platform: template
   id: e16s_input3_action
   name: e16s_01_input3 Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: e16s_input3_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: e16s_input3_action
               state: !lambda 'return "";'  

 - platform: template
   id: e16s_input4_action
   name: e16s_01_input4 Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: e16s_input4_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: e16s_input4_action
               state: !lambda 'return "";'  

 - platform: template
   id: e16s_input5_action
   name: e16s_01_input5 Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: e16s_input5_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: e16s_input5_action
               state: !lambda 'return "";'  

 - platform: template
   id: e16s_input6_action
   name: e16s_01_input6 Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: e16s_input6_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: e16s_input6_action
               state: !lambda 'return "";'  

 - platform: template
   id: e16s_input7_action
   name: e16s_01_input7 Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: e16s_input7_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: e16s_input7_action
               state: !lambda 'return "";'  

 - platform: template
   id: e16s_input8_action
   name: e16s_01_input8 Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: e16s_input8_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: e16s_input8_action
               state: !lambda 'return "";'  

 - platform: template
   id: e16s_input9_action
   name: e16s_01_input9 Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: e16s_input9_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: e16s_input9_action
               state: !lambda 'return "";'  

 - platform: template
   id: e16s_input10_action
   name: e16s_01_input10 Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: e16s_input10_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: e16s_input10_action
               state: !lambda 'return "";'  

 - platform: template
   id: e16s_input11_action
   name: e16s_01_input11 Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: e16s_input11_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: e16s_input11_action
               state: !lambda 'return "";'  

 - platform: template
   id: e16s_input12_action
   name: e16s_01_input12 Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: e16s_input12_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: e16s_input12_action
               state: !lambda 'return "";'  

 - platform: template
   id: e16s_input13_action
   name: e16s_01_input13 Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: e16s_input13_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: e16s_input13_action
               state: !lambda 'return "";'  

 - platform: template
   id: e16s_input14_action
   name: e16s_01_input14 Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: e16s_input14_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: e16s_input14_action
               state: !lambda 'return "";'  

 - platform: template
   id: e16s_input15_action
   name: e16s_01_input15 Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: e16s_input15_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: e16s_input15_action
               state: !lambda 'return "";'  

 - platform: template
   id: e16s_input16_action
   name: e16s_01_input16 Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: e16s_input16_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: e16s_input16_action
               state: !lambda 'return "";'  
 
 - platform: template
   id: A1_input_action
   name: e16s_01_A1_input Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: A1_input_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: A1_input_action
               state: !lambda 'return "";'  

 - platform: template
   id: A2_input_action
   name: e16s_01_A2_input Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: A2_input_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: A2_input_action
               state: !lambda 'return "";'

 - platform: template
   id: A3_input_action
   name: e16s_01_A3_input Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: A3_input_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: A3_input_action
               state: !lambda 'return "";'

 - platform: template
   id: A4_input_action
   name: e16s_01_A4_input Action
   on_value:
     - if:
         condition:
           text_sensor.state:
             id: A4_input_action
             state: ""
         else:
           - delay: 20ms
           - text_sensor.template.publish:
               id: A4_input_action
               state: !lambda 'return "";'

# Example configuration entry
pcf8574:
 - id: 'pcf8574_hub_out_1'  # for output channel 1-8
   address: 0x21

 - id: 'pcf8574_hub_out_2'  # for output channel 9-16
   address: 0x25

 - id: 'pcf8574_hub_in_1'  # for input channel 1-8
   address: 0x22

 - id: 'pcf8574_hub_in_2'  # for input channel 9-16
   address: 0x24

# individual lights

light:
 - platform: binary
   id: e16s_output1_light
   name: "Entrata 1p Esterna"
   output: e16s_output1


 - platform: binary
   id: e16s_output2_light
   name: "Entrata 1p Ambience"
   output: e16s_output2
     
 - platform: binary
   id: e16s_output3_light
   name: "Entrata 1p Luce"
   output: e16s_output3
     
 - platform: binary
   id: e16s_output4_light
   name: "Sala Ambience"
   output: e16s_output4
     
 - platform: binary
   id: e16s_output5_light
   name: "Sala Cabinet"
   output: e16s_output5
     
 - platform: binary
   id: e16s_output6_light
   name: "Sala Luce"
   output: e16s_output6

 - platform: binary
   id: e16s_output7_light
   name: "Cucina Ambience"
   output: e16s_output7
     
 - platform: binary
   id: e16s_output8_light
   name: "Cucina Pensile"
   output: e16s_output8
     
 - platform: binary
   id: e16s_output9_light
   name: "Cucina Luce"
   output: e16s_output9

 - platform: binary
   id: e16s_output10_light
   name: "Antibagno"
   output: e16s_output10

 - platform: binary
   id: e16s_output11_light
   name: "Bagno Luce"
   output: e16s_output11
     
 - platform: binary
   id: e16s_output12_light
   name: "Bagno Specchio"
   output: e16s_output12
     
 - platform: binary
   id: e16s_output13_light
   name: "Cameretta Ambience"
   output: e16s_output13
     
 - platform: binary
   id: e16s_output14_light
   name: "Cameretta Luce"
   output: e16s_output14
     
 - platform: binary
   id: e16s_output15_light
   name: "Master Ambience"
   output: e16s_output15
     
 - platform: binary
   id: e16s_output16_light
   name: "Master Luce"
   output: e16s_output16

output:
 - platform: gpio
   id: "e16s_output1"
   pin:
     pcf8574: pcf8574_hub_out_1
     number: 0
     mode: OUTPUT
     inverted: true

 - platform: gpio
   id: "e16s_output2"
   pin:
     pcf8574: pcf8574_hub_out_1
     number: 1
     mode: OUTPUT
     inverted: true
     
 - platform: gpio
   id: "e16s_output3"
   pin:
     pcf8574: pcf8574_hub_out_1
     number: 2
     mode: OUTPUT
     inverted: true
     
 - platform: gpio
   id: "e16s_output4"
   pin:
     pcf8574: pcf8574_hub_out_1
     number: 3
     mode: OUTPUT
     inverted: true
     
 - platform: gpio
   id: "e16s_output5"
   pin:
     pcf8574: pcf8574_hub_out_1
     number: 4
     mode: OUTPUT
     inverted: true
     
 - platform: gpio
   id: "e16s_output6"
   pin:
     pcf8574: pcf8574_hub_out_1
     number: 5
     mode: OUTPUT
     inverted: true

 - platform: gpio
   id: "e16s_output7"
   pin:
     pcf8574: pcf8574_hub_out_1
     number: 6
     mode: OUTPUT
     inverted: true
     
 - platform: gpio
   id: "e16s_output8"
   pin:
     pcf8574: pcf8574_hub_out_1
     number: 7
     mode: OUTPUT
     inverted: true
     
 - platform: gpio
   id: "e16s_output9"
   pin:
     pcf8574: pcf8574_hub_out_2
     number: 0
     mode: OUTPUT
     inverted: true

 - platform: gpio
   id: "e16s_output10"
   pin:
     pcf8574: pcf8574_hub_out_2
     number: 1
     mode: OUTPUT
     inverted: true

 - platform: gpio
   id: "e16s_output11"
   pin:
     pcf8574: pcf8574_hub_out_2
     number: 2
     mode: OUTPUT
     inverted: true
     
 - platform: gpio
   id: "e16s_output12"
   pin:
     pcf8574: pcf8574_hub_out_2
     number: 3
     mode: OUTPUT
     inverted: true
     
 - platform: gpio
   id: "e16s_output13"
   pin:
     pcf8574: pcf8574_hub_out_2
     number: 4
     mode: OUTPUT
     inverted: true
     
 - platform: gpio
   id: "e16s_output14"
   pin:
     pcf8574: pcf8574_hub_out_2
     number: 5
     mode: OUTPUT
     inverted: true
     
 - platform: gpio
   id: "e16s_output15"
   pin:
     pcf8574: pcf8574_hub_out_2
     number: 6
     mode: OUTPUT
     inverted: true
     
 - platform: gpio
   id: "e16s_output16"
   pin:
     pcf8574: pcf8574_hub_out_2
     number: 7
     mode: OUTPUT
     inverted: true
     
binary_sensor:
 - platform: gpio
   name: ""
   id: "e16s_input1"
   pin:
     pcf8574: pcf8574_hub_in_1
     number: 0
     mode: INPUT
     inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output1_light
       - logger.log: e16s_01_input1 Single-Click
       - text_sensor.template.publish:
           id: e16s_input1_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input1 Double-Click
         - text_sensor.template.publish:
             id: e16s_input1_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input1 Long-Click
         - text_sensor.template.publish:
             id: e16s_input1_action
             state: !lambda 'return "long";'

 - platform: gpio
   name: ""
   id: "e16s_input2"
   pin:
     pcf8574: pcf8574_hub_in_1
     number: 1
     mode: INPUT
     inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output2_light
       - logger.log: e16s_01_input2 Single-Click
       - text_sensor.template.publish:
           id: e16s_input2_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input2 Double-Click
         - text_sensor.template.publish:
             id: e16s_input2_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input2 Long-Click
         - text_sensor.template.publish:
             id: e16s_input2_action
             state: !lambda 'return "long";'

 - platform: gpio
   name: ""
   id: "e16s_input3"
   pin:
     pcf8574: pcf8574_hub_in_1
     number: 2
     mode: INPUT
     inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output3_light
       - logger.log: e16s_01_input3 Single-Click
       - text_sensor.template.publish:
           id: e16s_input3_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input3 Double-Click
         - text_sensor.template.publish:
             id: e16s_input3_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input3 Long-Click
         - text_sensor.template.publish:
             id: e16s_input3_action
             state: !lambda 'return "long";'

 - platform: gpio
   name: ""
   id: "e16s_input4"
   pin:
     pcf8574: pcf8574_hub_in_1
     number: 3
     mode: INPUT
     inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output4_light
       - logger.log: e16s_01_input4 Single-Click
       - text_sensor.template.publish:
           id: e16s_input4_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input4 Double-Click
         - text_sensor.template.publish:
             id: e16s_input4_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input4 Long-Click
         - text_sensor.template.publish:
             id: e16s_input4_action
             state: !lambda 'return "long";'

 - platform: gpio
   name: ""
   id: "e16s_input5"
   pin:
     pcf8574: pcf8574_hub_in_1
     number: 4
     mode: INPUT
     inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output5_light
       - logger.log: e16s_01_input5 Single-Click
       - text_sensor.template.publish:
           id: e16s_input5_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input5 Double-Click
         - text_sensor.template.publish:
             id: e16s_input5_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input5 Long-Click
         - text_sensor.template.publish:
             id: e16s_input5_action
             state: !lambda 'return "long";'

 - platform: gpio
   name: ""
   id: "e16s_input6"
   pin:
     pcf8574: pcf8574_hub_in_1
     number: 5
     mode: INPUT
     inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output6_light
       - logger.log: e16s_01_input6 Single-Click
       - text_sensor.template.publish:
           id: e16s_input6_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input6 Double-Click
         - text_sensor.template.publish:
             id: e16s_input6_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input6 Long-Click
         - text_sensor.template.publish:
             id: e16s_input6_action
             state: !lambda 'return "long";'


 - platform: gpio
   name: ""
   id: "e16s_input7"
   pin:
     pcf8574: pcf8574_hub_in_1
     number: 6
     mode: INPUT
     inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output7_light
       - logger.log: e16s_01_input7 Single-Click
       - text_sensor.template.publish:
           id: e16s_input7_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input7 Double-Click
         - text_sensor.template.publish:
             id: e16s_input7_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input7 Long-Click
         - text_sensor.template.publish:
             id: e16s_input7_action
             state: !lambda 'return "long";'


 - platform: gpio
   name: ""
   id: "e16s_input8"
   pin:
     pcf8574: pcf8574_hub_in_1
     number: 7
     mode: INPUT
     inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output8_light
       - logger.log: e16s_01_input8 Single-Click
       - text_sensor.template.publish:
           id: e16s_input8_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input8 Double-Click
         - text_sensor.template.publish:
             id: e16s_input8_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input8 Long-Click
         - text_sensor.template.publish:
             id: e16s_input8_action
             state: !lambda 'return "long";'


 - platform: gpio
   name: ""
   id: "e16s_input9"
   pin:
     pcf8574: pcf8574_hub_in_2
     number: 0
     mode: INPUT
     inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output9_light
       - logger.log: e16s_01_input9 Single-Click
       - text_sensor.template.publish:
           id: e16s_input9_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input9 Double-Click
         - text_sensor.template.publish:
             id: e16s_input9_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input9 Long-Click
         - text_sensor.template.publish:
             id: e16s_input9_action
             state: !lambda 'return "long";'


 - platform: gpio
   name: ""
   id: "e16s_input10"
   pin:
     pcf8574: pcf8574_hub_in_2
     number: 1
     mode: INPUT
     inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output10_light
       - logger.log: e16s_01_input10 Single-Click
       - text_sensor.template.publish:
           id: e16s_input10_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input10 Double-Click
         - text_sensor.template.publish:
             id: e16s_input10_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input10 Long-Click
         - text_sensor.template.publish:
             id: e16s_input10_action
             state: !lambda 'return "long";'


 - platform: gpio
   name: ""
   id: "e16s_input11"
   pin:
     pcf8574: pcf8574_hub_in_2
     number: 2
     mode: INPUT
     inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output11_light
       - logger.log: e16s_01_input11 Single-Click
       - text_sensor.template.publish:
           id: e16s_input11_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input11 Double-Click
         - text_sensor.template.publish:
             id: e16s_input11_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input11 Long-Click
         - text_sensor.template.publish:
             id: e16s_input11_action
             state: !lambda 'return "long";'

 - platform: gpio
   name: ""
   id: "e16s_input12"
   pin:
     pcf8574: pcf8574_hub_in_2
     number: 3
     mode: INPUT
     inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output12_light
       - logger.log: e16s_01_input12 Single-Click
       - text_sensor.template.publish:
           id: e16s_input12_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input12 Double-Click
         - text_sensor.template.publish:
             id: e16s_input12_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input12 Long-Click
         - text_sensor.template.publish:
             id: e16s_input12_action
             state: !lambda 'return "long";'

 - platform: gpio
   name: ""
   id: "e16s_input13"
   pin:
     pcf8574: pcf8574_hub_in_2
     number: 4
     mode: INPUT
     inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output13_light
       - logger.log: e16s_01_input13 Single-Click
       - text_sensor.template.publish:
           id: e16s_input13_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input13 Double-Click
         - text_sensor.template.publish:
             id: e16s_input13_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input13 Long-Click
         - text_sensor.template.publish:
             id: e16s_input13_action
             state: !lambda 'return "long";'

 - platform: gpio
   name: ""
   id: "e16s_input14"
   pin:
     pcf8574: pcf8574_hub_in_2
     number: 5
     mode: INPUT
     inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output14_light
       - logger.log: e16s_01_input14 Single-Click
       - text_sensor.template.publish:
           id: e16s_input14_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input14 Double-Click
         - text_sensor.template.publish:
             id: e16s_input14_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input14 Long-Click
         - text_sensor.template.publish:
             id: e16s_input14_action
             state: !lambda 'return "long";'

 - platform: gpio
   name: ""
   id: "e16s_input15"
   pin:
     pcf8574: pcf8574_hub_in_2
     number: 6
     mode: INPUT
     inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output15_light
       - logger.log: e16s_01_input15 Single-Click
       - text_sensor.template.publish:
           id: e16s_input15_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input15 Double-Click
         - text_sensor.template.publish:
             id: e16s_input15_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input15 Long-Click
         - text_sensor.template.publish:
             id: e16s_input15_action
             state: !lambda 'return "long";'

 - platform: gpio
   name: ""
   id: "e16s_input16"
   pin:
     pcf8574: pcf8574_hub_in_2
     number: 7
     mode: INPUT
     inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output16_light
       - logger.log: e16s_01_input16 Single-Click
       - text_sensor.template.publish:
           id: e16s_input10_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input16 Double-Click
         - text_sensor.template.publish:
             id: e16s_input16_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_input16 Long-Click
         - text_sensor.template.publish:
             id: e16s_input16_action
             state: !lambda 'return "long";'

 - platform: gpio
   name: ""
   id: "A1_input"
   pin:
     number: 36
     mode: INPUT
      #inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - light.toggle: e16s_output16_light
       - logger.log: e16s_01_A1_input Single-Click
       - text_sensor.template.publish:
           id: A1_input_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_A1_input Double-Click
         - text_sensor.template.publish:
             id: A1_input_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_A1_input Long-Click
         - text_sensor.template.publish:
             id: A1_input_action
             state: !lambda 'return "long";'

 - platform: gpio
   name: ""
   id: "A2_input"
   pin:
     number: 35
     mode: INPUT
      #inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - logger.log: e16s_01_A2_input Single-Click
       - text_sensor.template.publish:
           id: A2_input_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_A2_input Double-Click
         - text_sensor.template.publish:
             id: A2_input_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_A2_input Long-Click
         - text_sensor.template.publish:
             id: A2_input_action
             state: !lambda 'return "long";'

 - platform: gpio
   name: ""
   id: "A3_input"
   pin:
     number: 34
     mode: INPUT
      #inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - logger.log: e16s_01_A3_input Single-Click
       - text_sensor.template.publish:
           id: A3_input_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_A3_input Double-Click
         - text_sensor.template.publish:
             id: A3_input_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_A3_input Long-Click
         - text_sensor.template.publish:
             id: A3_input_action
             state: !lambda 'return "long";'

 - platform: gpio
   name: ""
   id: "A4_input"
   pin:
     number: 39
     mode: INPUT
      #inverted: true
   on_multi_click:
     - timing:
         - ON for at most 1s
         - OFF for at least 0.5s
       then:
       - logger.log: e16s_01_A4_input Single-Click
       - text_sensor.template.publish:
           id: A4_input_action
           state: !lambda 'return "single";'   
     - timing:
         - ON for at most 1s
         - OFF for at most 0.3s
         - ON for at most 1s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_A4_input Double-Click
         - text_sensor.template.publish:
             id: A4_input_action
             state: !lambda 'return "double";'
     - timing:
         - ON for 1s to 4s
         - OFF for at least 0.2s
       then:
         - logger.log: e16s_01_A4_input Long-Click
         - text_sensor.template.publish:
             id: A4_input_action
             state: !lambda 'return "long";'