Paste Search Dynamic
Recent pastes
esphome ESP32
  1. esphome:
  2.   name: ecs
  3.   platform: ESP32
  4.   board: esp32dev
  5.  
  6.   #on_boot:
  7.   #  priority: -100
  8.   #  then:
  9.   #    - delay: 10000ms
  10.  
  11. wifi:
  12.   ssid: !secret esphome_ssid
  13.   password: !secret esphome_password
  14.  
  15. # Enable logging
  16. logger:
  17.   baud_rate: 0
  18.  
  19. # Enable Home Assistant API
  20. api:
  21.  
  22. ota:
  23.  
  24. mqtt:
  25.   broker: 192.168.1.2
  26.   port: 1883
  27.   username: mosquitto
  28.   password: mosquitto
  29.   discovery: false
  30.   discovery_retain: false
  31.  
  32.  
  33. time:
  34.   - platform: homeassistant
  35.     id: homeassistant_time  
  36.    
  37.     on_time:
  38.       - seconds: 56
  39.         minutes: 59
  40.         hours: 23
  41.         then:  
  42.           - sensor.template.publish:
  43.               id: template_ecs_veille
  44.               state: !lambda return id(daily_ecs).state;
  45.           - sensor.template.publish:
  46.               id: template_bec_veille
  47.               state: !lambda return id(daily_bec).state;
  48.              
  49.       - seconds: /10
  50.         then:
  51.           - sensor.template.publish:
  52.               id: template_bec_veille
  53.               state: !lambda return id(template_bec_veille).state;
  54.              
  55.           - sensor.template.publish:
  56.               id: template_ecs_veille
  57.               state: !lambda return id(template_ecs_veille).state;    
  58. switch:
  59.   - platform: restart
  60.     name: "restart_ecs"  
  61.    
  62.   - platform: uart
  63.     uart_id: ubus1
  64.     name: "ecs reset rnergy"
  65.     data: [0x01, 0x42, 0x80, 0x11]  
  66.  
  67. uart:
  68.   - id: ubus1
  69.     tx_pin: GPIO1
  70.     rx_pin: GPIO3
  71.     baud_rate: 9600
  72.     stop_bits: 2     #pour un ESP8266, essayer plutôt la valeur 1    
  73.    
  74.    
  75. i2c:
  76. - sda: GPIO21
  77.   scl: GPIO22
  78.   id: i2c_bus1          
  79.  
  80.  
  81. dallas:
  82.   - pin: GPIO02
  83.     update_interval: 10s
  84.    
  85. sensor:        
  86.   - platform: dallas
  87.     address: 0x05811851B3B2FF28
  88.     name: "ecs_temperature"
  89.     id: ecs_temperature
  90.     unit_of_measurement: "°C"
  91.     accuracy_decimals: 2
  92.     filters:
  93.      - offset: 5.0
  94.     on_value:
  95.       then:
  96.         - mqtt.publish:
  97.             topic: output/solar
  98.             payload: !lambda >-
  99.               return { ("tem" + String(int(id(ecs_temperature).state ))).c_str()  };
  100.  
  101.  
  102.    
  103.   - platform: bme280
  104.     i2c_id: i2c_bus1
  105.     temperature:
  106.       name: "temperature_sdb_haut"
  107.       oversampling: 16x
  108.       id: temperature_sdb_haut
  109.     pressure:
  110.       name: "pression_sdb_haut"
  111.       id: pression_sdb_haut
  112.       unit_of_measurement: "bar"
  113.       accuracy_decimals: 3
  114.       filters:
  115.       - lambda: return x / 1000.0;
  116.     humidity:
  117.       name: "humidite_sdb_haut"
  118.       id: humidite_sdb_haut
  119.     address: 0x76
  120.     update_interval: 10s  
  121.  
  122.  
  123.   - platform: pzemac
  124.     address: 1
  125.     current:
  126.       name: "bec_courant"
  127.       accuracy_decimals: 2
  128.     voltage:
  129.       name: "bec_tension"
  130.       accuracy_decimals: 2
  131.     power:
  132.       name: "bec_puissance"
  133.       unit_of_measurement: W
  134.       accuracy_decimals: 2
  135.       id: bec_puissance
  136.     frequency:
  137.       name: "bec_frequence"
  138.       unit_of_measurement: Hz
  139.       accuracy_decimals: 2
  140.     power_factor:
  141.       name: "bec_facteur_puissance"
  142.       accuracy_decimals: 2
  143.       id: bec_facteur_puissance
  144.     energy:
  145.       name: "bec_energy"
  146.       unit_of_measurement: Wh
  147.       accuracy_decimals: 1
  148.       id: bec_energy
  149.     update_interval: 5s
  150.  
  151.    
  152.   - platform: template
  153.     name: "bec_puissance_cumulee"
  154.     unit_of_measurement: "kWh"
  155.     accuracy_decimals: 1
  156.     update_interval: 5s
  157.     icon: mdi:power
  158.     lambda: return (( (id(bec_energy).state)/1000.0));
  159.    
  160.   - platform: total_daily_energy
  161.     name: "bec_du_jour"
  162.     power_id: bec_puissance
  163.     unit_of_measurement: "kWh"
  164.     accuracy_decimals: 2
  165.     filters:
  166.         # Multiplication factor from W to kW is 0.001
  167.         - multiply: 0.001
  168.     icon: mdi:counter
  169.     id: daily_bec
  170.    
  171.   - platform: template
  172.     name: "bec_veille"
  173.     id: template_bec_veille
  174.     unit_of_measurement: "kwh"
  175.     accuracy_decimals: 2
  176.     icon: mdi:power
  177.     filters:
  178.      - lambda: return x;
  179.     update_interval: 10s
  180.    
  181.   - platform: template
  182.     name: "bec_puissance_apparente"
  183.     id: bec_puissance_apparente
  184.     unit_of_measurement: "VA"
  185.     accuracy_decimals: 2
  186.     update_interval: 10s
  187.     icon: mdi:power
  188.     #lambda: return ( (id(bec_puissance).state/id(bec_facteur_puissance).state));  #if (x < 27000) return x;
  189.     lambda: if(id(bec_facteur_puissance).state != 0) {  return ( id(bec_puissance).state/id(bec_facteur_puissance).state ); } else {return 0.0;}
  190.  
  191.   - platform: template
  192.     name: "bec_puissance_reactive"
  193.     id: bec_puissance_reactive
  194.     unit_of_measurement: "VAr"
  195.     accuracy_decimals: 2
  196.     update_interval: 10s
  197.     icon: mdi:power
  198.     #lambda: return ( ((id(enedis_puissance_reactive).state)*sin(acos((id(enedis_facteur_puissance).state))) ) );
  199.     #lambda: return ( ( sqrt( (id(bec_puissance_reactive).state)*(id(bec_puissance_reactive).state)   -  (id(bec_facteur_puissance).state)*(id(bec_facteur_puissance).state) ) )  );  
  200.     lambda: return (  id(bec_puissance).state*sin(acos( id(bec_facteur_puissance).state ))  );
  201.   - platform: pulse_counter
  202.     id: water_flow_meter_ecs
  203.     pin: GPIO15
  204.     name: "water_flow_meter_ecs"    
  205.     update_interval: 1s
  206.     icon: mdi:water
  207.     filters:
  208.      - lambda: return (x / 5.48);
  209.     unit_of_measurement: "l"
  210.    
  211.   - platform: total_daily_energy
  212.     name: "ecs_du_jour"
  213.     power_id: water_flow_meter_ecs  
  214.     unit_of_measurement: "l"
  215.     accuracy_decimals: 2
  216.     id: daily_ecs
  217.    
  218.   - platform: template
  219.     name: "ecs_veille"
  220.     id: template_ecs_veille
  221.     unit_of_measurement: "l"
  222.     accuracy_decimals: 2
  223.     icon: mdi:water
  224.     update_interval: 10s
  225.    
  226.   - platform: wifi_signal
  227.     name: "WiFi puissance_ecs"
  228.     update_interval: 10s
  229.    
  230.    
  231.   - platform: uptime
  232.     name: "up_ecs"
  233.     id: uptime_sec  
  234.    
  235.    
  236. binary_sensor:
  237.   - platform: status
  238.     name: "ecs_status"    
  239.    
  240.    
  241. text_sensor:
  242.   - platform: template
  243.     name: ecs_uptime
  244.     lambda: |-
  245.       int seconds = (id(uptime_sec).state);
  246.       int days = seconds / (24 * 3600);
  247.       seconds = seconds % (24 * 3600);
  248.       int hours = seconds / 3600;
  249.       seconds = seconds % 3600;
  250.       int minutes = seconds /  60;
  251.       seconds = seconds % 60;
  252.       return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
  253.     icon: mdi:clock-start
  254.     update_interval: 113s
Parsed in 0.012 seconds