Untitled

From Ivory Macaw, 4 Days ago, written in Plain Text, viewed 1 times.
URL https://paste.linuxiarz.pl/view/2a7ebca3 Embed
Download Paste or View Raw
  1. substitutions:
  2.   devicename: "dtsu-logger"
  3.   friendly_name: DTSU-Logger
  4.  
  5. wifi:
  6.   ssid: !secret wifi_ssid
  7.   password: !secret wifi_password
  8.  
  9.  
  10.   # Enable fallback hotspot (captive portal) in case wifi connection fails
  11.   ap:
  12.     ssid: "dstu666 Fallback Hotspot"
  13.     password: "12345678"
  14.  
  15. #captive_portal:
  16.  
  17. # Enable Home Assistant API
  18. api:
  19.   encryption:
  20.     key: "C+efLvvWFd/FJJhF3WDrWyXLVI7W6cn2/Jzv9I1nZPA="
  21.  
  22. ota:
  23.   - platform: esphome
  24.     password: "f64061faf01074dade1c2ed13a2c3ca0"
  25. # Enable Web server
  26. web_server:
  27.   port: 80
  28.  
  29. esphome:
  30.   name: $devicename
  31.   platform: ESP8266
  32.   board: d1_mini
  33.   board_flash_mode: dout
  34.   comment: DTSU666 Logger (Modbus/RS485)
  35.  
  36. logger:
  37.     level: debug
  38.     baud_rate: 0
  39.    
  40. uart:
  41.   tx_pin: 1
  42.   rx_pin: 3
  43.   rx_buffer_size: 512
  44.   baud_rate: 9600
  45.   parity: NONE
  46.   data_bits: 8
  47.   stop_bits: 1
  48.   id: uart_to_modbus
  49.  
  50.  
  51.  
  52. modbus:
  53.   send_wait_time: 500ms
  54.   id: modbus_component_hub
  55.   uart_id: uart_to_modbus
  56.  
  57. modbus_controller:
  58.   - id: dtsu666_modbus_controler
  59.     address: 0x02
  60.     modbus_id: modbus_component_hub
  61.     update_interval: 2s
  62.  
  63. text_sensor:
  64.  
  65.   - platform: template
  66.     name: "ESP-DTSU Uptime (human readable)"
  67.     id: uptime_human
  68.     icon: "mdi:clock-start"
  69.     update_interval: 5s
  70.  
  71. sensor:
  72. #------------------------------------------------------
  73. # Energia
  74. # ------------------------------------------------------
  75.   - platform: modbus_controller
  76.     modbus_controller_id: dtsu666_modbus_controler
  77.     id: Power_Imp
  78.     name: "Energia pobrana z sieci kwh"
  79.  
  80.     address: 0x2000
  81.     unit_of_measurement: "kWh"
  82.     device_class: "energy"
  83.     state_class: "total_increasing"
  84.     register_type: read
  85.     value_type: FP32
  86.     accuracy_decimals: 2
  87.     skip_updates: 12
  88.     filters:
  89.       - multiply: 1
  90.  
  91.   - platform: modbus_controller
  92.     modbus_controller_id: dtsu666_modbus_controler
  93.     id: Power_Exp
  94.     name: "Energia oddana do sieci kwh"
  95.  
  96.     address: 0x1028
  97.     unit_of_measurement: "kWh"
  98.     device_class: "energy"
  99.     state_class: "total_increasing"
  100.     register_type: read
  101.     value_type: FP32
  102.     accuracy_decimals: 2
  103.     skip_updates: 12
  104.     filters:
  105.       - multiply: 1
  106. #------------------------------------------------------
  107. # Napięcia
  108. #------------------------------------------------------
  109.   - platform: modbus_controller
  110.     modbus_controller_id: dtsu666_modbus_controler
  111.     id: Ua
  112.     name: "Napięcie L3"
  113.     address: 0x200A
  114.     unit_of_measurement: "V"
  115.     register_type: read
  116.     value_type: FP32
  117.     accuracy_decimals: 1
  118.     filters:
  119.       - multiply: 0.1
  120.      
  121.   - platform: modbus_controller
  122.     modbus_controller_id: dtsu666_modbus_controler
  123.     id: Ub
  124.     name: "Napięcie L2"
  125.     address: 0x2008
  126.     unit_of_measurement: "V"
  127.     register_type: read
  128.     value_type: FP32
  129.     accuracy_decimals: 1
  130.     filters:
  131.       - multiply: 0.1  
  132.  
  133.   - platform: modbus_controller
  134.     modbus_controller_id: dtsu666_modbus_controler
  135.     id: Uc
  136.     name: "Napięcie L1"
  137.     address: 0x2006
  138.     unit_of_measurement: "V"
  139.     register_type: read
  140.     value_type: FP32
  141.     accuracy_decimals: 1
  142.     filters:
  143.       - multiply: 0.1  
  144. #------------------------------------------------------
  145. # Prądy
  146. #------------------------------------------------------      
  147.   - platform: modbus_controller
  148.     modbus_controller_id: dtsu666_modbus_controler
  149.     id: Ia
  150.     name: "Prąd L3"
  151.     address: 0x2010
  152.     unit_of_measurement: "A"
  153.     register_type: read
  154.     value_type: FP32
  155.     accuracy_decimals: 1
  156.     filters:
  157.       - multiply: 0.001
  158.      
  159.   - platform: modbus_controller
  160.     modbus_controller_id: dtsu666_modbus_controler
  161.     id: Ib
  162.     name: "Prąd L2"
  163.     address: 0x200E
  164.     unit_of_measurement: "A"
  165.     register_type: read
  166.     value_type: FP32
  167.     accuracy_decimals: 1
  168.     filters:
  169.       - multiply: 0.001  
  170.  
  171.   - platform: modbus_controller
  172.     modbus_controller_id: dtsu666_modbus_controler
  173.     id: Ic
  174.     name: "Prąd L1"
  175.     address: 0x200C
  176.     unit_of_measurement: "A"
  177.     register_type: read
  178.     value_type: FP32
  179.     accuracy_decimals: 1
  180.     filters:
  181.       - multiply: 0.001
  182.  
  183.   #------------------------------------------------------
  184.   # moc chwilowa
  185.   #------------------------------------------------------
  186.   - platform: modbus_controller
  187.     modbus_controller_id: dtsu666_modbus_controler
  188.     id: Pt
  189.     name: "Moc chwilowa całkowita"
  190.     address: 0x2012
  191.     unit_of_measurement: "W"
  192.     register_type: read
  193.     value_type: FP32
  194.     accuracy_decimals: 0
  195.     filters:
  196.       - multiply: 0.1
  197.  
  198.   - platform: modbus_controller
  199.     modbus_controller_id: dtsu666_modbus_controler
  200.     id: Pa
  201.     name: "Moc chwilowa L3"
  202.     address: 0x2018
  203.     unit_of_measurement: "W"
  204.     register_type: read
  205.     value_type: FP32
  206.     accuracy_decimals: 0
  207.     filters:
  208.       - multiply: 0.1
  209.  
  210.   - platform: modbus_controller
  211.     modbus_controller_id: dtsu666_modbus_controler
  212.     id: Pb
  213.     name: "Moc chwilowa L2"
  214.     address: 0x2016
  215.     unit_of_measurement: "W"
  216.     register_type: read
  217.     value_type: FP32
  218.     accuracy_decimals: 0
  219.     filters:
  220.       - multiply: 0.1
  221.  
  222.   - platform: modbus_controller
  223.     modbus_controller_id: dtsu666_modbus_controler
  224.     id: Pc
  225.     name: "Moc chwilowa L1"
  226.     address: 0x2014
  227.     unit_of_measurement: "W"
  228.     register_type: read
  229.     value_type: FP32
  230.     accuracy_decimals: 0
  231.     filters:
  232.       - multiply: 0.1
  233. #------------------------------------------------------
  234. # power factor
  235. #------------------------------------------------------
  236.   - platform: modbus_controller
  237.     modbus_controller_id: dtsu666_modbus_controler
  238.     id: Pf
  239.     name: "Power Factor"
  240.     address: 0x202A
  241.     unit_of_measurement: "Pf"
  242.     register_type: read
  243.     value_type: FP32
  244.     accuracy_decimals: 2
  245.     filters:
  246.       - multiply: 0.001
  247.  
  248.   - platform: modbus_controller
  249.     modbus_controller_id: dtsu666_modbus_controler
  250.     id: Pfa
  251.     name: "Power Factor L1"
  252.     address: 0x202c
  253.     unit_of_measurement: "Pf"
  254.     register_type: read
  255.     value_type: FP32
  256.     accuracy_decimals: 2
  257.     filters:
  258.       - multiply: 0.001
  259.        
  260.   - platform: modbus_controller
  261.     modbus_controller_id: dtsu666_modbus_controler
  262.     id: Pfb
  263.     name: "Power Factor L2"
  264.     address: 0x202e
  265.     unit_of_measurement: "Pf"
  266.     register_type: read
  267.     value_type: FP32
  268.     accuracy_decimals: 2
  269.     filters:
  270.       - multiply: 0.001
  271.  
  272.   - platform: modbus_controller
  273.     modbus_controller_id: dtsu666_modbus_controler
  274.     id: Pfc
  275.     name: "Power Factor L3"
  276.     address: 0x2030
  277.     unit_of_measurement: "Pf"
  278.     register_type: read
  279.     value_type: FP32
  280.     accuracy_decimals: 2
  281.     filters:
  282.       - multiply: 0.001
  283.   #------------------------------------------------------
  284.   # wifi signal
  285.   #------------------------------------------------------    
  286.   - platform: wifi_signal
  287.     id: dtsu_wifi_signal
  288.     name: "WiFi Signal DTSU-Logger"
  289.     update_interval: 60s
  290.     icon: "mdi:wifi"
  291.  
  292.   - platform: uptime
  293.     id: inverter_uptime
  294.     name: "ESP-DTSU Uptime"
  295.     filters:
  296.       - lambda: return x / 60.0;
  297.     unit_of_measurement: minutes
  298.     icon: "mdi:clock-start"
  299.  
  300.   - platform: uptime
  301.     name: ${friendly_name} Uptime
  302.     id: uptime_sensor
  303.     update_interval: 5s
  304.     icon: "mdi:clock-start"
  305.     internal: true
  306.     on_raw_value:
  307.       then:
  308.         - text_sensor.template.publish:
  309.             id: uptime_human
  310.             state: !lambda |-
  311.               int seconds = round(id(uptime_sensor).raw_state);
  312.               seconds = seconds % (24 * 3600);
  313.               int hours = seconds / 3600;
  314.               seconds = seconds % 3600;
  315.               int minutes = seconds /  60;
  316.               seconds = seconds % 60;
  317.               return (
  318.                 (hours ? to_string(hours) + "h " : "") +
  319.                 (minutes ? to_string(minutes) + "m " : "") +
  320.                 (to_string(seconds) + "s")
  321.               ).c_str();
  322.  
  323.   - platform: template
  324.     unit_of_measurement: "%"
  325.     name: "ESP-DTSU WiFi Signal (human readable)"
  326.     accuracy_decimals: 0
  327.     update_interval: 30s
  328.     device_class: "signal_strength"
  329.     icon: "mdi:wifi"
  330.     lambda: return (-0.0134 * (id(dtsu_wifi_signal).state * id(dtsu_wifi_signal).state ) ) + (-0.2228 * id(dtsu_wifi_signal).state) + 100.2;
  331.  
  332. # Basic switch to allow you to restart the device remotely
  333. switch:
  334.   - platform: restart
  335.     name: DTSU-Loger Restart
  336.  
  337. binary_sensor:
  338.   - platform: status
  339.     name: DTSU-Loger Status

Reply to "Untitled"

Here you can reply to the paste above

captcha