Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- esphome:
- name: esp32-eltek-can
- esp32:
- board: wemos_d1_mini32
- framework:
- type: arduino
- wifi:
- networks:
- - ssid: !secret wifi_ssid
- password: !secret wifi_password
- api:
- ota:
- logger:
- globals:
- - id: temp_inlet
- type: int
- restore_value: no
- initial_value: '0'
- - id: temp_outlet
- type: int
- restore_value: no
- initial_value: '0'
- - id: voltage_input
- type: int
- restore_value: no
- initial_value: '0'
- - id: voltage_output
- type: float
- restore_value: no
- initial_value: '0'
- - id: current_output
- type: float
- restore_value: no
- initial_value: '0'
- - id: serial_number
- type: uint8_t[6]
- - id: current_limiting
- type: bool
- initial_value: 'false'
- web_server:
- port: 80
- canbus:
- - platform: esp32_can
- rx_pin: GPIO18
- tx_pin: GPIO19
- can_id: 1
- id: eltek
- use_extended_id: true
- bit_rate: 125kbps
- on_frame:
- - can_id: 0 # listen to all messages
- can_id_mask: 0
- use_extended_id: true
- then:
- - lambda: |-
- char buf[29];
- // DGN
- // Source Address (SA)
- // Priority
- // Data (8 bytes)
- int dgn = (can_id >>8) & 0x1ffff;
- int pri = (can_id >> 26) & 0b111;
- int sa = can_id & 0xff;
- snprintf((char*)&buf, sizeof(buf), "%05X,%02X,%1X,%02X%02X%02X%02X%02X%02X%02X%02X", dgn, sa, pri, x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]);
- id(rvc_rx).publish_state((const char*)&buf);
- ESP_LOGI("can", "%s", (const char*)&buf);
- sensor:
- - platform: template
- id: eltek_temp_inlet
- name: "Eltek inlet temperature"
- device_class: temperature
- unit_of_measurement: "°C"
- accuracy_decimals: 0
- update_interval: 1s
- lambda: |-
- return (id(temp_inlet));
- - platform: template
- id: eltek_temp_outlet
- name: "Eltek outlet temperature"
- device_class: temperature
- unit_of_measurement: "°C"
- accuracy_decimals: 0
- update_interval: 1s
- lambda: |-
- return (id(temp_outlet));
- - platform: template
- id: eltek_voltage_input
- name: "Eltek voltage input"
- device_class: voltage
- unit_of_measurement: "V"
- accuracy_decimals: 0
- update_interval: 1s
- lambda: |-
- return (id(voltage_input));
- - platform: template
- id: eltek_voltage_output
- name: "Eltek voltage output"
- device_class: voltage
- unit_of_measurement: "V"
- accuracy_decimals: 2
- update_interval: 1s
- lambda: |-
- return (id(voltage_output));
- - platform: template
- id: eltek_cell_voltage
- name: "Eltek cell voltage (13S Li-ion)"
- device_class: voltage
- unit_of_measurement: "V"
- accuracy_decimals: 2
- update_interval: 1s
- lambda: |-
- return (id(voltage_output) / 13);
- - platform: template
- id: eltek_current_output
- name: "Eltek current output"
- device_class: current
- unit_of_measurement: "A"
- accuracy_decimals: 2
- update_interval: 1s
- lambda: |-
- return (id(current_output));
- - platform: template
- id: eltek_power_output
- name: "Eltek power output"
- device_class: power
- unit_of_measurement: "W"
- accuracy_decimals: 2
- update_interval: 1s
- lambda: |-
- return (id(current_output) * id(voltage_output));
- number:
- - platform: template
- id: eltek_voltage
- name: "Eltek FP2 voltage"
- device_class: voltage
- unit_of_measurement: "V"
- update_interval: 5s
- restore_value: true
- min_value: 44.50
- max_value: 57.60
- step: 0.1
- optimistic: true
- mode: box
- - platform: template
- id: eltek_current
- name: "Eltek FP2 current"
- device_class: current
- unit_of_measurement: "A"
- update_interval: 5s
- restore_value: true
- min_value: 0.10
- max_value: 41.70
- step: 0.1
- optimistic: true
- mode: box
- switch:
- - platform: restart
- name: "ESPhome Eltek FP2 restart"
- binary_sensor:
- - platform: template
- name: "Current limiting active"
- lambda: |-
- if (id(current_limiting)) {
- return true;
- } else {
- return false;
- }
- text_sensor:
- - platform: wifi_info
- ip_address:
- name: ESP IP Address
- ssid:
- name: ESP Connected SSID
- - platform: template
- name: "Flatpack2 temperatures"
- lambda: |-
- char buf[200];
- sprintf(buf, "%.0f°C / %.0f°C", id(eltek_temp_inlet).state, id(eltek_temp_outlet).state);
- return (std::string) buf;
- update_interval: 1s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement