- substitutions:
- devicename: "dtsu-logger"
- friendly_name: DTSU-Logger
- wifi:
- ssid: !secret wifi_ssid
- password: !secret wifi_password
- # Enable fallback hotspot (captive portal) in case wifi connection fails
- ap:
- ssid: "dstu666 Fallback Hotspot"
- password: "12345678"
- #captive_portal:
- # Enable Home Assistant API
- api:
- encryption:
- key: "C+efLvvWFd/FJJhF3WDrWyXLVI7W6cn2/Jzv9I1nZPA="
- ota:
- - platform: esphome
- password: "f64061faf01074dade1c2ed13a2c3ca0"
- # Enable Web server
- web_server:
- port: 80
- esphome:
- name: $devicename
- platform: ESP8266
- board: d1_mini
- board_flash_mode: dout
- comment: DTSU666 Logger (Modbus/RS485)
- logger:
- level: debug
- baud_rate: 0
- uart:
- tx_pin: 1
- rx_pin: 3
- rx_buffer_size: 512
- baud_rate: 9600
- parity: NONE
- data_bits: 8
- stop_bits: 1
- id: uart_to_modbus
- modbus:
- send_wait_time: 500ms
- id: modbus_component_hub
- uart_id: uart_to_modbus
- modbus_controller:
- - id: dtsu666_modbus_controler
- address: 0x02
- modbus_id: modbus_component_hub
- update_interval: 2s
- text_sensor:
- - platform: template
- name: "ESP-DTSU Uptime (human readable)"
- id: uptime_human
- icon: "mdi:clock-start"
- update_interval: 5s
- sensor:
- #------------------------------------------------------
- # Energia
- # ------------------------------------------------------
- - platform: modbus_controller
- modbus_controller_id: dtsu666_modbus_controler
- id: Power_Imp
- name: "Energia pobrana z sieci kwh"
- address: 0x2000
- unit_of_measurement: "kWh"
- device_class: "energy"
- state_class: "total_increasing"
- register_type: read
- value_type: FP32
- accuracy_decimals: 2
- skip_updates: 12
- filters:
- - multiply: 1
- - platform: modbus_controller
- modbus_controller_id: dtsu666_modbus_controler
- id: Power_Exp
- name: "Energia oddana do sieci kwh"
- address: 0x1028
- unit_of_measurement: "kWh"
- device_class: "energy"
- state_class: "total_increasing"
- register_type: read
- value_type: FP32
- accuracy_decimals: 2
- skip_updates: 12
- filters:
- - multiply: 1
- #------------------------------------------------------
- # Napięcia
- #------------------------------------------------------
- - platform: modbus_controller
- modbus_controller_id: dtsu666_modbus_controler
- id: Ua
- name: "Napięcie L3"
- address: 0x200A
- unit_of_measurement: "V"
- register_type: read
- value_type: FP32
- accuracy_decimals: 1
- filters:
- - multiply: 0.1
- - platform: modbus_controller
- modbus_controller_id: dtsu666_modbus_controler
- id: Ub
- name: "Napięcie L2"
- address: 0x2008
- unit_of_measurement: "V"
- register_type: read
- value_type: FP32
- accuracy_decimals: 1
- filters:
- - multiply: 0.1
- - platform: modbus_controller
- modbus_controller_id: dtsu666_modbus_controler
- id: Uc
- name: "Napięcie L1"
- address: 0x2006
- unit_of_measurement: "V"
- register_type: read
- value_type: FP32
- accuracy_decimals: 1
- filters:
- - multiply: 0.1
- #------------------------------------------------------
- # Prądy
- #------------------------------------------------------
- - platform: modbus_controller
- modbus_controller_id: dtsu666_modbus_controler
- id: Ia
- name: "Prąd L3"
- address: 0x2010
- unit_of_measurement: "A"
- register_type: read
- value_type: FP32
- accuracy_decimals: 1
- filters:
- - multiply: 0.001
- - platform: modbus_controller
- modbus_controller_id: dtsu666_modbus_controler
- id: Ib
- name: "Prąd L2"
- address: 0x200E
- unit_of_measurement: "A"
- register_type: read
- value_type: FP32
- accuracy_decimals: 1
- filters:
- - multiply: 0.001
- - platform: modbus_controller
- modbus_controller_id: dtsu666_modbus_controler
- id: Ic
- name: "Prąd L1"
- address: 0x200C
- unit_of_measurement: "A"
- register_type: read
- value_type: FP32
- accuracy_decimals: 1
- filters:
- - multiply: 0.001
- #------------------------------------------------------
- # moc chwilowa
- #------------------------------------------------------
- - platform: modbus_controller
- modbus_controller_id: dtsu666_modbus_controler
- id: Pt
- name: "Moc chwilowa całkowita"
- address: 0x2012
- unit_of_measurement: "W"
- register_type: read
- value_type: FP32
- accuracy_decimals: 0
- filters:
- - multiply: 0.1
- - platform: modbus_controller
- modbus_controller_id: dtsu666_modbus_controler
- id: Pa
- name: "Moc chwilowa L3"
- address: 0x2018
- unit_of_measurement: "W"
- register_type: read
- value_type: FP32
- accuracy_decimals: 0
- filters:
- - multiply: 0.1
- - platform: modbus_controller
- modbus_controller_id: dtsu666_modbus_controler
- id: Pb
- name: "Moc chwilowa L2"
- address: 0x2016
- unit_of_measurement: "W"
- register_type: read
- value_type: FP32
- accuracy_decimals: 0
- filters:
- - multiply: 0.1
- - platform: modbus_controller
- modbus_controller_id: dtsu666_modbus_controler
- id: Pc
- name: "Moc chwilowa L1"
- address: 0x2014
- unit_of_measurement: "W"
- register_type: read
- value_type: FP32
- accuracy_decimals: 0
- filters:
- - multiply: 0.1
- #------------------------------------------------------
- # power factor
- #------------------------------------------------------
- - platform: modbus_controller
- modbus_controller_id: dtsu666_modbus_controler
- id: Pf
- name: "Power Factor"
- address: 0x202A
- unit_of_measurement: "Pf"
- register_type: read
- value_type: FP32
- accuracy_decimals: 2
- filters:
- - multiply: 0.001
- - platform: modbus_controller
- modbus_controller_id: dtsu666_modbus_controler
- id: Pfa
- name: "Power Factor L1"
- address: 0x202c
- unit_of_measurement: "Pf"
- register_type: read
- value_type: FP32
- accuracy_decimals: 2
- filters:
- - multiply: 0.001
- - platform: modbus_controller
- modbus_controller_id: dtsu666_modbus_controler
- id: Pfb
- name: "Power Factor L2"
- address: 0x202e
- unit_of_measurement: "Pf"
- register_type: read
- value_type: FP32
- accuracy_decimals: 2
- filters:
- - multiply: 0.001
- - platform: modbus_controller
- modbus_controller_id: dtsu666_modbus_controler
- id: Pfc
- name: "Power Factor L3"
- address: 0x2030
- unit_of_measurement: "Pf"
- register_type: read
- value_type: FP32
- accuracy_decimals: 2
- filters:
- - multiply: 0.001
- #------------------------------------------------------
- # wifi signal
- #------------------------------------------------------
- - platform: wifi_signal
- id: dtsu_wifi_signal
- name: "WiFi Signal DTSU-Logger"
- update_interval: 60s
- icon: "mdi:wifi"
- - platform: uptime
- id: inverter_uptime
- name: "ESP-DTSU Uptime"
- filters:
- - lambda: return x / 60.0;
- unit_of_measurement: minutes
- icon: "mdi:clock-start"
- - platform: uptime
- name: ${friendly_name} Uptime
- id: uptime_sensor
- update_interval: 5s
- icon: "mdi:clock-start"
- internal: true
- on_raw_value:
- then:
- - text_sensor.template.publish:
- id: uptime_human
- state: !lambda |-
- int seconds = round(id(uptime_sensor).raw_state);
- seconds = seconds % (24 * 3600);
- int hours = seconds / 3600;
- seconds = seconds % 3600;
- int minutes = seconds / 60;
- seconds = seconds % 60;
- return (
- (hours ? to_string(hours) + "h " : "") +
- (minutes ? to_string(minutes) + "m " : "") +
- (to_string(seconds) + "s")
- ).c_str();
- - platform: template
- unit_of_measurement: "%"
- name: "ESP-DTSU WiFi Signal (human readable)"
- accuracy_decimals: 0
- update_interval: 30s
- device_class: "signal_strength"
- icon: "mdi:wifi"
- lambda: return (-0.0134 * (id(dtsu_wifi_signal).state * id(dtsu_wifi_signal).state ) ) + (-0.2228 * id(dtsu_wifi_signal).state) + 100.2;
- # Basic switch to allow you to restart the device remotely
- switch:
- - platform: restart
- name: DTSU-Loger Restart
- binary_sensor:
- - platform: status
- name: DTSU-Loger Status