├── images └── powmr_esp32_connection.png ├── src ├── modules │ ├── debug.yaml │ ├── pzem.yaml │ └── inverter.yaml ├── helpers │ ├── myHelpers.h │ └── myHelpers.cpp └── main.yaml ├── helpers ├── myHelpers.h └── myHelpers.cpp ├── include └── common_sensors.yaml ├── LICENSE ├── my-inverter-card 3_2kW.yaml ├── my-inverter-card 6_2kW.yaml ├── docs └── registers-map.md ├── README.md ├── my-inverter 4_2kW.yaml ├── my-inverter 6_2kW.yaml └── my-inverter 3_2kW.yaml /images/powmr_esp32_connection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GamesterUnknown/PowMR_ESPHome/HEAD/images/powmr_esp32_connection.png -------------------------------------------------------------------------------- /src/modules/debug.yaml: -------------------------------------------------------------------------------- 1 | debug: 2 | update_interval: 10s 3 | 4 | sensor: 5 | - platform: debug 6 | free: 7 | name: "Heap Free" 8 | -------------------------------------------------------------------------------- /helpers/myHelpers.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "esphome.h" 5 | 6 | uint16_t swapBytes(uint16_t value); 7 | 8 | uint16_t swapBytes(std::string value); 9 | 10 | void updateUnknownSelect(uint16_t sensorIndex, esphome::modbus_controller::ModbusSelect* selectComp); 11 | -------------------------------------------------------------------------------- /src/helpers/myHelpers.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "esphome.h" 5 | 6 | uint16_t swapBytes(uint16_t value); 7 | 8 | uint16_t swapBytes(std::string value); 9 | 10 | void updateUnknownSelect(uint16_t sensorIndex, esphome::modbus_controller::ModbusSelect* selectComp); 11 | -------------------------------------------------------------------------------- /include/common_sensors.yaml: -------------------------------------------------------------------------------- 1 | sensor: 2 | - platform: uptime 3 | name: "Uptime" 4 | entity_category: "diagnostic" 5 | device_class: duration 6 | update_interval: 60s 7 | - platform: wifi_signal 8 | name: "RSSI" 9 | id: wifi_rssi 10 | entity_category: "diagnostic" 11 | update_interval: 60s 12 | -------------------------------------------------------------------------------- /src/main.yaml: -------------------------------------------------------------------------------- 1 | esphome: 2 | name: "${device_name}" 3 | friendly_name: "${node_name}" 4 | comment: "Monitor and control a solar inverter" 5 | includes: 6 | - "${device_name}/helpers" 7 | project: 8 | name: "esphome-powmr-hybrid-inverter" 9 | version: 1.3.3 10 | 11 | packages: 12 | inverter: !include { 13 | file: modules/inverter.yaml 14 | } 15 | # pzem: !include { 16 | # file: modules/pzem.yaml 17 | # } 18 | # debug: !include modules/debug.yaml 19 | 20 | logger: 21 | baud_rate: 0 22 | 23 | sensor: 24 | - platform: internal_temperature 25 | name: "Controller Temperature" 26 | update_interval: 10s 27 | state_class: measurement 28 | device_class: temperature 29 | -------------------------------------------------------------------------------- /helpers/myHelpers.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "esphome.h" 5 | #include "esphome/core/log.h" 6 | #include "myHelpers.h" 7 | 8 | uint16_t swapBytes(uint16_t value) 9 | { 10 | return (value << 8) | (value >> 8); 11 | } 12 | 13 | uint16_t swapBytes(std::string value) 14 | { 15 | uint16_t intValue = std::stoi(value); 16 | return (intValue << 8) | (intValue >> 8); 17 | } 18 | 19 | void updateUnknownSelect(uint16_t sensorIndex, esphome::modbus_controller::ModbusSelect* selectComp) 20 | { 21 | const char* logTag = "myHelpers"; 22 | if (!selectComp->active_index().has_value() || sensorIndex != selectComp->active_index().value()) { 23 | //esphome::ESP_LOGW(logTag, "Update select to index %d", sensorIndex); 24 | auto call = selectComp->make_call(); 25 | call.set_index(sensorIndex); 26 | call.perform(); 27 | } 28 | } 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/helpers/myHelpers.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "esphome.h" 5 | #include "esphome/core/log.h" 6 | #include "myHelpers.h" 7 | 8 | uint16_t swapBytes(uint16_t value) 9 | { 10 | return (value << 8) | (value >> 8); 11 | } 12 | 13 | uint16_t swapBytes(std::string value) 14 | { 15 | uint16_t intValue = std::stoi(value); 16 | return (intValue << 8) | (intValue >> 8); 17 | } 18 | 19 | void updateUnknownSelect(uint16_t sensorIndex, esphome::modbus_controller::ModbusSelect* selectComp) 20 | { 21 | const char* logTag = "myHelpers"; 22 | if (!selectComp->active_index().has_value() || sensorIndex != selectComp->active_index().value()) { 23 | //esphome::ESP_LOGW(logTag, "Update select to index %d", sensorIndex); 24 | auto call = selectComp->make_call(); 25 | call.set_index(sensorIndex); 26 | call.perform(); 27 | } 28 | } 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Andrii Ganzevych 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/modules/pzem.yaml: -------------------------------------------------------------------------------- 1 | uart: 2 | - id: uart_pzem 3 | baud_rate: 9600 4 | tx_pin: ${pzem_tx_pin} 5 | rx_pin: ${pzem_rx_pin} 6 | # debug: 7 | # direction: BOTH 8 | # dummy_receiver: false 9 | 10 | modbus: 11 | - id: modbus_pzem 12 | uart_id: uart_pzem 13 | 14 | sensor: 15 | - platform: pzemac 16 | modbus_id: modbus_pzem 17 | update_interval: ${pzem_update_interval} 18 | voltage: 19 | name: "Grid PZEM Voltage" 20 | id: pzem_grid_voltage 21 | internal: true 22 | filters: 23 | - &mafilter quantile: 24 | window_size: 5 25 | send_every: 1 26 | send_first_at: 1 27 | quantile: .9 28 | - offset: ${pzem_voltage_offset} 29 | current: 30 | name: "Grid Current" 31 | id: pzem_grid_current 32 | filters: 33 | - *mafilter 34 | - offset: ${pzem_current_offset} 35 | power: 36 | name: "Grid Power" 37 | id: pzem_grid_power 38 | internal: true 39 | filters: 40 | - *mafilter 41 | power_factor: 42 | name: "Grid Power Factor" 43 | id: pzem_grid_power_factor 44 | filters: 45 | - *mafilter 46 | 47 | - platform: template 48 | name: "Grid Power" 49 | unit_of_measurement: "W" 50 | device_class: power 51 | state_class: measurement 52 | accuracy_decimals: 0 53 | update_interval: ${update_interval} 54 | lambda: |- 55 | return id(pzem_grid_current).state * id(pzem_grid_voltage).state * id(pzem_grid_power_factor).state; 56 | -------------------------------------------------------------------------------- /my-inverter-card 3_2kW.yaml: -------------------------------------------------------------------------------- 1 | type: custom:sunsynk-power-flow-card 2 | cardstyle: full 3 | show_solar: false 4 | battery: 5 | energy: 5000 6 | max_power: 3000 7 | shutdown_soc: 20 8 | colour: '#9A64A0' 9 | show_daily: true 10 | invert_power: true 11 | show_absolute: false 12 | hide_soc: false 13 | show_remaining_energy: true 14 | dynamic_colour: true 15 | linear_gradient: true 16 | auto_scale: false 17 | solar: 18 | show_daily: true 19 | mppts: 1 20 | maxpower: your-panel-total-watts-here 21 | pv1_name: Solar PV 22 | auto_scale: true 23 | display_mode: 2 24 | dynamic_colour: true 25 | load: 26 | show_daily: true 27 | max_power: 2000 28 | show_daily_aux: true 29 | show_aux: false 30 | invert_aux: false 31 | show_absolute_aux: false 32 | aux_name: Generator 33 | aux_type: gen 34 | aux_colour: '#5490c2' 35 | aux_off_colour: brown 36 | aux_loads: 0 37 | aux_load1_icon: '' 38 | aux_load2_icon: '' 39 | animation_speed: 4 40 | essential_name: MyFlat 41 | additional_loads: 3 42 | load1_name: Kitchen 43 | load2_name: Bedroom 44 | load3_name: Lights 45 | load1_icon: mdi:gas-burner 46 | load2_icon: mdi:bed-outline 47 | load3_icon: mdi:light-flood-down 48 | load4_icon: '' 49 | auto_scale: true 50 | dynamic_icon: true 51 | dynamic_colour: true 52 | invert_load: false 53 | aux_dynamic_colour: true 54 | grid: 55 | grid_name: Utility Power 56 | max_power: 2000 57 | colour: '#FF2400' 58 | export_colour: green 59 | no_grid_colour: null 60 | grid_off_colour: '#e7d59f' 61 | show_daily_buy: true 62 | show_daily_sell: false 63 | show_nonessential: false 64 | invert_grid: false 65 | nonessential_name: Non Essential 66 | nonessential_icon: none 67 | additional_loads: 1 68 | load1_name: AirCon 69 | load2_name: EV 70 | load1_icon: mdi:fan 71 | load2_icon: mdi:car 72 | animation_speed: 7 73 | auto_scale: true 74 | dynamic_icon: true 75 | dynamic_colour: true 76 | energy_cost_decimals: 3 77 | entities: 78 | day_battery_charge_70: sensor.battery_charge_daily 79 | day_battery_discharge_71: sensor.battery_discharge_daily 80 | day_load_energy_84: sensor.my_inverter_load_consumed_daily 81 | day_grid_import_76: sensor.my_inverter_grid_imported_daily 82 | day_pv_energy_108: sensor.my_inverter_pv_yield_daily 83 | day_aux_energy: sensor.aircon_energy_daily_kwh 84 | inverter_voltage_154: sensor.my_inverter_load_voltage 85 | load_frequency_192: sensor.my_inverter_load_frequency 86 | grid_power_169: sensor.my_inverter_load_consumed_daily 87 | total_pv_generation: sensor.my_inverter_pv_yield_daily 88 | inverter_current_164: sensor.my_inverter_load_current 89 | inverter_power_175: sensor.my_inverter_load_power 90 | inverter_status_59: sensor.my_inverter_charger_status 91 | pv1_power_186: sensor.my_inverter_pv_power 92 | environment_temp: sensor._temp 93 | remaining_solar: sensor.energy_production_today_remaining 94 | pv1_voltage_109: sensor.my_inverter_pv_voltage 95 | pv1_current_110: sensor.my_inverter_pv_current 96 | battery_voltage_183: sensor.my_inverter_battery_voltage 97 | battery_soc_184: sensor.my_inverter_battery_soc 98 | battery_power_190: sensor.my_inverter_battery_power 99 | battery_current_191: sensor.my_inverter_battery_current 100 | essential_power: sensor.my_inverter_load_power 101 | essential_load1: sensor.kitchen_active_power 102 | essential_load2: sensor.bed_av__active_power 103 | essential_load1_extra: sensor.kitchen_temperature 104 | essential_load2_extra: sensor.bedroom_temperature 105 | load_power_L1: sensor.my_inverter_load_power 106 | nonessential_power: sensor.sunsynk_card_non_essential_active_power 107 | non_essential_load1: null 108 | non_essential_load2: null 109 | non_essential_load3: null 110 | grid_ct_power_172: sensor.my_inverter_grid_power 111 | grid_connected_status_194: sensor.my_inverter_grid_active 112 | aux_power_166: sensor.aircon_aux_active_power 113 | aux_load1_extra: sensor.caravan_internal_temperature 114 | aux_load2_extra: sensor.caravan_external_temperature 115 | grid_voltage: sensor.my_inverter_grid_voltage 116 | panel_mode: true 117 | large_font: false 118 | title: my Inverter - Power Monitor 119 | title_size: 12px 120 | show_battery: true 121 | show_grid: true 122 | decimal_places: 2 123 | dynamic_line_width: true 124 | max_line_width: 8 125 | inverter: 126 | modern: false 127 | colour: grey 128 | autarky: power 129 | auto_scale: true 130 | model: powmr 131 | three_phase: false 132 | -------------------------------------------------------------------------------- /my-inverter-card 6_2kW.yaml: -------------------------------------------------------------------------------- 1 | type: custom:sunsynk-power-flow-card 2 | cardstyle: full 3 | show_solar: true 4 | battery: 5 | energy: 14000 6 | max_power: 5000 7 | shutdown_soc: 20 8 | colour: "#9A64A0" 9 | show_daily: true 10 | invert_power: true 11 | show_absolute: false 12 | hide_soc: false 13 | show_remaining_energy: true 14 | dynamic_colour: true 15 | linear_gradient: true 16 | auto_scale: true 17 | animate: true 18 | solar: 19 | show_daily: true 20 | mppts: 1 21 | maxpower: 6500 22 | pv1_name: Solar PV 23 | auto_scale: true 24 | display_mode: 2 25 | dynamic_colour: true 26 | max_power: 6500 27 | pv1_max_power: 6500 28 | load: 29 | show_daily: true 30 | max_power: 6200 31 | show_daily_aux: true 32 | show_aux: false 33 | invert_aux: false 34 | show_absolute_aux: false 35 | aux_name: Generator 36 | aux_type: gen 37 | aux_colour: "#5490c2" 38 | aux_off_colour: brown 39 | aux_loads: 0 40 | aux_load1_icon: "" 41 | aux_load2_icon: "" 42 | animation_speed: 4 43 | essential_name: My Dacha 44 | additional_loads: 2 45 | load1_name: Бойлер Санвузол 46 | load2_name: Бойлер Кухня 47 | load3_name: Lights 48 | load2_icon: "" 49 | load3_icon: "" 50 | load4_icon: "" 51 | auto_scale: true 52 | dynamic_icon: true 53 | dynamic_colour: true 54 | invert_load: false 55 | aux_dynamic_colour: true 56 | grid: 57 | grid_name: Utility Power 58 | max_power: 6200 59 | colour: "#FF2400" 60 | export_colour: green 61 | no_grid_colour: null 62 | grid_off_colour: "#e7d59f" 63 | show_daily_buy: true 64 | show_daily_sell: false 65 | show_nonessential: true 66 | invert_grid: false 67 | nonessential_name: VA Load 68 | nonessential_icon: mdi:power 69 | additional_loads: 0 70 | load1_name: AirCon 71 | load2_name: EV 72 | load1_icon: mdi:fan 73 | load2_icon: mdi:car 74 | animation_speed: 7 75 | auto_scale: true 76 | dynamic_icon: true 77 | dynamic_colour: true 78 | energy_cost_decimals: 3 79 | entities: 80 | day_battery_charge_70: sensor.battery_charge_daily 81 | day_battery_discharge_71: sensor.battery_discharge_daily 82 | day_load_energy_84: sensor.my_inverter_load_consumed_daily 83 | day_grid_import_76: sensor.my_inverter_grid_imported_daily 84 | day_pv_energy_108: sensor.my_inverter_pv_yield_daily 85 | day_aux_energy: sensor.aircon_energy_daily_kwh 86 | inverter_voltage_154: sensor.my_inverter_load_voltage 87 | load_frequency_192: sensor.my_inverter_load_frequency 88 | grid_power_169: sensor.my_inverter_grid_power_pzem 89 | total_pv_generation: sensor.my_inverter_pv_yield_daily 90 | inverter_current_164: sensor.my_inverter_load_current 91 | inverter_power_175: sensor.my_inverter_load_power 92 | inverter_status_59: sensor.my_inverter_charger_status 93 | pv1_power_186: sensor.my_inverter_pv_power 94 | environment_temp: sensor._temp 95 | remaining_solar: sensor.energy_production_today_remaining 96 | pv1_voltage_109: sensor.my_inverter_pv_voltage 97 | pv1_current_110: sensor.my_inverter_pv_current 98 | battery_voltage_183: sensor.my_inverter_battery_voltage 99 | battery_soc_184: sensor.my_inverter_battery_soc 100 | battery_power_190: sensor.my_inverter_battery_power 101 | battery_current_191: sensor.my_inverter_battery_current 102 | essential_power: sensor.my_inverter_load_power 103 | essential_load1: sensor.boiler_sanvuzol_power 104 | essential_load1_extra: sensor.kitchen_temperature 105 | essential_load2_extra: sensor.bedroom_temperature 106 | load_power_L1: sensor.my_inverter_load_power 107 | non_essential_load1: null 108 | non_essential_load2: null 109 | non_essential_load3: null 110 | grid_ct_power_172: sensor.my_inverter_grid_power_pzem 111 | grid_connected_status_194: sensor.my_inverter_grid_active 112 | aux_power_166: sensor.aircon_aux_active_power 113 | aux_load1_extra: sensor.caravan_internal_temperature 114 | aux_load2_extra: sensor.caravan_external_temperature 115 | grid_voltage: sensor.my_inverter_grid_voltage_pzem 116 | essential_load2: sensor.boiler_kukhnia_power 117 | grid_ct_power_total: sensor.my_inverter_grid_power_va_pzem 118 | nonessential_power: sensor.my_inverter_grid_power_va_pzem 119 | panel_mode: true 120 | large_font: true 121 | title: My Inverter - Power Monitor 122 | title_size: 15px 123 | show_battery: true 124 | show_grid: true 125 | decimal_places: 2 126 | dynamic_line_width: true 127 | max_line_width: 15 128 | inverter: 129 | modern: false 130 | colour: grey 131 | autarky: power 132 | auto_scale: true 133 | model: powmr 134 | three_phase: false 135 | 136 | -------------------------------------------------------------------------------- /docs/registers-map.md: -------------------------------------------------------------------------------- 1 | # PowMr 2.4kW Inverter registers map 2 | 3 | ### Read registers 4 | - 4501 : Output Source Priority *(Returns index with offset. I'd prefer to use register 4537)* `settings` 5 | - 4502 : AC Voltage `measurement` 6 | - 4503 : AC Frequency `measurement` 7 | - 4504 : PV Voltage (?) `measurement` 8 | - 4505 : Charging *(right now)* `settings` 9 | - 4506 : Battery Voltage `measurement` 10 | - 4507 : Battery SoC `measurement` 11 | - 4508 : Battery Charge Current `measurement` 12 | - 4509 : Battery Discharge Current `measurement` 13 | - 4510 : Load Voltage `measurement` 14 | - 4511 : Load Frequency `measurement` 15 | - 4512 : Load VA Power `measurement` 16 | - 4513 : Load Power `measurement` 17 | - 4514 : Load Percent `measurement` 18 | - 4515 : Load Percent `measurement` 19 | - 4516 : Binary flags `binary_flags` 20 | * `0x100` Something overload related (?) 21 | - 4530 : Error Code 22 | - 4535 : Settings binary flags `binary_flags` 23 | * `0x1` Record Fault Code `settings` 24 | * `0x2` Battery Equalization `settings` 25 | * `0x4` Equalization Activated Immediately `settings` 26 | * `0x100` Alarm `settings` 27 | * `0x400` Backlight `settings` 28 | * `0x800` Restart On Overload `settings` 29 | * `0x1000` Restart On Overheat `settings` 30 | * `0x2000` Beep On Primary Source Fail `settings` 31 | * `0x4000` Return To Default Screen `settings` 32 | * `0x8000` Overload Bypass `settings` 33 | - 4536 : Charger Source Priority `settings` 34 | - 4537 : Output Source Priority *(More correct one)* `settings` 35 | - 4538 : AC Input Voltage Range `settings` 36 | - 4540 : Target Output Frequency `settings` 37 | - 4541 : Max Total Charging Current `settings` 38 | - 4542 : Target Output Voltage `settings` 39 | - 4543 : Max Utility Charging Current `settings` 40 | - 4544 : Back To Utility Source Voltage `settings` 41 | - 4545 : Back To Battery Source Voltage `settings` 42 | - 4546 : Bulk Charging Voltage `settings` 43 | - 4547 : Floating Charging Voltage `settings` 44 | - 4548 : Low CutOff Voltage `settings` 45 | - 4549 : Battery Equalization Voltage `settings` 46 | - 4550 : Battery Equalized Time `settings` 47 | - 4551 : Battery Equalized Timeout `settings` 48 | - 4552 : Equalization Interval `settings` 49 | - 4553 : Binary flags `binary_flags` 50 | * `0x100` On Battery 51 | * `0x200` AC Active 52 | * `0x1000` Load Off (Inverted "*Load Enabled*") 53 | * `0x2000` AC Active 54 | * `0x4000` Load Enabled 55 | - 4554 : Binary flags `binary_flags` 56 | * `0x1` On Battery 57 | * `0x100` AC Active 58 | * `0x8000` AC Active 59 | - 4555 : Charger Status *(0 - Off, 1 - Idle, 2 - Active)* 60 | - 4557 : Temperature sensor (**HVM3.6M confirmed**, **HVM2.4H not confirmed**) 61 | 62 | ### Write registers 63 | *( [+] means tested )* 64 | 65 | | Register | Description | HVM2.4H | 66 | |----------|-------------------------------------------------------------------------------------|---------| 67 | | 5002 | Buzzer Alarm (range 0-1, settings menu 18) | + | 68 | | 5004 | Backlight control (range 0-1, settings menu 20) | | 69 | | 5005 | Auto restart when overload occurs (range 0-1, settings menu 6) | | 70 | | 5006 | Auto restart when over temperature occurs (range 0-1, settings menu 7) | | 71 | | 5007 | Beep On Primary Source Fail (range 0-1, settings menu 22) | + | 72 | | 5008 | Auto return to default display screen (range 0-1, settings menu 19) | | 73 | | 5009 | Overload Bypass (0-1, settings menu 23) | + | 74 | | 5010 | Record fault code (range 0-1, settings menu 25) | | 75 | | 5017 | Charger Source Priority (range 0-3, settings menu 16) | + | 76 | | 5018 | Output Source Priority (range 0-2, settings menu 1) | + | 77 | | 5019 | AC input voltage range (range 0-1, settings menu 3) (0 - 90-280VAC, 1 - 170-280VAC) | | 78 | | 5020 | Battery type (range 0-2, settings menu 5) | | 79 | | 5021 | Output frequency (range 0-1, settings menu 9) (0 - 50hz, 1 - 60hz) | | 80 | | 5022 | Max Total Charge Current (range 10-80, settings menu 2) | + | 81 | | 5023 | Output voltage (one of 220, 230, 240, settings menu 10) | | 82 | | 5024 | Utility Charge Current (one of 2, 10, 20, 30, 40, 50, 60, settings menu 11) | + | 83 | | 5025 | Comeback Utility Mode Voltage (SBU) (0.5 volts step, settings menu 12) | | 84 | | 5026 | Comeback Battery Mode Voltage (SBU) (0.5 volts step, settings menu 13) | | 85 | | 5027 | Bulk charging voltage (settings menu 26) | | 86 | | 5028 | Floating charging voltage (settings menu 27) | | 87 | | 5029 | Low DC cut-off voltage (settings menu 29) | | 88 | | 5030 | Battery equalization voltage (settings menu 31) | | 89 | | 5031 | Battery equalized time (settings menu 33) | | 90 | | 5032 | Battery equalized timeout (settings menu 34) | | 91 | | 5033 | Equalization interval (settings menu 35) | | 92 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # My ESPHome PowMr Hybrid Inverter 2 | This is modifiyed updated version of ESPHome PowMr Hybrid Inverter(https://github.com/odya/esphome-powmr-hybrid-inverter). 3 | 4 | What was changed: 5 | 1. All sensors combined in one file. 6 | 2. Corrected query and calculation of Power and Power Factor 7 | 3. Optimied Modbus registers query: 8 | 1. 14 registers starting from 4502 9 | 2. 19 registers starting from 4516 10 | 3. 19 registers starting from 4539 11 | 4. config registers (starting from 5002) are read one by one in other case it will not read values. 12 | 13 | Known issues: 14 | 1. Using text_sensor instead of regular sensor lead to hang of ESP immidiatly after start. Root case unknown. 15 | 2. In some cases ESP hang after otp update via WiFI. 16 | 17 | ## Compatibility 18 | All models that are supported by the [**WIFI-VM**](https://powmr.com/products/powmr-wifi-module-with-rs232-remote-monitoring-solution-wifi-vm) device should work: 19 | 20 | - [**POW-HVM1.5H-12V**](https://powmr.com/products/all-in-one-inverter-charger-1500watt-220vac-12vdc) 21 | - **POW-HVM2.0H-12V** 22 | - [**POW-HVM2.4H-24V**](https://web.archive.org/web/20230329235125/https://powmr.com/inverters/all-in-one-inverter-chargers/powmr-2400watt-dc-24v-ac-220v-solar-inverter-charger) 23 | - [**POW-HVM3.2H-24V**](https://powmr.com/products/all-in-one-inverter-charger-3000w-220vac-24vdc) 24 | - [**POW-HVM3.6M-24V**](https://powmr.com/products/hybrid-inverter-charger-3600w-220vac-24vdc) 25 | - [**POW-HVM4.2M-24V**](https://powmr.com/products/hybrid-inverter-charger-4200w-220vac-24vdc) 26 | - [**POW-HVM6.2M-48V**](https://powmr.com/products/hybrid-inverter-charger-6200w-220vac-48vdc) 27 | - [**POW-HVM8.2M**](https://powmr.com/products/hybrid-inverter-charger-8000w-220vac-48vdc) 28 | - [**POW-HVM10.2M**](https://powmr.com/products/hybrid-inverter-charger-10200w-200vac-48vdc) 29 | 30 | ### Tested models 31 | 32 | - **POW-HVM3.2H-24V** 33 | - **POW-HVM6.2M-48V** 34 | 35 | ## Connection 36 | ![PowMr ESP32 connection diagram](images/powmr_esp32_connection.png "PowMr ESP32 connection diagram") 37 | 38 | ## ESP8266 39 | This configuration can be used on the ESP8266, but you won't be able to use all the sensors due to the memory limitations of the ESP8266. 40 | You can use minimal set of sensors/selects, leaving only the ones you need. You can use "Heap size" sensor of Debug module to determine how much free memory left. 41 | Looks like minimum heap size, that ensures stability, is near 6Kb. Although I still strongly recommend using ESP32. 42 | Also Ota upgrade might be failed due to absent of EEPROM memory for downloading update. In such case use USB or WEB firmare update. 43 | 44 | ## Usage 45 | 1) Create new project subdirectory within your ESPHome configuration directory (let it be `powmr-inverter`, for example) 46 | 2) Copy the contents of the `src` repo folder to a newly created project directory. 47 | 3) Now, the `main.yaml` file must be located under `/powmr-inverter` 48 | 4) Create file `powmr-inverter.yaml` in the esphome config directory root and copy contents of [example config](/examples/powmr-inverter.yaml) 49 | 5) Edit substitutions & customize `powmr-inverter.yaml`. You can add contents of [common_system](/examples/common_system.yaml) & [common_sensors](/examples/common_sensors.yaml) to this file or include them separately following the example. 50 | 6) Flash firmware to your ESP32 51 | 52 | 53 | ## PZEM module 54 | In version 1.2, a [PZEM](https://esphome.io/components/sensor/pzem004t) module was added for measuring parameters of the input AC grid. If you do not wish to use it, comment out the include of the corresponding module in the [main.yaml](/src/main.yaml) file. 55 | 56 | ## Inverter card 57 | For easy integration into Home Assistant, you can use the examples of inverter cards. 58 | The following custom plugins are required: [sunsynk-power-flow-card](https://github.com/slipx06/sunsynk-power-flow-card), [stack-in-card](https://github.com/custom-cards/stack-in-card), [tabbed-card](https://github.com/kinghat/tabbed-card), [canary](https://github.com/jcwillox/lovelace-canary). 59 | 60 | ## Optimize modbus communications 61 | ESPHome reads sequential Modbus registers in one batch. If you have gaps in register addresses, you need to use the `register_count` parameter to skip N registers and continue the batch. 62 | [Details in ESPHome docs](https://esphome.io/components/sensor/modbus_controller#modbus-register-count). 63 | 64 | You can debug your register ranges by setting the global log level to `VERBOSE` and muting all "noisy" components except the `modbus_controller`. 65 | ```yaml 66 | logger: 67 | level: VERBOSE 68 | logs: 69 | component: ERROR # Fix for issue #4717 "Component xxxxxx took a long time for an operation" 70 | modbus_controller: VERBOSE 71 | modbus_controller.text_sensor: WARN 72 | modbus_controller.sensor: WARN 73 | modbus_controller.binary_sensor: WARN 74 | modbus_controller.select: WARN 75 | ``` 76 | After this, the ranges map will be printed in the logs: 77 | ```text 78 | [15:55:14][C][modbus_controller:307]: ranges 79 | [18:41:21][C][modbus_controller:307]: ranges 80 | [18:41:21][C][modbus_controller:310]: Range type=3 start=0x1196 count=37 skip_updates=0 81 | [18:41:21][C][modbus_controller:310]: Range type=3 start=0x11BC count=16 skip_updates=0 82 | [18:41:21][C][modbus_controller:310]: Range type=3 start=0x138A count=1 skip_updates=2 83 | [18:41:21][C][modbus_controller:310]: Range type=3 start=0x138F count=1 skip_updates=2 84 | [18:41:21][C][modbus_controller:310]: Range type=3 start=0x1391 count=1 skip_updates=2 85 | [18:41:21][C][modbus_controller:310]: Range type=3 start=0x1399 count=1 skip_updates=2 86 | [18:41:21][C][modbus_controller:310]: Range type=3 start=0x139A count=1 skip_updates=2 87 | [18:41:21][C][modbus_controller:310]: Range type=3 start=0x139E count=1 skip_updates=2 88 | [18:41:21][C][modbus_controller:310]: Range type=3 start=0x13A0 count=1 skip_updates=2 89 | ``` 90 | > *In the example above, the sensor registers batches starts from `0x1196` & `0x11BC` (one large batch causes data errors). Select registers starts from `0x138A`.* 91 | > *Using batches for selects triggers `Modbus device set offline` warning messages, so you need to read them separately.* 92 | 93 | You will see gaps in register ranges map. To calculate `register_count`, you need to convert HEX addresses to decimal and subtract them. 94 | 95 | ## UART debugging 96 | - Uncomment debug section in [modules/inverter.yaml](/src/modules/inverter.yaml) or [modules/pzem.yaml](/src/modules/pzem.yaml) to enable the debug output of the UART component 97 | ``` 98 | # debug: 99 | # direction: BOTH 100 | # dummy_receiver: false 101 | ``` 102 | - Increase the log level to `DEBUG` or `VERBOSE` 103 | ``` 104 | logger: 105 | level: WARN 106 | ``` 107 | 108 | ## Notes 109 | - Registers map: [registers-map.md](docs/registers-map.md) 110 | - Read registers are using little-endian format that doesn't have a native support in ESPHome, so we need a custom function to swap bytes. 111 | - Inverter UART pins (TX2 & RX2) are swapped https://github.com/odya/esphome-powmr-hybrid-inverter/issues/25 112 | - Manuals: 113 | - [POW-HVM1.5H-12V](docs/POW-HVM2.4H-24V.pdf) 114 | - [POW-HVM2.4H-24V](docs/POW-HVM2.4H-24V.pdf) 115 | - [POW-HVM2.0H-12V](docs/POW-HVM3.2H-24V.pdf) 116 | - [POW-HVM3.2H-24V](docs/POW-HVM3.2H-24V.pdf) 117 | - [POW-HVM10.2M](docs/POW-HVM10.2M.pdf) 118 | 119 | ## References & thanks 120 | - https://github.com/odya/esphome-powmr-hybrid-inverter 121 | This is a source project. 122 | - https://github.com/leodesigner/powmr_comm 123 | Great research on PowMr registers and C++ firmware code with MQTT. Thanks to author, it helps me a lot. 124 | - https://github.com/syssi/esphome-smg-ii 125 | ESPHome project to monitor and control a ISolar/EASUN SMG II inverter via RS232 126 | -------------------------------------------------------------------------------- /src/modules/inverter.yaml: -------------------------------------------------------------------------------- 1 | uart: 2 | - id: uart_inverter 3 | baud_rate: 2400 4 | tx_pin: ${inverter_tx_pin} 5 | rx_pin: ${inverter_rx_pin} 6 | # debug: 7 | # direction: BOTH 8 | # dummy_receiver: false 9 | 10 | modbus: 11 | - id: modbus_inverter 12 | uart_id: uart_inverter 13 | send_wait_time: 250ms 14 | 15 | modbus_controller: 16 | - id: smg_inverter 17 | address: 0x05 18 | modbus_id: modbus_inverter 19 | setup_priority: -10 20 | offline_skip_updates: 100 21 | command_throttle: 1s 22 | update_interval: ${update_interval} 23 | 24 | sensor: 25 | 26 | ################################### 27 | # Read first group (44 registers) # 28 | ################################### 29 | 30 | - platform: modbus_controller 31 | modbus_controller_id: smg_inverter 32 | name: "Grid Voltage" 33 | address: 4502 34 | register_type: holding 35 | value_type: U_WORD 36 | unit_of_measurement: "V" 37 | device_class: voltage 38 | state_class: measurement 39 | accuracy_decimals: 1 40 | lambda: |- 41 | if (!id(grid_active).state) { 42 | return 0.0; 43 | } 44 | return swapBytes(x); 45 | filters: 46 | - multiply: 0.1 47 | - offset: ${inverter_voltage_offset} 48 | - heartbeat: 10s 49 | on_raw_value: 50 | then: 51 | - lambda: !lambda |- 52 | if (!id(grid_active).state) { 53 | id(pzem_grid_voltage).publish_state(0.0); 54 | id(pzem_grid_current).publish_state(${pzem_current_offset} * -1); 55 | id(pzem_grid_power).publish_state(0.0); 56 | id(pzem_grid_power_factor).publish_state(0.0); 57 | } 58 | 59 | 60 | - platform: modbus_controller 61 | modbus_controller_id: smg_inverter 62 | name: "Grid Frequency" 63 | address: 4503 64 | register_type: holding 65 | value_type: U_WORD 66 | unit_of_measurement: "Hz" 67 | device_class: frequency 68 | state_class: measurement 69 | accuracy_decimals: 1 70 | lambda: |- 71 | return swapBytes(x); 72 | filters: 73 | - multiply: 0.1 74 | 75 | - platform: modbus_controller 76 | modbus_controller_id: smg_inverter 77 | name: "PV Voltage" 78 | address: 4504 79 | register_type: holding 80 | value_type: U_WORD 81 | unit_of_measurement: "V" 82 | device_class: voltage 83 | state_class: measurement 84 | accuracy_decimals: 1 85 | lambda: |- 86 | return swapBytes(x); 87 | filters: 88 | - multiply: 0.1 89 | 90 | - platform: modbus_controller 91 | modbus_controller_id: smg_inverter 92 | name: "PV Power" 93 | address: 4505 94 | register_type: holding 95 | value_type: U_WORD 96 | unit_of_measurement: "W" 97 | device_class: power 98 | state_class: measurement 99 | accuracy_decimals: 1 100 | lambda: |- 101 | return swapBytes(x); 102 | 103 | - platform: modbus_controller 104 | modbus_controller_id: smg_inverter 105 | name: "Battery Voltage" 106 | id: battery_voltage 107 | address: 4506 108 | register_type: holding 109 | value_type: U_WORD 110 | unit_of_measurement: "V" 111 | device_class: voltage 112 | state_class: measurement 113 | accuracy_decimals: 2 114 | lambda: |- 115 | return swapBytes(x); 116 | filters: 117 | - multiply: 0.1 118 | 119 | - platform: modbus_controller 120 | modbus_controller_id: smg_inverter 121 | name: "Battery SoC" 122 | accuracy_decimals: 0 123 | unit_of_measurement: "%" 124 | device_class: battery 125 | address: 4507 126 | register_type: holding 127 | value_type: U_WORD 128 | state_class: measurement 129 | lambda: |- 130 | return swapBytes(x); 131 | 132 | - platform: modbus_controller 133 | modbus_controller_id: smg_inverter 134 | name: "Battery Charge Current" 135 | id: battery_charge_current 136 | address: 4508 137 | register_type: holding 138 | value_type: U_WORD 139 | unit_of_measurement: "A" 140 | device_class: current 141 | state_class: measurement 142 | accuracy_decimals: 1 143 | lambda: |- 144 | return swapBytes(x); 145 | 146 | - platform: modbus_controller 147 | modbus_controller_id: smg_inverter 148 | name: "Battery Discharge Current" 149 | id: battery_discharge_current 150 | address: 4509 151 | register_type: holding 152 | value_type: U_WORD 153 | unit_of_measurement: "A" 154 | device_class: current 155 | state_class: measurement 156 | accuracy_decimals: 1 157 | lambda: |- 158 | return swapBytes(x); 159 | 160 | - platform: template 161 | name: "Battery Current" 162 | id: battery_current 163 | unit_of_measurement: "A" 164 | device_class: current 165 | state_class: measurement 166 | accuracy_decimals: 1 167 | update_interval: ${update_interval} 168 | lambda: |- 169 | return id(battery_charge_current).state - id(battery_discharge_current).state; 170 | filters: 171 | - heartbeat: 10s 172 | 173 | - platform: template 174 | name: "Battery Power" 175 | unit_of_measurement: "W" 176 | device_class: power 177 | state_class: measurement 178 | accuracy_decimals: 0 179 | update_interval: ${update_interval} 180 | lambda: |- 181 | return id(battery_current).state * id(battery_voltage).state; 182 | 183 | - platform: modbus_controller 184 | modbus_controller_id: smg_inverter 185 | name: "Load Voltage" 186 | id: load_voltage 187 | address: 4510 188 | register_type: holding 189 | value_type: U_WORD 190 | unit_of_measurement: "V" 191 | device_class: voltage 192 | state_class: measurement 193 | accuracy_decimals: 1 194 | lambda: |- 195 | return swapBytes(x); 196 | filters: 197 | - multiply: 0.1 198 | 199 | - platform: modbus_controller 200 | modbus_controller_id: smg_inverter 201 | name: "Load Frequency" 202 | address: 4511 203 | register_type: holding 204 | value_type: U_WORD 205 | unit_of_measurement: "Hz" 206 | device_class: frequency 207 | state_class: measurement 208 | accuracy_decimals: 1 209 | lambda: |- 210 | return swapBytes(x); 211 | filters: 212 | - multiply: 0.1 213 | 214 | - platform: modbus_controller 215 | modbus_controller_id: smg_inverter 216 | name: "Load Power Internal" 217 | id: load_power_internal 218 | internal: true 219 | address: 4512 220 | register_type: holding 221 | value_type: U_WORD 222 | unit_of_measurement: "W" 223 | device_class: power 224 | state_class: measurement 225 | accuracy_decimals: 0 226 | lambda: |- 227 | return swapBytes(x); 228 | 229 | - platform: template 230 | name: "Load Power" 231 | id: load_power 232 | unit_of_measurement: "W" 233 | device_class: power 234 | state_class: measurement 235 | accuracy_decimals: 0 236 | update_interval: 10s 237 | lambda: |- 238 | return id(load_current).state * id(load_voltage).state; 239 | 240 | - platform: template 241 | name: "Load Current" 242 | id: load_current 243 | unit_of_measurement: "A" 244 | device_class: current 245 | state_class: measurement 246 | accuracy_decimals: 3 247 | update_interval: ${update_interval} 248 | lambda: |- 249 | if (id(load_voltage).state == 0) { 250 | return 0; 251 | } 252 | return id(load_va).state / id(load_voltage).state; 253 | 254 | - platform: template 255 | name: "Load Power Factor" 256 | id: load_power_factor 257 | device_class: power_factor 258 | state_class: measurement 259 | accuracy_decimals: 2 260 | update_interval: ${update_interval} 261 | lambda: |- 262 | if (id(load_va).state == 0) { 263 | return 0; 264 | } 265 | return id(load_power).state / id(load_va).state; 266 | 267 | - platform: modbus_controller 268 | modbus_controller_id: smg_inverter 269 | name: "Load VA" 270 | id: load_va 271 | address: 4513 272 | register_type: holding 273 | value_type: U_WORD 274 | unit_of_measurement: "VA" 275 | device_class: apparent_power 276 | state_class: measurement 277 | accuracy_decimals: 0 278 | lambda: |- 279 | return swapBytes(x); 280 | 281 | - platform: modbus_controller 282 | modbus_controller_id: smg_inverter 283 | name: "Load Percent" 284 | address: 4514 285 | register_count: 21 286 | register_type: holding 287 | value_type: U_WORD 288 | unit_of_measurement: "%" 289 | device_class: power_factor 290 | state_class: measurement 291 | lambda: |- 292 | return swapBytes(x); 293 | 294 | # 4535 -> binary 295 | 296 | # 4536 -> text 297 | 298 | # 4537 -> text 299 | 300 | # 4538 -> text 301 | 302 | - platform: modbus_controller 303 | modbus_controller_id: smg_inverter 304 | name: "Target Output Frequency" 305 | accuracy_decimals: 0 306 | entity_category: diagnostic 307 | address: 4540 308 | register_type: holding 309 | value_type: U_WORD 310 | unit_of_measurement: "Hz" 311 | lambda: |- 312 | uint16_t value = swapBytes(x); 313 | switch (value) { 314 | case 0: return std::uint16_t(50); 315 | case 1: return std::uint16_t(60); 316 | default: return x; 317 | } 318 | 319 | - platform: modbus_controller 320 | modbus_controller_id: smg_inverter 321 | name: "Max Total Charging Current" 322 | accuracy_decimals: 0 323 | entity_category: diagnostic 324 | address: 4541 325 | register_type: holding 326 | value_type: U_WORD 327 | unit_of_measurement: "A" 328 | lambda: |- 329 | return swapBytes(x); 330 | 331 | - platform: modbus_controller 332 | modbus_controller_id: smg_inverter 333 | name: "Target Output Voltage" 334 | accuracy_decimals: 0 335 | entity_category: diagnostic 336 | address: 4542 337 | register_type: holding 338 | value_type: U_WORD 339 | unit_of_measurement: "V" 340 | lambda: |- 341 | return swapBytes(x); 342 | 343 | - platform: modbus_controller 344 | modbus_controller_id: smg_inverter 345 | name: "Max Utility Charging Current" 346 | accuracy_decimals: 0 347 | entity_category: diagnostic 348 | address: 4543 349 | register_type: holding 350 | value_type: U_WORD 351 | unit_of_measurement: "A" 352 | lambda: |- 353 | return swapBytes(x); 354 | 355 | - platform: modbus_controller 356 | modbus_controller_id: smg_inverter 357 | name: "Back To Utility Source Voltage" 358 | filters: 359 | - multiply: 0.1 360 | accuracy_decimals: 1 361 | entity_category: diagnostic 362 | address: 4544 363 | register_type: holding 364 | value_type: U_WORD 365 | unit_of_measurement: "V" 366 | lambda: |- 367 | return swapBytes(x); 368 | 369 | - platform: modbus_controller 370 | modbus_controller_id: smg_inverter 371 | name: "Back To Battery Source Voltage" 372 | filters: 373 | - multiply: 0.1 374 | accuracy_decimals: 1 375 | entity_category: diagnostic 376 | address: 4545 377 | register_type: holding 378 | value_type: U_WORD 379 | unit_of_measurement: "V" 380 | lambda: |- 381 | return swapBytes(x); 382 | 383 | # #################################### 384 | # # Read second group (16 registers) # 385 | # #################################### 386 | 387 | - platform: modbus_controller 388 | modbus_controller_id: smg_inverter 389 | name: "Bulk Charging Voltage" 390 | filters: 391 | - multiply: 0.1 392 | accuracy_decimals: 1 393 | entity_category: diagnostic 394 | address: 4546 395 | register_type: holding 396 | value_type: U_WORD 397 | unit_of_measurement: "V" 398 | lambda: |- 399 | return swapBytes(x); 400 | 401 | - platform: modbus_controller 402 | modbus_controller_id: smg_inverter 403 | name: "Floating Charging Voltage" 404 | filters: 405 | - multiply: 0.1 406 | accuracy_decimals: 1 407 | entity_category: diagnostic 408 | address: 4547 409 | register_type: holding 410 | value_type: U_WORD 411 | unit_of_measurement: "V" 412 | lambda: |- 413 | return swapBytes(x); 414 | 415 | - platform: modbus_controller 416 | modbus_controller_id: smg_inverter 417 | name: "Low CutOff Voltage" 418 | filters: 419 | - multiply: 0.1 420 | accuracy_decimals: 1 421 | entity_category: diagnostic 422 | address: 4548 423 | register_type: holding 424 | value_type: U_WORD 425 | unit_of_measurement: "V" 426 | lambda: |- 427 | return swapBytes(x); 428 | 429 | - platform: modbus_controller 430 | modbus_controller_id: smg_inverter 431 | name: "Battery Equalization Voltage" 432 | filters: 433 | - multiply: 0.1 434 | accuracy_decimals: 1 435 | entity_category: diagnostic 436 | address: 4549 437 | register_type: holding 438 | value_type: U_WORD 439 | unit_of_measurement: "V" 440 | lambda: |- 441 | return swapBytes(x); 442 | 443 | - platform: modbus_controller 444 | modbus_controller_id: smg_inverter 445 | name: "Battery Equalized Time" 446 | accuracy_decimals: 0 447 | entity_category: diagnostic 448 | address: 4550 449 | register_type: holding 450 | value_type: U_WORD 451 | lambda: |- 452 | return swapBytes(x); 453 | 454 | - platform: modbus_controller 455 | modbus_controller_id: smg_inverter 456 | name: "Battery Equalized Timeout" 457 | accuracy_decimals: 0 458 | entity_category: diagnostic 459 | address: 4551 460 | register_type: holding 461 | value_type: U_WORD 462 | lambda: |- 463 | return swapBytes(x); 464 | 465 | - platform: modbus_controller 466 | modbus_controller_id: smg_inverter 467 | name: "Equalization Interval" 468 | accuracy_decimals: 0 469 | entity_category: diagnostic 470 | address: 4552 471 | register_type: holding 472 | value_type: U_WORD 473 | lambda: |- 474 | return swapBytes(x); 475 | 476 | # 4553 -> binary 477 | 478 | # 4554 -> binary 479 | 480 | # 4555 -> text 481 | 482 | binary_sensor: 483 | 484 | - platform: modbus_controller 485 | modbus_controller_id: smg_inverter 486 | name: "Record Fault Code" 487 | entity_category: diagnostic 488 | address: 4535 489 | register_type: holding 490 | bitmask: 0x1 491 | 492 | - platform: modbus_controller 493 | modbus_controller_id: smg_inverter 494 | name: "Battery Equalization" 495 | entity_category: diagnostic 496 | address: 4535 497 | register_type: holding 498 | bitmask: 0x2 499 | 500 | # - platform: modbus_controller 501 | # modbus_controller_id: smg_inverter 502 | # name: "Equalization Activated Immediately" 503 | # entity_category: diagnostic 504 | # address: 4535 505 | # register_type: holding 506 | # bitmask: 0x4 507 | 508 | - platform: modbus_controller 509 | modbus_controller_id: smg_inverter 510 | name: "Alarm" 511 | entity_category: diagnostic 512 | address: 4535 513 | register_type: holding 514 | bitmask: 0x100 515 | 516 | - platform: modbus_controller 517 | modbus_controller_id: smg_inverter 518 | name: "Backlight" 519 | entity_category: diagnostic 520 | address: 4535 521 | register_type: holding 522 | bitmask: 0x400 523 | 524 | - platform: modbus_controller 525 | modbus_controller_id: smg_inverter 526 | name: "Restart On Overload" 527 | entity_category: diagnostic 528 | address: 4535 529 | register_type: holding 530 | bitmask: 0x800 531 | 532 | - platform: modbus_controller 533 | modbus_controller_id: smg_inverter 534 | name: "Restart On Overheat" 535 | entity_category: diagnostic 536 | address: 4535 537 | register_type: holding 538 | bitmask: 0x1000 539 | 540 | - platform: modbus_controller 541 | modbus_controller_id: smg_inverter 542 | name: "Beep On Primary Source Fail" 543 | entity_category: diagnostic 544 | address: 4535 545 | register_type: holding 546 | bitmask: 0x2000 547 | 548 | # - platform: modbus_controller 549 | # modbus_controller_id: smg_inverter 550 | # name: "Return To Default Screen" 551 | # entity_category: diagnostic 552 | # address: 4535 553 | # register_type: holding 554 | # bitmask: 0x4000 555 | 556 | - platform: modbus_controller 557 | modbus_controller_id: smg_inverter 558 | name: "Overload Bypass" 559 | entity_category: diagnostic 560 | address: 4535 561 | register_type: holding 562 | bitmask: 0x8000 563 | 564 | - platform: modbus_controller 565 | modbus_controller_id: smg_inverter 566 | name: "Load Enabled" 567 | address: 4553 568 | register_type: holding 569 | bitmask: 0x4000 570 | 571 | - platform: modbus_controller 572 | modbus_controller_id: smg_inverter 573 | name: "Grid Active" 574 | id: grid_active 575 | address: 4554 576 | register_type: holding 577 | bitmask: 0x8000 578 | 579 | - platform: modbus_controller 580 | modbus_controller_id: smg_inverter 581 | name: "On Battery" 582 | address: 4554 583 | register_type: holding 584 | bitmask: 0x1 585 | 586 | text_sensor: 587 | 588 | - platform: modbus_controller 589 | modbus_controller_id: smg_inverter 590 | id: charger_source_priority_text 591 | name: "Charger Source Priority" 592 | entity_category: diagnostic 593 | address: 4536 594 | register_type: holding 595 | response_size: 2 596 | raw_encode: HEXBYTES 597 | lambda: |- 598 | uint16_t sensorIndex = swapBytes(modbus_controller::word_from_hex_str(x, 0)); 599 | updateUnknownSelect(sensorIndex, id(charger_source_priority_select)); 600 | switch (sensorIndex) { 601 | case 0: return std::string("Utility first"); 602 | case 1: return std::string("Solar first"); 603 | case 2: return std::string("Solar and Utility"); 604 | case 3: return std::string("Only solar"); 605 | default: return std::string(x); 606 | } 607 | 608 | - platform: modbus_controller 609 | modbus_controller_id: smg_inverter 610 | name: "Output Source Priority" 611 | entity_category: diagnostic 612 | address: 4537 613 | register_type: holding 614 | response_size: 2 615 | raw_encode: HEXBYTES 616 | lambda: |- 617 | uint16_t sensorIndex = swapBytes(modbus_controller::word_from_hex_str(x, 0)); 618 | updateUnknownSelect(sensorIndex, id(output_source_priority_select)); 619 | switch (sensorIndex) { 620 | case 0: return std::string("Utility first (USB)"); 621 | case 1: return std::string("Solar first (SUB)"); 622 | case 2: return std::string("SBU priority"); 623 | default: return std::string(x); 624 | } 625 | 626 | - platform: modbus_controller 627 | modbus_controller_id: smg_inverter 628 | name: "AC Input Voltage Range" 629 | entity_category: diagnostic 630 | address: 4538 631 | register_type: holding 632 | response_size: 2 633 | raw_encode: HEXBYTES 634 | lambda: |- 635 | uint16_t value = swapBytes(modbus_controller::word_from_hex_str(x, 0)); 636 | switch (value) { 637 | case 0: return std::string("Appliances"); 638 | case 1: return std::string("UPS"); 639 | default: return std::string(x); 640 | } 641 | 642 | - platform: modbus_controller 643 | modbus_controller_id: smg_inverter 644 | name: "Charger Status" 645 | address: 4555 646 | register_type: holding 647 | response_size: 2 648 | raw_encode: HEXBYTES 649 | lambda: |- 650 | uint16_t sensorIndex = swapBytes(modbus_controller::word_from_hex_str(x, 0)); 651 | switch (sensorIndex) { 652 | case 0: return std::string("Off"); 653 | case 1: return std::string("Idle"); 654 | case 2: return std::string("Charging"); 655 | default: return std::string(x); 656 | } 657 | 658 | select: 659 | 660 | - platform: modbus_controller 661 | name: "Buzzer Alarm" 662 | optimistic: true 663 | skip_updates: ${select_skip_updates} 664 | entity_category: config 665 | address: 5002 666 | value_type: U_WORD 667 | optionsmap: 668 | "Off": 0 669 | "On": 1 670 | 671 | - platform: modbus_controller 672 | name: "Beep On Primary Source Fail" 673 | optimistic: true 674 | skip_updates: ${select_skip_updates} 675 | entity_category: config 676 | address: 5007 677 | value_type: U_WORD 678 | optionsmap: 679 | "Off": 0 680 | "On": 1 681 | 682 | - platform: modbus_controller 683 | name: "Overload Bypass" 684 | optimistic: true 685 | skip_updates: ${select_skip_updates} 686 | entity_category: config 687 | address: 5009 688 | value_type: U_WORD 689 | optionsmap: 690 | "Off": 0 691 | "On": 1 692 | 693 | - platform: modbus_controller 694 | id: charger_source_priority_select 695 | name: "Charger Source Priority" 696 | optimistic: true 697 | skip_updates: ${select_skip_updates} 698 | force_new_range: true 699 | entity_category: config 700 | address: 5017 701 | value_type: U_WORD 702 | optionsmap: 703 | "Utility first": 0 704 | "Solar first": 1 705 | "Solar and Utility": 2 706 | "Only Solar": 3 707 | 708 | - platform: modbus_controller 709 | id: output_source_priority_select 710 | name: "Output Source Priority" 711 | optimistic: true 712 | skip_updates: ${select_skip_updates} 713 | entity_category: config 714 | address: 5018 715 | value_type: U_WORD 716 | optionsmap: 717 | "Utility first (USB)": 0 718 | "Solar first (SUB)": 1 719 | "SBU priority": 2 720 | 721 | - platform: modbus_controller 722 | name: "Max Total Charge Current" 723 | optimistic: true 724 | skip_updates: ${select_skip_updates} 725 | entity_category: config 726 | address: 5022 727 | value_type: U_WORD 728 | optionsmap: 729 | "10": 10 730 | "20": 20 731 | "30": 30 732 | "40": 40 733 | "50": 50 734 | "60": 60 735 | "70": 70 736 | "80": 80 737 | 738 | - platform: modbus_controller 739 | name: "Utility Charge Current" 740 | optimistic: true 741 | skip_updates: ${select_skip_updates} 742 | entity_category: config 743 | address: 5024 744 | value_type: U_WORD 745 | optionsmap: 746 | "10": 10 747 | "20": 20 748 | "30": 30 749 | "40": 40 750 | "50": 50 751 | "60": 60 752 | -------------------------------------------------------------------------------- /my-inverter 4_2kW.yaml: -------------------------------------------------------------------------------- 1 | substitutions: 2 | device_name: "my-inverter" 3 | friendly_name: My Inverter 4 | node_name: "My Inverter" 5 | node_id: powmr_inverter 6 | inverter_tx_pin: GPIO17 7 | #GPIO5 8 | inverter_rx_pin: GPIO16 9 | #GPIO4 10 | inverter_voltage_offset: "0" 11 | # pzem_tx_pin: GPIO1 12 | # pzem_rx_pin: GPIO3 13 | # pzem_voltage_offset: "1" 14 | # pzem_current_offset: "0.04" 15 | update_interval: 30s # Minimum 10s recommended to avoid duplicate command errors 16 | select_skip_updates: "2" 17 | # pzem_update_interval: 6s # Needs to be 1/5 of update interval because of smoothing filter on pzem readings 18 | 19 | esphome: 20 | name: "${device_name}" 21 | friendly_name: "${node_name}" 22 | comment: "Monitor and control of solar inverter" 23 | includes: 24 | - "powmr-inverter/helpers" 25 | project: 26 | name: "esphome.powmr-hybrid-inverter" 27 | version: 1.3.4 28 | 29 | esp32: 30 | board: esp32dev 31 | framework: 32 | type: arduino 33 | 34 | # Enable Home Assistant API 35 | api: 36 | encryption: 37 | key: !secret api_encryption_key 38 | 39 | 40 | ota: 41 | - platform: esphome 42 | password: !secret ota_password 43 | 44 | wifi: 45 | ssid: !secret wifi_ssid 46 | password: !secret wifi_password 47 | 48 | # Enable fallback hotspot (captive portal) in case wifi connection fails 49 | ap: 50 | ssid: "My-Inverter Fallback Hotspot" 51 | password: !secret ap_password 52 | 53 | captive_portal: 54 | 55 | packages: 56 | # You can replace next 2 lines with your common configs for all devices 57 | common_system: !include includes/common_system.yaml 58 | common_sensors: !include includes/common_sensors.yaml 59 | 60 | #packages: 61 | # pzem: !include { 62 | # file: powmr-inverter/modules/pzem.yaml 63 | # } 64 | #For debug: 65 | #debug: 66 | # update_interval: 10s 67 | 68 | #sensor: 69 | # - platform: debug 70 | # free: 71 | # name: "Heap Free" 72 | 73 | logger: 74 | id: uart_logger 75 | baud_rate: 0 76 | level: WARN #DEBUG #VERBOSE 77 | # logs: 78 | # component: ERROR # Fix for issue #4717 "Component xxxxxx took a long time for an operation" 79 | 80 | time: 81 | - platform: homeassistant 82 | id: hass_time 83 | 84 | web_server: 85 | port: 80 86 | local: true 87 | # ota: false 88 | 89 | uart: 90 | - id: uart_inverter 91 | baud_rate: 2400 92 | tx_pin: ${inverter_tx_pin} 93 | rx_pin: ${inverter_rx_pin} 94 | debug: 95 | direction: BOTH 96 | dummy_receiver: false 97 | after: 98 | delimiter: "\n" 99 | sequence: 100 | - lambda: UARTDebug::log_string(direction, bytes); 101 | 102 | modbus: 103 | - id: modbus_inverter 104 | uart_id: uart_inverter 105 | send_wait_time: 250ms 106 | 107 | modbus_controller: 108 | - id: smg_inverter 109 | address: 0x05 110 | modbus_id: modbus_inverter 111 | setup_priority: -10 112 | offline_skip_updates: 100 113 | command_throttle: 1s 114 | update_interval: ${update_interval} 115 | 116 | switch: 117 | - platform: restart 118 | name: "Invertor Restart" 119 | sensor: 120 | # - platform: template 121 | # name: "Grid Power VA" 122 | # unit_of_measurement: "W" 123 | # device_class: power 124 | # state_class: measurement 125 | # accuracy_decimals: 0 126 | # update_interval: ${update_interval} 127 | # lambda: |- 128 | # return id(pzem_grid_current).state * id(pzem_grid_voltage).state; 129 | 130 | # - platform: template 131 | # name: "Grid Power VA*PF" 132 | # unit_of_measurement: "W" 133 | # device_class: power 134 | # state_class: measurement 135 | # accuracy_decimals: 0 136 | # update_interval: ${update_interval} 137 | # lambda: |- 138 | # return id(pzem_grid_current).state * id(pzem_grid_voltage).state * id(pzem_grid_power_factor).state; 139 | 140 | ################################### 141 | # Read first group (14 registers) # 142 | ################################### 143 | 144 | - platform: modbus_controller 145 | modbus_controller_id: smg_inverter 146 | name: "Grid Voltage" 147 | address: 4502 148 | register_type: holding 149 | register_count: 14 150 | force_new_range: true 151 | value_type: U_WORD 152 | unit_of_measurement: "V" 153 | device_class: voltage 154 | state_class: measurement 155 | accuracy_decimals: 1 156 | lambda: |- 157 | if (!id(grid_active).state) { 158 | return 0.0; 159 | } 160 | return swapBytes(x); 161 | filters: 162 | - multiply: 0.1 163 | - offset: ${inverter_voltage_offset} 164 | # - heartbeat: 10s 165 | 166 | - platform: modbus_controller 167 | modbus_controller_id: smg_inverter 168 | name: "Grid Frequency" 169 | address: 4503 170 | register_type: holding 171 | value_type: U_WORD 172 | unit_of_measurement: "Hz" 173 | device_class: frequency 174 | state_class: measurement 175 | accuracy_decimals: 1 176 | lambda: |- 177 | return swapBytes(x); 178 | filters: 179 | - multiply: 0.1 180 | 181 | - platform: modbus_controller 182 | modbus_controller_id: smg_inverter 183 | name: "PV Voltage" 184 | address: 4504 185 | register_type: holding 186 | value_type: U_WORD 187 | unit_of_measurement: "V" 188 | device_class: voltage 189 | state_class: measurement 190 | accuracy_decimals: 1 191 | lambda: |- 192 | return swapBytes(x); 193 | filters: 194 | - multiply: 0.1 195 | 196 | - platform: modbus_controller 197 | modbus_controller_id: smg_inverter 198 | name: "PV Power" 199 | address: 4505 200 | register_type: holding 201 | value_type: U_WORD 202 | unit_of_measurement: "W" 203 | device_class: power 204 | state_class: measurement 205 | accuracy_decimals: 1 206 | lambda: |- 207 | return swapBytes(x); 208 | 209 | - platform: modbus_controller 210 | modbus_controller_id: smg_inverter 211 | name: "Battery Voltage" 212 | id: battery_voltage 213 | address: 4506 214 | register_type: holding 215 | value_type: U_WORD 216 | unit_of_measurement: "V" 217 | device_class: voltage 218 | state_class: measurement 219 | accuracy_decimals: 2 220 | lambda: |- 221 | return swapBytes(x); 222 | filters: 223 | - multiply: 0.1 224 | 225 | - platform: modbus_controller 226 | modbus_controller_id: smg_inverter 227 | name: "Battery SoC" 228 | accuracy_decimals: 0 229 | unit_of_measurement: "%" 230 | device_class: battery 231 | address: 4507 232 | register_type: holding 233 | value_type: U_WORD 234 | state_class: measurement 235 | lambda: |- 236 | return swapBytes(x); 237 | 238 | - platform: modbus_controller 239 | modbus_controller_id: smg_inverter 240 | name: "Battery Charge Current" 241 | id: battery_charge_current 242 | address: 4508 243 | register_type: holding 244 | value_type: U_WORD 245 | unit_of_measurement: "A" 246 | device_class: current 247 | state_class: measurement 248 | accuracy_decimals: 1 249 | lambda: |- 250 | return swapBytes(x); 251 | 252 | - platform: modbus_controller 253 | modbus_controller_id: smg_inverter 254 | name: "Battery Discharge Current" 255 | id: battery_discharge_current 256 | address: 4509 257 | register_type: holding 258 | value_type: U_WORD 259 | unit_of_measurement: "A" 260 | device_class: current 261 | state_class: measurement 262 | accuracy_decimals: 1 263 | lambda: |- 264 | return swapBytes(x); 265 | 266 | - platform: template 267 | name: "Battery Current" 268 | id: battery_current 269 | unit_of_measurement: "A" 270 | device_class: current 271 | state_class: measurement 272 | accuracy_decimals: 1 273 | update_interval: ${update_interval} 274 | lambda: |- 275 | return id(battery_charge_current).state - id(battery_discharge_current).state; 276 | # filters: 277 | # - heartbeat: 10s 278 | 279 | - platform: template 280 | name: "Battery Power" 281 | unit_of_measurement: "W" 282 | device_class: power 283 | state_class: measurement 284 | accuracy_decimals: 0 285 | update_interval: ${update_interval} 286 | lambda: |- 287 | return id(battery_current).state * id(battery_voltage).state; 288 | 289 | - platform: modbus_controller 290 | modbus_controller_id: smg_inverter 291 | name: "Load Voltage" 292 | id: load_voltage 293 | address: 4510 294 | register_type: holding 295 | value_type: U_WORD 296 | unit_of_measurement: "V" 297 | device_class: voltage 298 | state_class: measurement 299 | accuracy_decimals: 1 300 | lambda: |- 301 | return swapBytes(x); 302 | filters: 303 | - multiply: 0.1 304 | 305 | - platform: modbus_controller 306 | modbus_controller_id: smg_inverter 307 | name: "Load Frequency" 308 | address: 4511 309 | register_type: holding 310 | value_type: U_WORD 311 | unit_of_measurement: "Hz" 312 | device_class: frequency 313 | state_class: measurement 314 | accuracy_decimals: 1 315 | lambda: |- 316 | return swapBytes(x); 317 | filters: 318 | - multiply: 0.1 319 | 320 | - platform: modbus_controller 321 | modbus_controller_id: smg_inverter 322 | name: "Load Power VA" 323 | id: load_Power_VA 324 | address: 4512 325 | register_type: holding 326 | value_type: U_WORD 327 | unit_of_measurement: "VA" 328 | device_class: apparent_power 329 | state_class: measurement 330 | accuracy_decimals: 0 331 | lambda: |- 332 | return swapBytes(x); 333 | 334 | - platform: modbus_controller 335 | modbus_controller_id: smg_inverter 336 | name: "Load Power" 337 | id: load_power 338 | address: 4513 339 | register_type: holding 340 | value_type: U_WORD 341 | unit_of_measurement: "W" 342 | device_class: power 343 | state_class: measurement 344 | accuracy_decimals: 0 345 | lambda: |- 346 | return swapBytes(x); 347 | 348 | 349 | - platform: template 350 | name: "Load Current" 351 | id: load_current 352 | unit_of_measurement: "A" 353 | device_class: current 354 | state_class: measurement 355 | accuracy_decimals: 3 356 | update_interval: ${update_interval} 357 | lambda: |- 358 | if (id(load_voltage).state == 0) { 359 | return 0; 360 | } 361 | return id(load_Power_VA).state / id(load_voltage).state; 362 | 363 | 364 | - platform: template 365 | name: "Load Power Factor" 366 | id: load_power_factor 367 | device_class: power_factor 368 | state_class: measurement 369 | accuracy_decimals: 2 370 | update_interval: ${update_interval} 371 | lambda: |- 372 | if (id(load_power).state == 0) { 373 | return 0; 374 | } 375 | return id(load_power).state / id(load_Power_VA).state; 376 | 377 | 378 | 379 | - platform: modbus_controller 380 | modbus_controller_id: smg_inverter 381 | name: "Load Percent" 382 | address: 4514 383 | #register_count: 21 384 | register_type: holding 385 | value_type: U_WORD 386 | unit_of_measurement: "%" 387 | device_class: power_factor 388 | state_class: measurement 389 | lambda: |- 390 | return swapBytes(x); 391 | 392 | - platform: modbus_controller 393 | modbus_controller_id: smg_inverter 394 | name: "Load Percent2" 395 | address: 4515 396 | register_type: holding 397 | value_type: U_WORD 398 | unit_of_measurement: "%" 399 | device_class: power_factor 400 | state_class: measurement 401 | lambda: |- 402 | return swapBytes(x); 403 | 404 | # #################################### 405 | # # Read second group (19 registers) # 406 | # #################################### 407 | 408 | 409 | - platform: modbus_controller 410 | modbus_controller_id: smg_inverter 411 | name: "Unknown4516" 412 | address: 4516 413 | register_count: 19 414 | force_new_range: true 415 | register_type: holding 416 | value_type: U_WORD 417 | # unit_of_measurement: "%" 418 | device_class: power_factor 419 | state_class: measurement 420 | lambda: |- 421 | return swapBytes(x); 422 | 423 | - platform: modbus_controller 424 | modbus_controller_id: smg_inverter 425 | name: "Unknown4517" 426 | address: 4517 427 | register_type: holding 428 | value_type: U_WORD 429 | # unit_of_measurement: "%" 430 | device_class: power_factor 431 | state_class: measurement 432 | lambda: |- 433 | return swapBytes(x); 434 | 435 | - platform: modbus_controller 436 | modbus_controller_id: smg_inverter 437 | name: "Unknown4518" 438 | address: 4518 439 | register_type: holding 440 | value_type: U_WORD 441 | # unit_of_measurement: "%" 442 | device_class: power_factor 443 | state_class: measurement 444 | lambda: |- 445 | return swapBytes(x); 446 | 447 | - platform: modbus_controller 448 | modbus_controller_id: smg_inverter 449 | name: "Unknown4519" 450 | address: 4519 451 | register_type: holding 452 | value_type: U_WORD 453 | # unit_of_measurement: "%" 454 | device_class: power_factor 455 | state_class: measurement 456 | lambda: |- 457 | return swapBytes(x); 458 | 459 | - platform: modbus_controller 460 | modbus_controller_id: smg_inverter 461 | name: "Unknown4520" 462 | address: 4520 463 | register_type: holding 464 | value_type: U_WORD 465 | # unit_of_measurement: "%" 466 | device_class: power_factor 467 | state_class: measurement 468 | lambda: |- 469 | return swapBytes(x); 470 | 471 | - platform: modbus_controller 472 | modbus_controller_id: smg_inverter 473 | name: "Unknown4521" 474 | address: 4521 475 | register_type: holding 476 | value_type: U_WORD 477 | # unit_of_measurement: "%" 478 | device_class: power_factor 479 | state_class: measurement 480 | lambda: |- 481 | return swapBytes(x); 482 | 483 | - platform: modbus_controller 484 | modbus_controller_id: smg_inverter 485 | name: "Unknown4522" 486 | address: 4522 487 | register_type: holding 488 | value_type: U_WORD 489 | # unit_of_measurement: "%" 490 | device_class: power_factor 491 | state_class: measurement 492 | lambda: |- 493 | return swapBytes(x); 494 | 495 | - platform: modbus_controller 496 | modbus_controller_id: smg_inverter 497 | name: "Unknown4523" 498 | address: 4523 499 | register_type: holding 500 | value_type: U_WORD 501 | # unit_of_measurement: "%" 502 | device_class: power_factor 503 | state_class: measurement 504 | lambda: |- 505 | return swapBytes(x); 506 | 507 | - platform: modbus_controller 508 | modbus_controller_id: smg_inverter 509 | name: "Unknown4524" 510 | address: 4524 511 | register_type: holding 512 | value_type: U_WORD 513 | # unit_of_measurement: "%" 514 | device_class: power_factor 515 | state_class: measurement 516 | lambda: |- 517 | return swapBytes(x); 518 | 519 | - platform: modbus_controller 520 | modbus_controller_id: smg_inverter 521 | name: "Unknown4525" 522 | address: 4525 523 | register_type: holding 524 | value_type: U_WORD 525 | # unit_of_measurement: "%" 526 | device_class: power_factor 527 | state_class: measurement 528 | lambda: |- 529 | return swapBytes(x); 530 | 531 | - platform: modbus_controller 532 | modbus_controller_id: smg_inverter 533 | name: "Unknown4526" 534 | address: 4526 535 | register_type: holding 536 | value_type: U_WORD 537 | # unit_of_measurement: "%" 538 | device_class: power_factor 539 | state_class: measurement 540 | lambda: |- 541 | return swapBytes(x); 542 | 543 | - platform: modbus_controller 544 | modbus_controller_id: smg_inverter 545 | name: "Unknown4527" 546 | address: 4527 547 | register_type: holding 548 | value_type: U_WORD 549 | # unit_of_measurement: "%" 550 | device_class: power_factor 551 | state_class: measurement 552 | lambda: |- 553 | return swapBytes(x); 554 | 555 | - platform: modbus_controller 556 | modbus_controller_id: smg_inverter 557 | name: "Unknown4528" 558 | address: 4528 559 | register_type: holding 560 | value_type: U_WORD 561 | # unit_of_measurement: "%" 562 | device_class: power_factor 563 | state_class: measurement 564 | lambda: |- 565 | return swapBytes(x); 566 | 567 | - platform: modbus_controller 568 | modbus_controller_id: smg_inverter 569 | name: "Unknown4529" 570 | address: 4529 571 | register_type: holding 572 | value_type: U_WORD 573 | # unit_of_measurement: "%" 574 | device_class: power_factor 575 | state_class: measurement 576 | lambda: |- 577 | return swapBytes(x); 578 | 579 | - platform: modbus_controller 580 | modbus_controller_id: smg_inverter 581 | name: "Unknown4530" 582 | address: 4530 583 | register_type: holding 584 | value_type: U_WORD 585 | # unit_of_measurement: "%" 586 | device_class: power_factor 587 | state_class: measurement 588 | lambda: |- 589 | return swapBytes(x); 590 | 591 | - platform: modbus_controller 592 | modbus_controller_id: smg_inverter 593 | name: "Unknown4531" 594 | address: 4531 595 | register_type: holding 596 | value_type: U_WORD 597 | # unit_of_measurement: "%" 598 | device_class: power_factor 599 | state_class: measurement 600 | lambda: |- 601 | return swapBytes(x); 602 | 603 | - platform: modbus_controller 604 | modbus_controller_id: smg_inverter 605 | name: "Unknown4532" 606 | address: 4532 607 | register_type: holding 608 | value_type: U_WORD 609 | # unit_of_measurement: "%" 610 | device_class: power_factor 611 | state_class: measurement 612 | lambda: |- 613 | return swapBytes(x); 614 | 615 | - platform: modbus_controller 616 | modbus_controller_id: smg_inverter 617 | name: "Unknown4533" 618 | address: 4533 619 | register_type: holding 620 | value_type: U_WORD 621 | # unit_of_measurement: "%" 622 | device_class: power_factor 623 | state_class: measurement 624 | lambda: |- 625 | return swapBytes(x); 626 | 627 | - platform: modbus_controller 628 | modbus_controller_id: smg_inverter 629 | name: "Unknown4534" 630 | address: 4534 631 | register_type: holding 632 | value_type: U_WORD 633 | # unit_of_measurement: "%" 634 | device_class: power_factor 635 | state_class: measurement 636 | lambda: |- 637 | return swapBytes(x); 638 | # 4535 -> binary 639 | 640 | # 4536 -> text 641 | 642 | # 4537 -> text 643 | 644 | # 4538 -> text 645 | 646 | # - platform: modbus_controller 647 | # modbus_controller_id: smg_inverter 648 | # name: "Charger Source Priority" 649 | # address: 4536 650 | # register_type: holding 651 | # value_type: U_WORD 652 | # unit_of_measurement: "%" 653 | # device_class: power_factor 654 | # state_class: measurement 655 | # lambda: |- 656 | # return swapBytes(x); 657 | 658 | # - platform: modbus_controller 659 | # modbus_controller_id: smg_inverter 660 | # name: "Output Source Priority" 661 | # address: 4537 662 | # register_type: holding 663 | # value_type: U_WORD 664 | # unit_of_measurement: "%" 665 | # device_class: power_factor 666 | # state_class: measurement 667 | # lambda: |- 668 | # return swapBytes(x); 669 | 670 | # - platform: modbus_controller 671 | # modbus_controller_id: smg_inverter 672 | # name: "AC Input Voltage Range" 673 | # address: 4538 674 | # register_type: holding 675 | # value_type: U_WORD 676 | # unit_of_measurement: "%" 677 | # device_class: power_factor 678 | # state_class: measurement 679 | # lambda: |- 680 | # return swapBytes(x); 681 | 682 | - platform: modbus_controller 683 | modbus_controller_id: smg_inverter 684 | name: "Charger Source Priority" 685 | address: 4536 686 | register_type: holding 687 | value_type: U_WORD 688 | # unit_of_measurement: "%" 689 | device_class: power_factor 690 | state_class: measurement 691 | lambda: |- 692 | return swapBytes(x); 693 | 694 | - platform: modbus_controller 695 | modbus_controller_id: smg_inverter 696 | name: "Output Source Priority" 697 | address: 4537 698 | register_type: holding 699 | value_type: U_WORD 700 | # unit_of_measurement: "%" 701 | device_class: power_factor 702 | state_class: measurement 703 | lambda: |- 704 | return swapBytes(x); 705 | 706 | - platform: modbus_controller 707 | modbus_controller_id: smg_inverter 708 | name: "AC Input Voltage Range" 709 | address: 4538 710 | register_type: holding 711 | value_type: U_WORD 712 | # unit_of_measurement: "%" 713 | device_class: power_factor 714 | state_class: measurement 715 | lambda: |- 716 | return swapBytes(x); 717 | 718 | # #################################### 719 | # # Read third group (19 registers) # 720 | # #################################### 721 | 722 | - platform: modbus_controller 723 | modbus_controller_id: smg_inverter 724 | name: "Unknown4539" 725 | address: 4539 726 | force_new_range: true 727 | register_count: 14 728 | register_type: holding 729 | value_type: U_WORD 730 | # unit_of_measurement: "%" 731 | device_class: power_factor 732 | state_class: measurement 733 | lambda: |- 734 | return swapBytes(x); 735 | 736 | - platform: modbus_controller 737 | modbus_controller_id: smg_inverter 738 | name: "Target Output Frequency" 739 | accuracy_decimals: 0 740 | entity_category: diagnostic 741 | address: 4540 742 | register_type: holding 743 | value_type: U_WORD 744 | unit_of_measurement: "Hz" 745 | lambda: |- 746 | uint16_t value = swapBytes(x); 747 | switch (value) { 748 | case 0: return std::uint16_t(50); 749 | case 1: return std::uint16_t(60); 750 | default: return x; 751 | } 752 | 753 | - platform: modbus_controller 754 | modbus_controller_id: smg_inverter 755 | name: "Max Total Charging Current" 756 | accuracy_decimals: 0 757 | entity_category: diagnostic 758 | address: 4541 759 | register_type: holding 760 | value_type: U_WORD 761 | unit_of_measurement: "A" 762 | lambda: |- 763 | return swapBytes(x); 764 | 765 | - platform: modbus_controller 766 | modbus_controller_id: smg_inverter 767 | name: "Target Output Voltage" 768 | accuracy_decimals: 0 769 | entity_category: diagnostic 770 | address: 4542 771 | register_type: holding 772 | value_type: U_WORD 773 | unit_of_measurement: "V" 774 | lambda: |- 775 | return swapBytes(x); 776 | 777 | - platform: modbus_controller 778 | modbus_controller_id: smg_inverter 779 | name: "Max Utility Charging Current" 780 | accuracy_decimals: 0 781 | entity_category: diagnostic 782 | address: 4543 783 | register_type: holding 784 | value_type: U_WORD 785 | unit_of_measurement: "A" 786 | lambda: |- 787 | return swapBytes(x); 788 | 789 | - platform: modbus_controller 790 | modbus_controller_id: smg_inverter 791 | name: "Back To Utility Source Voltage" 792 | filters: 793 | - multiply: 0.1 794 | accuracy_decimals: 1 795 | entity_category: diagnostic 796 | address: 4544 797 | register_type: holding 798 | value_type: U_WORD 799 | unit_of_measurement: "V" 800 | lambda: |- 801 | return swapBytes(x); 802 | 803 | - platform: modbus_controller 804 | modbus_controller_id: smg_inverter 805 | name: "Back To Battery Source Voltage" 806 | filters: 807 | - multiply: 0.1 808 | accuracy_decimals: 1 809 | entity_category: diagnostic 810 | address: 4545 811 | register_type: holding 812 | value_type: U_WORD 813 | unit_of_measurement: "V" 814 | lambda: |- 815 | return swapBytes(x); 816 | 817 | - platform: modbus_controller 818 | modbus_controller_id: smg_inverter 819 | name: "Bulk Charging Voltage" 820 | filters: 821 | - multiply: 0.1 822 | accuracy_decimals: 1 823 | entity_category: diagnostic 824 | address: 4546 825 | register_type: holding 826 | value_type: U_WORD 827 | unit_of_measurement: "V" 828 | lambda: |- 829 | return swapBytes(x); 830 | 831 | - platform: modbus_controller 832 | modbus_controller_id: smg_inverter 833 | name: "Floating Charging Voltage" 834 | filters: 835 | - multiply: 0.1 836 | accuracy_decimals: 1 837 | entity_category: diagnostic 838 | address: 4547 839 | register_type: holding 840 | value_type: U_WORD 841 | unit_of_measurement: "V" 842 | lambda: |- 843 | return swapBytes(x); 844 | 845 | - platform: modbus_controller 846 | modbus_controller_id: smg_inverter 847 | name: "Low CutOff Voltage" 848 | filters: 849 | - multiply: 0.1 850 | accuracy_decimals: 1 851 | entity_category: diagnostic 852 | address: 4548 853 | register_type: holding 854 | value_type: U_WORD 855 | unit_of_measurement: "V" 856 | lambda: |- 857 | return swapBytes(x); 858 | 859 | - platform: modbus_controller 860 | modbus_controller_id: smg_inverter 861 | name: "Battery Equalization Voltage" 862 | filters: 863 | - multiply: 0.1 864 | accuracy_decimals: 1 865 | entity_category: diagnostic 866 | address: 4549 867 | register_type: holding 868 | value_type: U_WORD 869 | unit_of_measurement: "V" 870 | lambda: |- 871 | return swapBytes(x); 872 | 873 | - platform: modbus_controller 874 | modbus_controller_id: smg_inverter 875 | name: "Battery Equalized Time" 876 | accuracy_decimals: 0 877 | entity_category: diagnostic 878 | address: 4550 879 | register_type: holding 880 | value_type: U_WORD 881 | lambda: |- 882 | return swapBytes(x); 883 | 884 | - platform: modbus_controller 885 | modbus_controller_id: smg_inverter 886 | name: "Battery Equalized Timeout" 887 | accuracy_decimals: 0 888 | entity_category: diagnostic 889 | address: 4551 890 | register_type: holding 891 | value_type: U_WORD 892 | lambda: |- 893 | return swapBytes(x); 894 | 895 | - platform: modbus_controller 896 | modbus_controller_id: smg_inverter 897 | name: "Equalization Interval" 898 | accuracy_decimals: 0 899 | entity_category: diagnostic 900 | address: 4552 901 | register_type: holding 902 | value_type: U_WORD 903 | lambda: |- 904 | return swapBytes(x); 905 | 906 | # 4553 -> binary 907 | 908 | # 4554 -> binary 909 | 910 | # 4555 -> text 911 | 912 | - platform: modbus_controller 913 | modbus_controller_id: smg_inverter 914 | name: "Charger Status" 915 | accuracy_decimals: 0 916 | entity_category: diagnostic 917 | address: 4555 918 | register_type: holding 919 | value_type: U_WORD 920 | lambda: |- 921 | return swapBytes(x); 922 | 923 | #text_sensor: 924 | # - platform: modbus_controller 925 | # modbus_controller_id: smg_inverter 926 | # force_new_range: true 927 | # register_count: 3 928 | # name: "Charger Source Priority" 929 | # address: 4536 930 | # register_type: holding 931 | # lambda: |- 932 | # uint16_t value = swapBytes(x); 933 | # switch (value) { 934 | # case 0: return std::string("Utility first"); 935 | # case 1: return std::string("Solar first"); 936 | # case 2: return std::string("Solar and Utility"); 937 | # case 3: return std::string("Only Solar"); 938 | # default: return x; 939 | # } 940 | 941 | # - platform: modbus_controller 942 | # modbus_controller_id: smg_inverter 943 | # name: "Output Source Priority" 944 | # address: 4537 945 | # register_type: holding 946 | # lambda: |- 947 | # uint16_t value = swapBytes(x); 948 | # switch (value) { 949 | # case 0: return std::string("Utility first (USB)"); 950 | # case 1: return std::string("Solar first (SUB)"); 951 | # case 2: return std::string("SBU priority"); 952 | # default: return x; 953 | # } 954 | 955 | # - platform: modbus_controller 956 | # modbus_controller_id: smg_inverter 957 | # name: "AC Input Voltage Range" 958 | # address: 4538 959 | # register_type: holding 960 | # lambda: |- 961 | # uint16_t value = swapBytes(x); 962 | # switch (value) { 963 | # case 0: return std::string("90-280VAC"); 964 | # case 1: return std::string("170-280VAC"); 965 | # default: return x; 966 | # } 967 | 968 | binary_sensor: 969 | 970 | - platform: modbus_controller 971 | modbus_controller_id: smg_inverter 972 | name: "Record Fault Code" 973 | entity_category: diagnostic 974 | address: 4535 975 | register_type: holding 976 | bitmask: 0x1 977 | 978 | - platform: modbus_controller 979 | modbus_controller_id: smg_inverter 980 | name: "Battery Equalization" 981 | entity_category: diagnostic 982 | address: 4535 983 | register_type: holding 984 | bitmask: 0x2 985 | 986 | - platform: modbus_controller 987 | modbus_controller_id: smg_inverter 988 | name: "Equalization Activated Immediately" 989 | entity_category: diagnostic 990 | address: 4535 991 | register_type: holding 992 | bitmask: 0x4 993 | 994 | - platform: modbus_controller 995 | modbus_controller_id: smg_inverter 996 | name: "Alarm" 997 | entity_category: diagnostic 998 | address: 4535 999 | register_type: holding 1000 | bitmask: 0x100 1001 | 1002 | - platform: modbus_controller 1003 | modbus_controller_id: smg_inverter 1004 | name: "Backlight" 1005 | entity_category: diagnostic 1006 | address: 4535 1007 | register_type: holding 1008 | bitmask: 0x400 1009 | 1010 | - platform: modbus_controller 1011 | modbus_controller_id: smg_inverter 1012 | name: "Restart On Overload" 1013 | entity_category: diagnostic 1014 | address: 4535 1015 | register_type: holding 1016 | bitmask: 0x800 1017 | 1018 | - platform: modbus_controller 1019 | modbus_controller_id: smg_inverter 1020 | name: "Restart On Overheat" 1021 | entity_category: diagnostic 1022 | address: 4535 1023 | register_type: holding 1024 | bitmask: 0x1000 1025 | 1026 | - platform: modbus_controller 1027 | modbus_controller_id: smg_inverter 1028 | name: "Beep On Primary Source Fail" 1029 | entity_category: diagnostic 1030 | address: 4535 1031 | register_type: holding 1032 | bitmask: 0x2000 1033 | 1034 | - platform: modbus_controller 1035 | modbus_controller_id: smg_inverter 1036 | name: "Return To Default Screen" 1037 | entity_category: diagnostic 1038 | address: 4535 1039 | register_type: holding 1040 | bitmask: 0x4000 1041 | 1042 | - platform: modbus_controller 1043 | modbus_controller_id: smg_inverter 1044 | name: "Overload Bypass" 1045 | entity_category: diagnostic 1046 | address: 4535 1047 | register_type: holding 1048 | bitmask: 0x8000 1049 | 1050 | - platform: modbus_controller 1051 | modbus_controller_id: smg_inverter 1052 | name: "Load Enabled" 1053 | address: 4553 1054 | register_type: holding 1055 | bitmask: 0x4000 1056 | 1057 | - platform: modbus_controller 1058 | modbus_controller_id: smg_inverter 1059 | name: "Grid Active" 1060 | id: grid_active 1061 | address: 4554 1062 | register_type: holding 1063 | bitmask: 0x8000 1064 | 1065 | - platform: modbus_controller 1066 | modbus_controller_id: smg_inverter 1067 | name: "On Battery" 1068 | address: 4554 1069 | register_type: holding 1070 | bitmask: 0x1 1071 | 1072 | 1073 | # #################################### 1074 | # # Read config registers one by one # 1075 | # #################################### 1076 | 1077 | 1078 | select: 1079 | #Menu18 -5002 1080 | - platform: modbus_controller 1081 | name: "Menu 18: Buzzer Alarm" 1082 | optimistic: true 1083 | force_new_range: true 1084 | register_count: 1 1085 | skip_updates: ${select_skip_updates} 1086 | entity_category: config 1087 | address: 5002 1088 | value_type: U_WORD 1089 | optionsmap: 1090 | "OFF": 0 1091 | "ON": 1 1092 | #Menu6 -5005 1093 | - platform: modbus_controller 1094 | name: "Menu 06: Auto restart when overload" 1095 | optimistic: true 1096 | force_new_range: true 1097 | register_count: 1 1098 | skip_updates: ${select_skip_updates} 1099 | entity_category: config 1100 | address: 5005 1101 | value_type: U_WORD 1102 | optionsmap: 1103 | "OFF": 0 1104 | "ON": 1 1105 | 1106 | #Menu7 -5006 1107 | - platform: modbus_controller 1108 | name: "Menu 07: Auto restart when overheat" 1109 | optimistic: true 1110 | force_new_range: true 1111 | register_count: 1 1112 | skip_updates: ${select_skip_updates} 1113 | entity_category: config 1114 | address: 5006 1115 | value_type: U_WORD 1116 | optionsmap: 1117 | "OFF": 0 1118 | "ON": 1 1119 | 1120 | #menu22-5007 1121 | - platform: modbus_controller 1122 | name: "Menu 22: Beep On Primary Source Fail" 1123 | optimistic: true 1124 | force_new_range: true 1125 | register_count: 1 1126 | skip_updates: ${select_skip_updates} 1127 | entity_category: config 1128 | address: 5007 1129 | value_type: U_WORD 1130 | optionsmap: 1131 | "OFF": 0 1132 | "ON": 1 1133 | 1134 | #menu23 - 5009 1135 | - platform: modbus_controller 1136 | name: "Menu 23: Overload Bypass" 1137 | optimistic: true 1138 | force_new_range: true 1139 | register_count: 1 1140 | skip_updates: ${select_skip_updates} 1141 | entity_category: config 1142 | address: 5009 1143 | value_type: U_WORD 1144 | optionsmap: 1145 | "OFF": 0 1146 | "ON": 1 1147 | 1148 | #menu16 -5017 1149 | - platform: modbus_controller 1150 | id: charger_source_priority_select 1151 | name: "Menu 16: Charger Source Priority" 1152 | optimistic: true 1153 | force_new_range: true 1154 | register_count: 1 1155 | skip_updates: ${select_skip_updates} 1156 | entity_category: config 1157 | address: 5017 1158 | value_type: U_WORD 1159 | optionsmap: 1160 | # "Utility first": 0 1161 | "Solar first": 1 1162 | "Solar and Utility": 2 1163 | "Only Solar": 3 1164 | 1165 | #Menu1 -5018 1166 | - platform: modbus_controller 1167 | id: output_source_priority_select 1168 | name: "Menu 01: Output Source Priority" 1169 | optimistic: true 1170 | force_new_range: true 1171 | register_count: 1 1172 | skip_updates: ${select_skip_updates} 1173 | entity_category: config 1174 | address: 5018 1175 | value_type: U_WORD 1176 | optionsmap: 1177 | "Utility first (USB)": 0 1178 | "Solar first (SUB)": 1 1179 | "SBU priority": 2 1180 | 1181 | 1182 | #Menu3-5019 1183 | - platform: modbus_controller 1184 | name: "Menu 03: AC Input Voltage" 1185 | optimistic: true 1186 | force_new_range: true 1187 | register_count: 1 1188 | skip_updates: ${select_skip_updates} 1189 | entity_category: config 1190 | address: 5019 1191 | value_type: U_WORD 1192 | optionsmap: 1193 | "90-280VAC": 0 1194 | "170-280VAC": 1 1195 | #Menu4 -? 1196 | #Menu5 -5020 1197 | - platform: modbus_controller 1198 | name: "Menu 05: Battery Type" 1199 | optimistic: true 1200 | force_new_range: true 1201 | register_count: 1 1202 | skip_updates: ${select_skip_updates} 1203 | entity_category: config 1204 | address: 5020 1205 | value_type: U_WORD 1206 | optionsmap: 1207 | "AGM": 0 1208 | "Flooded": 1 1209 | "User Defined": 2 1210 | "Litium": 3 1211 | 1212 | 1213 | 1214 | #Menu8 -? 1215 | #Menu9 -5021 Output frequency 0 - 50hz, 1 - 60hz 1216 | 1217 | #Menu2-5022 1218 | - platform: modbus_controller 1219 | name: "Menu 02: Max Total Charge Current" 1220 | optimistic: true 1221 | force_new_range: true 1222 | register_count: 1 1223 | skip_updates: ${select_skip_updates} 1224 | entity_category: config 1225 | address: 5022 1226 | value_type: U_WORD 1227 | optionsmap: 1228 | "10": 10 1229 | "20": 20 1230 | "30": 30 1231 | "40": 40 1232 | "50": 50 1233 | "60": 60 1234 | "70": 70 1235 | "90": 90 1236 | "100": 100 1237 | "120": 120 1238 | 1239 | #Menu10 -5023 Output voltage (one of 220, 230, 240) 1240 | 1241 | #Menu11 - 5024 1242 | - platform: modbus_controller 1243 | name: "Menu 11: Max Utility Charge Current" 1244 | optimistic: true 1245 | force_new_range: true 1246 | register_count: 1 1247 | skip_updates: ${select_skip_updates} 1248 | entity_category: config 1249 | address: 5024 1250 | value_type: U_WORD 1251 | optionsmap: 1252 | "10": 10 1253 | "20": 20 1254 | "30": 30 1255 | "40": 40 1256 | "50": 50 1257 | "60": 60 1258 | "70": 70 1259 | "80": 80 1260 | "90": 90 1261 | "100": 100 1262 | 1263 | #Menu12 - 5025 1264 | - platform: modbus_controller 1265 | name: "Menu 12: Back To Utility Source Voltage" 1266 | optimistic: true 1267 | force_new_range: true 1268 | register_count: 1 1269 | skip_updates: ${select_skip_updates} 1270 | entity_category: config 1271 | address: 5025 1272 | value_type: U_WORD 1273 | optionsmap: 1274 | "21": 210 1275 | "21.5": 215 1276 | "22": 220 1277 | "22.5": 225 1278 | "23": 230 1279 | "23.5": 235 1280 | "24": 240 1281 | "24.5": 245 1282 | "25": 250 1283 | "25.5": 255 1284 | 1285 | #Menu13 - 5026 1286 | - platform: modbus_controller 1287 | name: "Menu 13: Back To Battery Source Voltage" 1288 | optimistic: true 1289 | force_new_range: true 1290 | register_count: 1 1291 | skip_updates: ${select_skip_updates} 1292 | entity_category: config 1293 | address: 5026 1294 | value_type: U_WORD 1295 | optionsmap: 1296 | "FULL": 0 1297 | "24": 240 1298 | "24.5": 245 1299 | "25": 250 1300 | "25.5": 255 1301 | "26": 260 1302 | "26.5": 265 1303 | "27": 270 1304 | "27.5": 275 1305 | "28": 280 1306 | "28.5": 285 1307 | "29": 290 1308 | 1309 | #Menu26 - 5027 Bulk charging voltage 1310 | #Menu27 - 5028 Floating charging voltage 1311 | #Menu28 - 5029 Low DC cut-off voltage 1312 | #Menu29 - 5030 Battery equalization voltage 1313 | #Menu33 - 5031 Battery equalized time 1314 | #Menu34 - 5032 Battery equalized timeout 1315 | #Menu35 - 5033 Equalization interval -------------------------------------------------------------------------------- /my-inverter 6_2kW.yaml: -------------------------------------------------------------------------------- 1 | substitutions: 2 | device_name: "my-inverter" 3 | friendly_name: My Inverter 4 | node_name: "My Inverter" 5 | node_id: powmr_inverter 6 | inverter_tx_pin: GPIO17 7 | #GPIO5 8 | inverter_rx_pin: GPIO16 9 | #GPIO4 10 | inverter_voltage_offset: "0" 11 | pzem_tx_pin: GPIO1 12 | pzem_rx_pin: GPIO3 13 | pzem_voltage_offset: "0" 14 | pzem_current_offset: "0" 15 | update_interval: 10s # Minimum 10s recommended to avoid duplicate command errors 16 | select_skip_updates: "6" 17 | read_skip_updates: "6" 18 | pzem_update_interval: 10s # Needs to be 1/5 of update interval because of smoothing filter on pzem readings 19 | 20 | esphome: 21 | name: "${device_name}" 22 | friendly_name: "${node_name}" 23 | comment: "Monitor and control a solar inverter" 24 | includes: 25 | - "helpers" 26 | project: 27 | name: "esphome.powmr-hybrid-inverter" 28 | version: 1.4.0 29 | 30 | esp32: 31 | board: esp32dev 32 | framework: 33 | type: arduino 34 | 35 | # Enable Home Assistant API 36 | api: 37 | encryption: 38 | key: !secret api_encryption_key 39 | 40 | ota: 41 | - platform: esphome 42 | password: !secret ota_password 43 | 44 | wifi: 45 | ssid: !secret wifi_ssid 46 | password: !secret wifi_password 47 | 48 | # Enable fallback hotspot (captive portal) in case wifi connection fails 49 | ap: 50 | ssid: "My-Inverter Fallback Hotspot" 51 | password: !secret ap_password 52 | 53 | captive_portal: 54 | 55 | packages: 56 | # You can replace next 2 lines with your common configs for all devices 57 | # common_system: !include includes/common_system.yaml 58 | common_sensors: !include includes/common_sensors.yaml 59 | 60 | 61 | #For debug: 62 | #debug: 63 | # update_interval: 10s 64 | 65 | #sensor: 66 | # - platform: debug 67 | # free: 68 | # name: "Heap Free" 69 | 70 | logger: 71 | id: uart_logger 72 | baud_rate: 0 73 | level: DEBUG #VERBOSE 74 | # logs: 75 | # component: ERROR # Fix for issue #4717 "Component xxxxxx took a long time for an operation" 76 | 77 | time: 78 | - platform: homeassistant 79 | id: hass_time 80 | 81 | web_server: 82 | port: 80 83 | local: true 84 | # ota: false 85 | 86 | 87 | uart: 88 | - id: uart_pzem 89 | baud_rate: 9600 90 | tx_pin: ${pzem_tx_pin} 91 | rx_pin: ${pzem_rx_pin} 92 | debug: 93 | direction: BOTH 94 | dummy_receiver: false 95 | after: 96 | delimiter: "\n" 97 | sequence: 98 | - lambda: UARTDebug::log_string(direction, bytes); 99 | 100 | - id: uart_inverter 101 | baud_rate: 2400 102 | tx_pin: ${inverter_tx_pin} 103 | rx_pin: ${inverter_rx_pin} 104 | debug: 105 | direction: BOTH 106 | dummy_receiver: false 107 | after: 108 | delimiter: "\n" 109 | sequence: 110 | - lambda: UARTDebug::log_string(direction, bytes); 111 | 112 | 113 | 114 | modbus: 115 | - id: modbus_inverter 116 | uart_id: uart_inverter 117 | send_wait_time: 500ms 118 | 119 | - id: modbus_pzem 120 | uart_id: uart_pzem 121 | send_wait_time: 250ms 122 | 123 | 124 | modbus_controller: 125 | - id: smg_inverter 126 | address: 0x05 127 | modbus_id: modbus_inverter 128 | setup_priority: -10 129 | offline_skip_updates: 100 130 | #command_throttle: 1s 131 | update_interval: ${update_interval} 132 | 133 | - id: pzem 134 | # The current device address. 135 | address: 0x02 136 | # The special address 0xF8 is a broadcast address accepted by any pzem device, 137 | # so if you use this address, make sure there is only one pzem device connected 138 | # to the uart bus. 139 | # address: 0xF8 140 | modbus_id: modbus_pzem 141 | command_throttle: 0ms 142 | setup_priority: -10 143 | offline_skip_updates: 100 144 | update_interval: ${pzem_update_interval} 145 | 146 | sensor: 147 | - platform: pzemac 148 | modbus_id: modbus_pzem 149 | voltage: 150 | name: "Grid Voltage PZEM" 151 | id: pzem_grid_voltage 152 | #internal: true 153 | #filters: 154 | # - &mafilter quantile: 155 | # window_size: 5 156 | # send_every: 1 157 | # send_first_at: 1 158 | # quantile: .9 159 | # - offset: ${pzem_voltage_offset} 160 | current: 161 | name: "Grid Current PZEM" 162 | id: pzem_grid_current 163 | #filters: 164 | # - *mafilter 165 | # - offset: ${pzem_current_offset} 166 | power: 167 | name: "Grid Power PZEM" 168 | id: pzem_grid_power 169 | #filters: 170 | # - *mafilter 171 | power_factor: 172 | name: "Grid Power Factor PZEM" 173 | id: pzem_grid_power_factor 174 | #filters: 175 | # - *mafilter 176 | energy: 177 | name: "Grid Energy PZEM" 178 | id: pzem_grid_energy 179 | #filters: 180 | # - *mafilter 181 | 182 | - platform: template 183 | name: "Grid Power VA PZEM" 184 | unit_of_measurement: "W" 185 | device_class: power 186 | state_class: measurement 187 | accuracy_decimals: 0 188 | update_interval: ${pzem_update_interval} 189 | lambda: |- 190 | return id(pzem_grid_current).state * id(pzem_grid_voltage).state; 191 | 192 | - platform: template 193 | name: "Grid Power VA*PF PZEM" 194 | unit_of_measurement: "W" 195 | device_class: power 196 | state_class: measurement 197 | accuracy_decimals: 0 198 | update_interval: ${pzem_update_interval} 199 | lambda: |- 200 | return id(pzem_grid_current).state * id(pzem_grid_voltage).state * id(pzem_grid_power_factor).state; 201 | 202 | ################################### 203 | # Read first group (14 registers) # 204 | ################################### 205 | 206 | - platform: modbus_controller 207 | modbus_controller_id: smg_inverter 208 | name: "Grid Voltage" 209 | address: 4502 210 | register_type: holding 211 | register_count: 14 212 | force_new_range: true 213 | value_type: U_WORD 214 | unit_of_measurement: "V" 215 | device_class: voltage 216 | state_class: measurement 217 | accuracy_decimals: 1 218 | lambda: |- 219 | return swapBytes(x); 220 | filters: 221 | - multiply: 0.1 222 | # - offset: ${inverter_voltage_offset} 223 | # - heartbeat: 10s 224 | 225 | - platform: modbus_controller 226 | modbus_controller_id: smg_inverter 227 | name: "Grid Frequency" 228 | address: 4503 229 | register_type: holding 230 | value_type: U_WORD 231 | unit_of_measurement: "Hz" 232 | device_class: frequency 233 | state_class: measurement 234 | accuracy_decimals: 1 235 | lambda: |- 236 | return swapBytes(x); 237 | filters: 238 | - multiply: 0.1 239 | 240 | - platform: modbus_controller 241 | modbus_controller_id: smg_inverter 242 | id: PV_Voltage 243 | name: "PV Voltage" 244 | address: 4504 245 | register_type: holding 246 | value_type: U_WORD 247 | unit_of_measurement: "V" 248 | device_class: voltage 249 | state_class: measurement 250 | accuracy_decimals: 1 251 | lambda: |- 252 | return swapBytes(x); 253 | filters: 254 | - multiply: 0.1 255 | 256 | - platform: modbus_controller 257 | modbus_controller_id: smg_inverter 258 | id: PV_Power 259 | name: "PV Power" 260 | address: 4505 261 | register_type: holding 262 | value_type: U_WORD 263 | unit_of_measurement: "W" 264 | device_class: power 265 | state_class: measurement 266 | accuracy_decimals: 1 267 | lambda: |- 268 | return swapBytes(x); 269 | 270 | - platform: template 271 | id: PV_Current 272 | name: "PV Current" 273 | unit_of_measurement: "A" 274 | device_class: current 275 | state_class: measurement 276 | accuracy_decimals: 1 277 | update_interval: ${update_interval} 278 | lambda: |- 279 | if (id(PV_Voltage).state == 0) { 280 | return 0; 281 | } 282 | return id(PV_Power).state / id(PV_Voltage).state; 283 | # filters: 284 | # - heartbeat: 10s 285 | 286 | - platform: modbus_controller 287 | modbus_controller_id: smg_inverter 288 | name: "Battery Voltage" 289 | id: battery_voltage 290 | address: 4506 291 | register_type: holding 292 | value_type: U_WORD 293 | unit_of_measurement: "V" 294 | device_class: voltage 295 | state_class: measurement 296 | accuracy_decimals: 2 297 | lambda: |- 298 | return swapBytes(x); 299 | filters: 300 | - multiply: 0.1 301 | 302 | - platform: modbus_controller 303 | modbus_controller_id: smg_inverter 304 | name: "Battery SoC" 305 | accuracy_decimals: 0 306 | unit_of_measurement: "%" 307 | device_class: battery 308 | address: 4507 309 | register_type: holding 310 | value_type: U_WORD 311 | state_class: measurement 312 | lambda: |- 313 | return swapBytes(x); 314 | 315 | - platform: modbus_controller 316 | modbus_controller_id: smg_inverter 317 | name: "Battery Charge Current" 318 | id: battery_charge_current 319 | address: 4508 320 | register_type: holding 321 | value_type: U_WORD 322 | unit_of_measurement: "A" 323 | device_class: current 324 | state_class: measurement 325 | accuracy_decimals: 1 326 | lambda: |- 327 | return swapBytes(x); 328 | 329 | - platform: modbus_controller 330 | modbus_controller_id: smg_inverter 331 | name: "Battery Discharge Current" 332 | id: battery_discharge_current 333 | address: 4509 334 | register_type: holding 335 | value_type: U_WORD 336 | unit_of_measurement: "A" 337 | device_class: current 338 | state_class: measurement 339 | accuracy_decimals: 1 340 | lambda: |- 341 | return swapBytes(x); 342 | 343 | - platform: template 344 | name: "Battery Current" 345 | id: battery_current 346 | unit_of_measurement: "A" 347 | device_class: current 348 | state_class: measurement 349 | accuracy_decimals: 1 350 | update_interval: ${update_interval} 351 | lambda: |- 352 | return id(battery_charge_current).state - id(battery_discharge_current).state; 353 | # filters: 354 | # - heartbeat: 10s 355 | 356 | - platform: template 357 | name: "Battery Power" 358 | unit_of_measurement: "W" 359 | device_class: power 360 | state_class: measurement 361 | accuracy_decimals: 0 362 | update_interval: ${update_interval} 363 | lambda: |- 364 | return id(battery_current).state * id(battery_voltage).state; 365 | 366 | - platform: modbus_controller 367 | modbus_controller_id: smg_inverter 368 | name: "Load Voltage" 369 | id: load_voltage 370 | address: 4510 371 | register_type: holding 372 | value_type: U_WORD 373 | unit_of_measurement: "V" 374 | device_class: voltage 375 | state_class: measurement 376 | accuracy_decimals: 1 377 | lambda: |- 378 | return swapBytes(x); 379 | filters: 380 | - multiply: 0.1 381 | 382 | - platform: modbus_controller 383 | modbus_controller_id: smg_inverter 384 | name: "Load Frequency" 385 | address: 4511 386 | register_type: holding 387 | value_type: U_WORD 388 | unit_of_measurement: "Hz" 389 | device_class: frequency 390 | state_class: measurement 391 | accuracy_decimals: 1 392 | lambda: |- 393 | return swapBytes(x); 394 | filters: 395 | - multiply: 0.1 396 | 397 | - platform: modbus_controller 398 | modbus_controller_id: smg_inverter 399 | name: "Load Power VA" 400 | id: load_Power_VA 401 | address: 4512 402 | register_type: holding 403 | value_type: U_WORD 404 | unit_of_measurement: "VA" 405 | device_class: apparent_power 406 | state_class: measurement 407 | accuracy_decimals: 0 408 | lambda: |- 409 | return swapBytes(x); 410 | 411 | - platform: modbus_controller 412 | modbus_controller_id: smg_inverter 413 | name: "Load Power" 414 | id: load_power 415 | address: 4513 416 | register_type: holding 417 | value_type: U_WORD 418 | unit_of_measurement: "W" 419 | device_class: power 420 | state_class: measurement 421 | accuracy_decimals: 0 422 | lambda: |- 423 | return swapBytes(x); 424 | 425 | 426 | - platform: template 427 | name: "Load Current" 428 | id: load_current 429 | unit_of_measurement: "A" 430 | device_class: current 431 | state_class: measurement 432 | accuracy_decimals: 3 433 | update_interval: ${update_interval} 434 | lambda: |- 435 | if (id(load_voltage).state == 0) { 436 | return 0; 437 | } 438 | return id(load_Power_VA).state / id(load_voltage).state; 439 | 440 | 441 | - platform: template 442 | name: "Load Power Factor" 443 | id: load_power_factor 444 | device_class: power_factor 445 | state_class: measurement 446 | accuracy_decimals: 2 447 | update_interval: ${update_interval} 448 | lambda: |- 449 | if (id(load_power).state == 0) { 450 | return 0; 451 | } 452 | return id(load_power).state / id(load_Power_VA).state; 453 | 454 | 455 | 456 | - platform: modbus_controller 457 | modbus_controller_id: smg_inverter 458 | name: "Load Percent" 459 | address: 4514 460 | register_count: 21 461 | register_type: holding 462 | value_type: U_WORD 463 | unit_of_measurement: "%" 464 | device_class: power_factor 465 | state_class: measurement 466 | lambda: |- 467 | return swapBytes(x); 468 | 469 | - platform: modbus_controller 470 | modbus_controller_id: smg_inverter 471 | name: "Load Percent2" 472 | address: 4515 473 | register_type: holding 474 | value_type: U_WORD 475 | unit_of_measurement: "%" 476 | device_class: power_factor 477 | state_class: measurement 478 | lambda: |- 479 | return swapBytes(x); 480 | 481 | # #################################### 482 | # # Read second group (20 registers) # 483 | # #################################### 484 | 485 | 486 | - platform: modbus_controller 487 | modbus_controller_id: smg_inverter 488 | name: "Unknown4516" 489 | address: 4516 490 | skip_updates: ${read_skip_updates} 491 | #register_count: 20 492 | force_new_range: true 493 | register_type: holding 494 | value_type: U_WORD 495 | # unit_of_measurement: "%" 496 | device_class: power_factor 497 | state_class: measurement 498 | lambda: |- 499 | return swapBytes(x); 500 | 501 | - platform: modbus_controller 502 | modbus_controller_id: smg_inverter 503 | name: "Unknown4517" 504 | address: 4517 505 | register_type: holding 506 | value_type: U_WORD 507 | # unit_of_measurement: "%" 508 | device_class: power_factor 509 | state_class: measurement 510 | lambda: |- 511 | return swapBytes(x); 512 | 513 | - platform: modbus_controller 514 | modbus_controller_id: smg_inverter 515 | name: "Unknown4518" 516 | address: 4518 517 | register_type: holding 518 | value_type: U_WORD 519 | # unit_of_measurement: "%" 520 | device_class: power_factor 521 | state_class: measurement 522 | lambda: |- 523 | return swapBytes(x); 524 | 525 | - platform: modbus_controller 526 | modbus_controller_id: smg_inverter 527 | name: "Unknown4519" 528 | address: 4519 529 | register_type: holding 530 | value_type: U_WORD 531 | # unit_of_measurement: "%" 532 | device_class: power_factor 533 | state_class: measurement 534 | lambda: |- 535 | return swapBytes(x); 536 | 537 | - platform: modbus_controller 538 | modbus_controller_id: smg_inverter 539 | name: "Unknown4520" 540 | address: 4520 541 | register_type: holding 542 | value_type: U_WORD 543 | # unit_of_measurement: "%" 544 | device_class: power_factor 545 | state_class: measurement 546 | lambda: |- 547 | return swapBytes(x); 548 | 549 | - platform: modbus_controller 550 | modbus_controller_id: smg_inverter 551 | name: "Unknown4521" 552 | address: 4521 553 | register_type: holding 554 | value_type: U_WORD 555 | # unit_of_measurement: "%" 556 | device_class: power_factor 557 | state_class: measurement 558 | lambda: |- 559 | return swapBytes(x); 560 | 561 | - platform: modbus_controller 562 | modbus_controller_id: smg_inverter 563 | name: "Unknown4522" 564 | address: 4522 565 | register_type: holding 566 | value_type: U_WORD 567 | # unit_of_measurement: "%" 568 | device_class: power_factor 569 | state_class: measurement 570 | lambda: |- 571 | return swapBytes(x); 572 | 573 | - platform: modbus_controller 574 | modbus_controller_id: smg_inverter 575 | name: "Unknown4523" 576 | address: 4523 577 | register_type: holding 578 | value_type: U_WORD 579 | # unit_of_measurement: "%" 580 | device_class: power_factor 581 | state_class: measurement 582 | lambda: |- 583 | return swapBytes(x); 584 | 585 | - platform: modbus_controller 586 | modbus_controller_id: smg_inverter 587 | name: "Unknown4524" 588 | address: 4524 589 | register_type: holding 590 | value_type: U_WORD 591 | # unit_of_measurement: "%" 592 | device_class: power_factor 593 | state_class: measurement 594 | lambda: |- 595 | return swapBytes(x); 596 | 597 | - platform: modbus_controller 598 | modbus_controller_id: smg_inverter 599 | name: "Unknown4525" 600 | address: 4525 601 | register_type: holding 602 | value_type: U_WORD 603 | # unit_of_measurement: "%" 604 | device_class: power_factor 605 | state_class: measurement 606 | lambda: |- 607 | return swapBytes(x); 608 | 609 | - platform: modbus_controller 610 | modbus_controller_id: smg_inverter 611 | name: "Unknown4526" 612 | address: 4526 613 | register_type: holding 614 | value_type: U_WORD 615 | # unit_of_measurement: "%" 616 | device_class: power_factor 617 | state_class: measurement 618 | lambda: |- 619 | return swapBytes(x); 620 | 621 | - platform: modbus_controller 622 | modbus_controller_id: smg_inverter 623 | name: "Unknown4527" 624 | address: 4527 625 | register_type: holding 626 | value_type: U_WORD 627 | # unit_of_measurement: "%" 628 | device_class: power_factor 629 | state_class: measurement 630 | lambda: |- 631 | return swapBytes(x); 632 | 633 | - platform: modbus_controller 634 | modbus_controller_id: smg_inverter 635 | name: "Unknown4528" 636 | address: 4528 637 | register_type: holding 638 | value_type: U_WORD 639 | # unit_of_measurement: "%" 640 | device_class: power_factor 641 | state_class: measurement 642 | lambda: |- 643 | return swapBytes(x); 644 | 645 | - platform: modbus_controller 646 | modbus_controller_id: smg_inverter 647 | name: "Unknown4529" 648 | address: 4529 649 | register_type: holding 650 | value_type: U_WORD 651 | # unit_of_measurement: "%" 652 | device_class: power_factor 653 | state_class: measurement 654 | lambda: |- 655 | return swapBytes(x); 656 | 657 | - platform: modbus_controller 658 | modbus_controller_id: smg_inverter 659 | name: "Unknown4530" 660 | address: 4530 661 | register_type: holding 662 | value_type: U_WORD 663 | # unit_of_measurement: "%" 664 | device_class: power_factor 665 | state_class: measurement 666 | lambda: |- 667 | return swapBytes(x); 668 | 669 | - platform: modbus_controller 670 | modbus_controller_id: smg_inverter 671 | name: "Unknown4531" 672 | address: 4531 673 | register_type: holding 674 | value_type: U_WORD 675 | # unit_of_measurement: "%" 676 | device_class: power_factor 677 | state_class: measurement 678 | lambda: |- 679 | return swapBytes(x); 680 | 681 | - platform: modbus_controller 682 | modbus_controller_id: smg_inverter 683 | name: "Unknown4532" 684 | address: 4532 685 | register_type: holding 686 | value_type: U_WORD 687 | # unit_of_measurement: "%" 688 | device_class: power_factor 689 | state_class: measurement 690 | lambda: |- 691 | return swapBytes(x); 692 | 693 | - platform: modbus_controller 694 | modbus_controller_id: smg_inverter 695 | name: "Unknown4533" 696 | address: 4533 697 | register_type: holding 698 | value_type: U_WORD 699 | # unit_of_measurement: "%" 700 | device_class: power_factor 701 | state_class: measurement 702 | lambda: |- 703 | return swapBytes(x); 704 | 705 | 706 | - platform: modbus_controller 707 | modbus_controller_id: smg_inverter 708 | name: "Unknown4534" 709 | address: 4534 710 | register_type: holding 711 | value_type: U_WORD 712 | # unit_of_measurement: "%" 713 | device_class: power_factor 714 | state_class: measurement 715 | lambda: |- 716 | return swapBytes(x); 717 | 718 | - platform: modbus_controller 719 | modbus_controller_id: smg_inverter 720 | name: "Unknown4535" 721 | address: 4535 722 | register_type: holding 723 | value_type: U_WORD 724 | # unit_of_measurement: "%" 725 | device_class: power_factor 726 | state_class: measurement 727 | lambda: |- 728 | return swapBytes(x); 729 | 730 | # 4535 -> binary 731 | 732 | # 4536 -> text 733 | 734 | # 4537 -> text 735 | 736 | # 4538 -> text 737 | 738 | # #################################### 739 | # # Read third group (22 registers) # 740 | # #################################### 741 | 742 | 743 | - platform: modbus_controller 744 | modbus_controller_id: smg_inverter 745 | name: "Charger Source Priority" 746 | address: 4536 747 | # force_new_range: true 748 | # register_count: 22 749 | register_type: holding 750 | value_type: U_WORD 751 | # unit_of_measurement: "%" 752 | device_class: power_factor 753 | state_class: measurement 754 | lambda: |- 755 | return swapBytes(x); 756 | 757 | - platform: modbus_controller 758 | modbus_controller_id: smg_inverter 759 | name: "Output Source Priority" 760 | address: 4537 761 | register_type: holding 762 | value_type: U_WORD 763 | # unit_of_measurement: "%" 764 | device_class: power_factor 765 | state_class: measurement 766 | lambda: |- 767 | return swapBytes(x); 768 | 769 | - platform: modbus_controller 770 | modbus_controller_id: smg_inverter 771 | name: "AC Input Voltage Range" 772 | address: 4538 773 | register_type: holding 774 | value_type: U_WORD 775 | # unit_of_measurement: "%" 776 | device_class: power_factor 777 | state_class: measurement 778 | lambda: |- 779 | return swapBytes(x); 780 | 781 | - platform: modbus_controller 782 | modbus_controller_id: smg_inverter 783 | name: "Unknown4539" 784 | address: 4539 785 | skip_updates: ${read_skip_updates} 786 | register_type: holding 787 | value_type: U_WORD 788 | # unit_of_measurement: "%" 789 | device_class: power_factor 790 | state_class: measurement 791 | lambda: |- 792 | return swapBytes(x); 793 | 794 | - platform: modbus_controller 795 | modbus_controller_id: smg_inverter 796 | name: "Target Output Frequency" 797 | accuracy_decimals: 0 798 | entity_category: diagnostic 799 | address: 4540 800 | register_type: holding 801 | value_type: U_WORD 802 | unit_of_measurement: "Hz" 803 | lambda: |- 804 | uint16_t value = swapBytes(x); 805 | switch (value) { 806 | case 0: return std::uint16_t(50); 807 | case 1: return std::uint16_t(60); 808 | default: return x; 809 | } 810 | 811 | - platform: modbus_controller 812 | modbus_controller_id: smg_inverter 813 | name: "Max Total Charging Current" 814 | accuracy_decimals: 0 815 | entity_category: diagnostic 816 | address: 4541 817 | register_type: holding 818 | value_type: U_WORD 819 | unit_of_measurement: "A" 820 | lambda: |- 821 | return swapBytes(x); 822 | 823 | - platform: modbus_controller 824 | modbus_controller_id: smg_inverter 825 | name: "Target Output Voltage" 826 | accuracy_decimals: 0 827 | entity_category: diagnostic 828 | address: 4542 829 | register_type: holding 830 | value_type: U_WORD 831 | unit_of_measurement: "V" 832 | lambda: |- 833 | return swapBytes(x); 834 | 835 | - platform: modbus_controller 836 | modbus_controller_id: smg_inverter 837 | name: "Max Utility Charging Current" 838 | accuracy_decimals: 0 839 | entity_category: diagnostic 840 | address: 4543 841 | register_type: holding 842 | value_type: U_WORD 843 | unit_of_measurement: "A" 844 | lambda: |- 845 | return swapBytes(x); 846 | 847 | - platform: modbus_controller 848 | modbus_controller_id: smg_inverter 849 | name: "Back To Utility Source Voltage" 850 | filters: 851 | - multiply: 0.1 852 | accuracy_decimals: 1 853 | entity_category: diagnostic 854 | address: 4544 855 | register_type: holding 856 | value_type: U_WORD 857 | unit_of_measurement: "V" 858 | lambda: |- 859 | return swapBytes(x); 860 | 861 | - platform: modbus_controller 862 | modbus_controller_id: smg_inverter 863 | name: "Back To Battery Source Voltage" 864 | filters: 865 | - multiply: 0.1 866 | accuracy_decimals: 1 867 | entity_category: diagnostic 868 | address: 4545 869 | register_type: holding 870 | value_type: U_WORD 871 | unit_of_measurement: "V" 872 | lambda: |- 873 | return swapBytes(x); 874 | 875 | - platform: modbus_controller 876 | modbus_controller_id: smg_inverter 877 | name: "Bulk Charging Voltage" 878 | filters: 879 | - multiply: 0.1 880 | accuracy_decimals: 1 881 | entity_category: diagnostic 882 | address: 4546 883 | register_type: holding 884 | value_type: U_WORD 885 | unit_of_measurement: "V" 886 | lambda: |- 887 | return swapBytes(x); 888 | 889 | - platform: modbus_controller 890 | modbus_controller_id: smg_inverter 891 | name: "Floating Charging Voltage" 892 | filters: 893 | - multiply: 0.1 894 | accuracy_decimals: 1 895 | entity_category: diagnostic 896 | address: 4547 897 | register_type: holding 898 | value_type: U_WORD 899 | unit_of_measurement: "V" 900 | lambda: |- 901 | return swapBytes(x); 902 | 903 | - platform: modbus_controller 904 | modbus_controller_id: smg_inverter 905 | name: "Low CutOff Voltage" 906 | filters: 907 | - multiply: 0.1 908 | accuracy_decimals: 1 909 | entity_category: diagnostic 910 | address: 4548 911 | register_type: holding 912 | value_type: U_WORD 913 | unit_of_measurement: "V" 914 | lambda: |- 915 | return swapBytes(x); 916 | 917 | - platform: modbus_controller 918 | modbus_controller_id: smg_inverter 919 | name: "Battery Equalization Voltage" 920 | filters: 921 | - multiply: 0.1 922 | accuracy_decimals: 1 923 | entity_category: diagnostic 924 | address: 4549 925 | register_type: holding 926 | value_type: U_WORD 927 | unit_of_measurement: "V" 928 | lambda: |- 929 | return swapBytes(x); 930 | 931 | - platform: modbus_controller 932 | modbus_controller_id: smg_inverter 933 | name: "Battery Equalized Time" 934 | accuracy_decimals: 0 935 | entity_category: diagnostic 936 | address: 4550 937 | register_type: holding 938 | value_type: U_WORD 939 | lambda: |- 940 | return swapBytes(x); 941 | 942 | - platform: modbus_controller 943 | modbus_controller_id: smg_inverter 944 | name: "Battery Equalized Timeout" 945 | accuracy_decimals: 0 946 | entity_category: diagnostic 947 | address: 4551 948 | register_type: holding 949 | value_type: U_WORD 950 | lambda: |- 951 | return swapBytes(x); 952 | 953 | - platform: modbus_controller 954 | modbus_controller_id: smg_inverter 955 | name: "Equalization Interval" 956 | accuracy_decimals: 0 957 | entity_category: diagnostic 958 | address: 4552 959 | register_type: holding 960 | value_type: U_WORD 961 | lambda: |- 962 | return swapBytes(x); 963 | 964 | # 4553 -> binary 965 | 966 | # 4554 -> binary 967 | 968 | # 4555 -> text 969 | - platform: modbus_controller 970 | modbus_controller_id: smg_inverter 971 | name: "Unknown4553" 972 | accuracy_decimals: 0 973 | entity_category: diagnostic 974 | address: 4553 975 | register_type: holding 976 | value_type: U_WORD 977 | lambda: |- 978 | return swapBytes(x); 979 | 980 | - platform: modbus_controller 981 | modbus_controller_id: smg_inverter 982 | name: "Unknown4554" 983 | accuracy_decimals: 0 984 | entity_category: diagnostic 985 | address: 4554 986 | register_type: holding 987 | value_type: U_WORD 988 | lambda: |- 989 | return swapBytes(x); 990 | 991 | - platform: modbus_controller 992 | modbus_controller_id: smg_inverter 993 | name: "Charger Status" 994 | accuracy_decimals: 0 995 | entity_category: diagnostic 996 | address: 4555 997 | register_type: holding 998 | value_type: U_WORD 999 | lambda: |- 1000 | return swapBytes(x); 1001 | 1002 | - platform: modbus_controller 1003 | modbus_controller_id: smg_inverter 1004 | name: "Temperature" 1005 | accuracy_decimals: 0 1006 | entity_category: diagnostic 1007 | address: 4556 1008 | register_type: holding 1009 | unit_of_measurement: "°C" 1010 | value_type: U_WORD 1011 | lambda: |- 1012 | return swapBytes(x); 1013 | 1014 | - platform: modbus_controller 1015 | modbus_controller_id: smg_inverter 1016 | name: "Temperature2" 1017 | accuracy_decimals: 0 1018 | entity_category: diagnostic 1019 | address: 4557 1020 | register_type: holding 1021 | unit_of_measurement: "°C" 1022 | value_type: U_WORD 1023 | lambda: |- 1024 | return swapBytes(x); 1025 | 1026 | binary_sensor: 1027 | 1028 | - platform: modbus_controller 1029 | modbus_controller_id: smg_inverter 1030 | name: "Record Fault Code" 1031 | entity_category: diagnostic 1032 | address: 4535 1033 | register_type: holding 1034 | bitmask: 0x1 1035 | 1036 | - platform: modbus_controller 1037 | modbus_controller_id: smg_inverter 1038 | name: "Battery Equalization" 1039 | entity_category: diagnostic 1040 | address: 4535 1041 | register_type: holding 1042 | bitmask: 0x2 1043 | 1044 | # - platform: modbus_controller 1045 | # modbus_controller_id: smg_inverter 1046 | # name: "Equalization Activated Immediately" 1047 | # entity_category: diagnostic 1048 | # address: 4535 1049 | # register_type: holding 1050 | # bitmask: 0x4 1051 | 1052 | - platform: modbus_controller 1053 | modbus_controller_id: smg_inverter 1054 | name: "Alarm" 1055 | entity_category: diagnostic 1056 | address: 4535 1057 | register_type: holding 1058 | bitmask: 0x100 1059 | 1060 | - platform: modbus_controller 1061 | modbus_controller_id: smg_inverter 1062 | name: "Backlight" 1063 | entity_category: diagnostic 1064 | address: 4535 1065 | register_type: holding 1066 | bitmask: 0x400 1067 | 1068 | - platform: modbus_controller 1069 | modbus_controller_id: smg_inverter 1070 | name: "Restart On Overload" 1071 | entity_category: diagnostic 1072 | address: 4535 1073 | register_type: holding 1074 | bitmask: 0x800 1075 | 1076 | - platform: modbus_controller 1077 | modbus_controller_id: smg_inverter 1078 | name: "Restart On Overheat" 1079 | entity_category: diagnostic 1080 | address: 4535 1081 | register_type: holding 1082 | bitmask: 0x1000 1083 | 1084 | - platform: modbus_controller 1085 | modbus_controller_id: smg_inverter 1086 | name: "Beep On Primary Source Fail" 1087 | entity_category: diagnostic 1088 | address: 4535 1089 | register_type: holding 1090 | bitmask: 0x2000 1091 | 1092 | # - platform: modbus_controller 1093 | # modbus_controller_id: smg_inverter 1094 | # name: "Return To Default Screen" 1095 | # entity_category: diagnostic 1096 | # address: 4535 1097 | # register_type: holding 1098 | # bitmask: 0x4000 1099 | 1100 | - platform: modbus_controller 1101 | modbus_controller_id: smg_inverter 1102 | name: "Overload Bypass" 1103 | entity_category: diagnostic 1104 | address: 4535 1105 | register_type: holding 1106 | bitmask: 0x8000 1107 | 1108 | - platform: modbus_controller 1109 | modbus_controller_id: smg_inverter 1110 | name: "On Battery 4553 0x100" 1111 | address: 4553 1112 | register_type: holding 1113 | bitmask: 0x100 1114 | 1115 | - platform: modbus_controller 1116 | modbus_controller_id: smg_inverter 1117 | name: "Grid Active 4553 0x200" 1118 | address: 4553 1119 | register_type: holding 1120 | bitmask: 0x200 1121 | 1122 | - platform: modbus_controller 1123 | modbus_controller_id: smg_inverter 1124 | name: "Load Off" 1125 | address: 4553 1126 | register_type: holding 1127 | bitmask: 0x1000 1128 | 1129 | - platform: modbus_controller 1130 | modbus_controller_id: smg_inverter 1131 | name: "Grid Active 4553 0x2000" 1132 | address: 4553 1133 | register_type: holding 1134 | bitmask: 0x2000 1135 | 1136 | - platform: modbus_controller 1137 | modbus_controller_id: smg_inverter 1138 | name: "Load Enabled" 1139 | address: 4553 1140 | register_type: holding 1141 | bitmask: 0x4000 1142 | 1143 | - platform: modbus_controller 1144 | modbus_controller_id: smg_inverter 1145 | name: "On Battery" 1146 | address: 4554 1147 | register_type: holding 1148 | bitmask: 0x1 1149 | 1150 | - platform: modbus_controller 1151 | modbus_controller_id: smg_inverter 1152 | name: "Grid Active 4554 0x100" 1153 | id: grid_active2 1154 | address: 4554 1155 | register_type: holding 1156 | bitmask: 0x100 1157 | 1158 | - platform: modbus_controller 1159 | modbus_controller_id: smg_inverter 1160 | name: "Grid Active" 1161 | id: grid_active 1162 | address: 4554 1163 | register_type: holding 1164 | bitmask: 0x8000 1165 | 1166 | # #################################### 1167 | # # Read config registers one by one # 1168 | # #################################### 1169 | 1170 | select: 1171 | #Menu18 -5002 1172 | - platform: modbus_controller 1173 | modbus_controller_id: smg_inverter 1174 | name: "Menu 18: Buzzer Alarm" 1175 | optimistic: true 1176 | force_new_range: true 1177 | register_count: 1 1178 | skip_updates: ${select_skip_updates} 1179 | entity_category: config 1180 | address: 5002 1181 | value_type: U_WORD 1182 | optionsmap: 1183 | "OFF": 0 1184 | "ON": 1 1185 | #Menu6 -5005 1186 | - platform: modbus_controller 1187 | modbus_controller_id: smg_inverter 1188 | name: "Menu 06: Auto restart when overload" 1189 | optimistic: true 1190 | force_new_range: true 1191 | register_count: 1 1192 | skip_updates: ${select_skip_updates} 1193 | entity_category: config 1194 | address: 5005 1195 | value_type: U_WORD 1196 | optionsmap: 1197 | "OFF": 0 1198 | "ON": 1 1199 | 1200 | #Menu7 -5006 1201 | - platform: modbus_controller 1202 | modbus_controller_id: smg_inverter 1203 | name: "Menu 07: Auto restart when overheat" 1204 | optimistic: true 1205 | force_new_range: true 1206 | register_count: 1 1207 | skip_updates: ${select_skip_updates} 1208 | entity_category: config 1209 | address: 5006 1210 | value_type: U_WORD 1211 | optionsmap: 1212 | "OFF": 0 1213 | "ON": 1 1214 | 1215 | #menu22-5007 1216 | - platform: modbus_controller 1217 | modbus_controller_id: smg_inverter 1218 | name: "Menu 22: Beep On Primary Source Fail" 1219 | optimistic: true 1220 | force_new_range: true 1221 | register_count: 1 1222 | skip_updates: ${select_skip_updates} 1223 | entity_category: config 1224 | address: 5007 1225 | value_type: U_WORD 1226 | optionsmap: 1227 | "OFF": 0 1228 | "ON": 1 1229 | 1230 | #menu23 - 5009 1231 | - platform: modbus_controller 1232 | modbus_controller_id: smg_inverter 1233 | name: "Menu 23: Overload Bypass" 1234 | optimistic: true 1235 | force_new_range: true 1236 | register_count: 1 1237 | skip_updates: ${select_skip_updates} 1238 | entity_category: config 1239 | address: 5009 1240 | value_type: U_WORD 1241 | optionsmap: 1242 | "OFF": 0 1243 | "ON": 1 1244 | 1245 | #menu16 -5017 1246 | - platform: modbus_controller 1247 | modbus_controller_id: smg_inverter 1248 | id: charger_source_priority_select 1249 | name: "Menu 16: Charger Source Priority" 1250 | optimistic: true 1251 | force_new_range: true 1252 | register_count: 1 1253 | skip_updates: ${select_skip_updates} 1254 | entity_category: config 1255 | address: 5017 1256 | value_type: U_WORD 1257 | optionsmap: 1258 | "Utility first": 0 1259 | "Solar first": 1 1260 | "Solar and Utility": 2 1261 | "Only Solar": 3 1262 | 1263 | #Menu1 -5018 1264 | - platform: modbus_controller 1265 | modbus_controller_id: smg_inverter 1266 | id: output_source_priority_select 1267 | name: "Menu 01: Output Source Priority" 1268 | optimistic: true 1269 | force_new_range: true 1270 | register_count: 1 1271 | skip_updates: ${select_skip_updates} 1272 | entity_category: config 1273 | address: 5018 1274 | value_type: U_WORD 1275 | optionsmap: 1276 | "Utility first (USB)": 0 1277 | "Solar first (SUB)": 1 1278 | "SBU priority": 2 1279 | 1280 | 1281 | #Menu3-5019 1282 | - platform: modbus_controller 1283 | modbus_controller_id: smg_inverter 1284 | name: "Menu 03: AC Input Voltage" 1285 | optimistic: true 1286 | force_new_range: true 1287 | register_count: 1 1288 | skip_updates: ${select_skip_updates} 1289 | entity_category: config 1290 | address: 5019 1291 | value_type: U_WORD 1292 | optionsmap: 1293 | "90-280VAC": 0 1294 | "170-280VAC": 1 1295 | #Menu4 -? 1296 | #Menu5 -5020 1297 | - platform: modbus_controller 1298 | modbus_controller_id: smg_inverter 1299 | name: "Menu 05: Battery Type" 1300 | optimistic: true 1301 | force_new_range: true 1302 | register_count: 1 1303 | skip_updates: ${select_skip_updates} 1304 | entity_category: config 1305 | address: 5020 1306 | value_type: U_WORD 1307 | optionsmap: 1308 | "AGM": 0 1309 | "Flooded": 1 1310 | "User Defined": 2 1311 | "Litium": 3 1312 | 1313 | 1314 | 1315 | #Menu8 -? 1316 | #Menu9 -5021 Output frequency 0 - 50hz, 1 - 60hz 1317 | 1318 | #Menu2-5022 1319 | - platform: modbus_controller 1320 | modbus_controller_id: smg_inverter 1321 | name: "Menu 02: Max Total Charge Current" 1322 | optimistic: true 1323 | force_new_range: true 1324 | register_count: 1 1325 | skip_updates: ${select_skip_updates} 1326 | entity_category: config 1327 | address: 5022 1328 | value_type: U_WORD 1329 | optionsmap: 1330 | "10": 10 1331 | "20": 20 1332 | "30": 30 1333 | "40": 40 1334 | "50": 50 1335 | "60": 60 1336 | "70": 70 1337 | "80": 80 1338 | 1339 | #Menu10 -5023 Output voltage (one of 220, 230, 240) 1340 | 1341 | #Menu11 - 5024 1342 | - platform: modbus_controller 1343 | modbus_controller_id: smg_inverter 1344 | name: "Menu 11: Max Utility Charge Current" 1345 | optimistic: true 1346 | force_new_range: true 1347 | register_count: 1 1348 | skip_updates: ${select_skip_updates} 1349 | entity_category: config 1350 | address: 5024 1351 | value_type: U_WORD 1352 | optionsmap: 1353 | "10": 10 1354 | "20": 20 1355 | "30": 30 1356 | "40": 40 1357 | "50": 50 1358 | "60": 60 1359 | 1360 | #Menu12 - 5025 1361 | - platform: modbus_controller 1362 | modbus_controller_id: smg_inverter 1363 | name: "Menu 12: Back To Utility Source Voltage" 1364 | optimistic: true 1365 | force_new_range: true 1366 | register_count: 1 1367 | skip_updates: ${select_skip_updates} 1368 | entity_category: config 1369 | address: 5025 1370 | value_type: U_WORD 1371 | optionsmap: 1372 | "42": 420 1373 | "43": 430 1374 | "44": 440 1375 | "45": 450 1376 | "46": 460 1377 | "47": 470 1378 | "48": 480 1379 | "49": 490 1380 | "50": 500 1381 | "51": 510 1382 | 1383 | #Menu13 - 5026 1384 | - platform: modbus_controller 1385 | modbus_controller_id: smg_inverter 1386 | name: "Menu 13: Back To Battery Source Voltage" 1387 | optimistic: true 1388 | force_new_range: true 1389 | register_count: 1 1390 | skip_updates: ${select_skip_updates} 1391 | entity_category: config 1392 | address: 5026 1393 | value_type: U_WORD 1394 | optionsmap: 1395 | "FULL": 0 1396 | "48": 480 1397 | "49": 490 1398 | "50": 500 1399 | "51": 510 1400 | "52": 520 1401 | "53": 530 1402 | "54": 540 1403 | "55": 550 1404 | "56": 560 1405 | "57": 570 1406 | "58": 580 1407 | 1408 | #Menu26 - 5027 Bulk charging voltage 1409 | #Menu27 - 5028 Floating charging voltage 1410 | #Menu28 - 5029 Low DC cut-off voltage 1411 | #Menu29 - 5030 Battery equalization voltage 1412 | #Menu33 - 5031 Battery equalized time 1413 | #Menu34 - 5032 Battery equalized timeout 1414 | #Menu35 - 5033 Equalization interval 1415 | -------------------------------------------------------------------------------- /my-inverter 3_2kW.yaml: -------------------------------------------------------------------------------- 1 | substitutions: 2 | device_name: "my-inverter" 3 | friendly_name: My Inverter 4 | node_name: "My Inverter" 5 | node_id: powmr_inverter 6 | inverter_tx_pin: GPIO17 7 | #GPIO5 8 | inverter_rx_pin: GPIO16 9 | #GPIO4 10 | inverter_voltage_offset: "0" 11 | # pzem_tx_pin: GPIO1 12 | # pzem_rx_pin: GPIO3 13 | # pzem_voltage_offset: "1" 14 | # pzem_current_offset: "0.04" 15 | update_interval: 10s # Minimum 10s recommended to avoid duplicate command errors 16 | select_skip_updates: "6" 17 | read_skip_updates: "6" 18 | # pzem_update_interval: 6s # Needs to be 1/5 of update interval because of smoothing filter on pzem readings 19 | 20 | esphome: 21 | name: "${device_name}" 22 | friendly_name: "${node_name}" 23 | comment: "Monitor and control a solar inverter" 24 | includes: 25 | - "helpers" 26 | project: 27 | name: "esphome.powmr-hybrid-inverter" 28 | version: 1.3.5 29 | 30 | esp32: 31 | board: esp32dev 32 | framework: 33 | type: arduino 34 | 35 | # Enable Home Assistant API 36 | api: 37 | encryption: 38 | key: !secret api_encryption_key 39 | 40 | ota: 41 | - platform: esphome 42 | password: !secret ota_password 43 | 44 | wifi: 45 | ssid: !secret wifi_ssid 46 | password: !secret wifi_password 47 | 48 | # Enable fallback hotspot (captive portal) in case wifi connection fails 49 | ap: 50 | ssid: "My-Inverter Fallback Hotspot" 51 | password: !secret ap_password 52 | 53 | captive_portal: 54 | 55 | packages: 56 | # You can replace next 2 lines with your common configs for all devices 57 | common_system: !include includes/common_system.yaml 58 | common_sensors: !include includes/common_sensors.yaml 59 | 60 | #packages: 61 | # pzem: !include { 62 | # file: modules/pzem.yaml 63 | # } 64 | #For debug: 65 | #debug: 66 | # update_interval: 10s 67 | 68 | #sensor: 69 | # - platform: debug 70 | # free: 71 | # name: "Heap Free" 72 | 73 | logger: 74 | id: uart_logger 75 | baud_rate: 0 76 | level: DEBUG #VERBOSE #DEBUG 77 | # logs: 78 | # component: ERROR # Fix for issue #4717 "Component xxxxxx took a long time for an operation" 79 | 80 | time: 81 | - platform: homeassistant 82 | id: hass_time 83 | 84 | web_server: 85 | port: 80 86 | local: true 87 | # ota: false 88 | 89 | uart: 90 | - id: uart_inverter 91 | baud_rate: 2400 92 | tx_pin: ${inverter_tx_pin} 93 | rx_pin: ${inverter_rx_pin} 94 | debug: 95 | direction: BOTH 96 | dummy_receiver: false 97 | after: 98 | delimiter: "\n" 99 | sequence: 100 | - lambda: UARTDebug::log_string(direction, bytes); 101 | 102 | modbus: 103 | - id: modbus_inverter 104 | uart_id: uart_inverter 105 | send_wait_time: 250ms 106 | 107 | modbus_controller: 108 | - id: smg_inverter 109 | address: 0x05 110 | modbus_id: modbus_inverter 111 | setup_priority: -10 112 | offline_skip_updates: 100 113 | command_throttle: 1s 114 | update_interval: ${update_interval} 115 | 116 | switch: 117 | - platform: restart 118 | name: "Invertor Restart" 119 | sensor: 120 | # - platform: template 121 | # name: "Grid Power VA" 122 | # unit_of_measurement: "W" 123 | # device_class: power 124 | # state_class: measurement 125 | # accuracy_decimals: 0 126 | # update_interval: ${update_interval} 127 | # lambda: |- 128 | # return id(pzem_grid_current).state * id(pzem_grid_voltage).state; 129 | 130 | # - platform: template 131 | # name: "Grid Power VA*PF" 132 | # unit_of_measurement: "W" 133 | # device_class: power 134 | # state_class: measurement 135 | # accuracy_decimals: 0 136 | # update_interval: ${update_interval} 137 | # lambda: |- 138 | # return id(pzem_grid_current).state * id(pzem_grid_voltage).state * id(pzem_grid_power_factor).state; 139 | 140 | ################################### 141 | # Read first group (14 registers) # 142 | ################################### 143 | 144 | - platform: modbus_controller 145 | modbus_controller_id: smg_inverter 146 | name: "Grid Voltage" 147 | address: 4502 148 | register_type: holding 149 | force_new_range: true 150 | register_count: 14 151 | skip_updates: 0 152 | value_type: U_WORD 153 | unit_of_measurement: "V" 154 | device_class: voltage 155 | state_class: measurement 156 | accuracy_decimals: 1 157 | lambda: |- 158 | return swapBytes(x); 159 | filters: 160 | - multiply: 0.1 161 | # - offset: ${inverter_voltage_offset} 162 | # - heartbeat: 10s 163 | 164 | - platform: modbus_controller 165 | modbus_controller_id: smg_inverter 166 | name: "Grid Frequency" 167 | address: 4503 168 | register_type: holding 169 | value_type: U_WORD 170 | unit_of_measurement: "Hz" 171 | device_class: frequency 172 | state_class: measurement 173 | accuracy_decimals: 1 174 | lambda: |- 175 | return swapBytes(x); 176 | filters: 177 | - multiply: 0.1 178 | 179 | - platform: modbus_controller 180 | modbus_controller_id: smg_inverter 181 | name: "PV Voltage" 182 | address: 4504 183 | register_type: holding 184 | value_type: U_WORD 185 | unit_of_measurement: "V" 186 | device_class: voltage 187 | state_class: measurement 188 | accuracy_decimals: 1 189 | lambda: |- 190 | return swapBytes(x); 191 | filters: 192 | - multiply: 0.1 193 | 194 | - platform: modbus_controller 195 | modbus_controller_id: smg_inverter 196 | name: "PV Power" 197 | address: 4505 198 | register_type: holding 199 | value_type: U_WORD 200 | unit_of_measurement: "W" 201 | device_class: power 202 | state_class: measurement 203 | accuracy_decimals: 1 204 | lambda: |- 205 | return swapBytes(x); 206 | 207 | - platform: modbus_controller 208 | modbus_controller_id: smg_inverter 209 | name: "Battery Voltage" 210 | id: battery_voltage 211 | address: 4506 212 | register_type: holding 213 | value_type: U_WORD 214 | unit_of_measurement: "V" 215 | device_class: voltage 216 | state_class: measurement 217 | accuracy_decimals: 2 218 | lambda: |- 219 | return swapBytes(x); 220 | filters: 221 | - multiply: 0.1 222 | 223 | - platform: modbus_controller 224 | modbus_controller_id: smg_inverter 225 | name: "Battery SoC" 226 | accuracy_decimals: 0 227 | unit_of_measurement: "%" 228 | device_class: battery 229 | address: 4507 230 | register_type: holding 231 | value_type: U_WORD 232 | state_class: measurement 233 | lambda: |- 234 | return swapBytes(x); 235 | 236 | - platform: modbus_controller 237 | modbus_controller_id: smg_inverter 238 | name: "Battery Charge Current" 239 | id: battery_charge_current 240 | address: 4508 241 | register_type: holding 242 | value_type: U_WORD 243 | unit_of_measurement: "A" 244 | device_class: current 245 | state_class: measurement 246 | accuracy_decimals: 1 247 | lambda: |- 248 | return swapBytes(x); 249 | 250 | - platform: modbus_controller 251 | modbus_controller_id: smg_inverter 252 | name: "Battery Discharge Current" 253 | id: battery_discharge_current 254 | address: 4509 255 | register_type: holding 256 | value_type: U_WORD 257 | unit_of_measurement: "A" 258 | device_class: current 259 | state_class: measurement 260 | accuracy_decimals: 1 261 | lambda: |- 262 | return swapBytes(x); 263 | 264 | - platform: template 265 | name: "Battery Current" 266 | id: battery_current 267 | unit_of_measurement: "A" 268 | device_class: current 269 | state_class: measurement 270 | accuracy_decimals: 1 271 | update_interval: ${update_interval} 272 | lambda: |- 273 | return id(battery_charge_current).state - id(battery_discharge_current).state; 274 | # filters: 275 | # - heartbeat: 10s 276 | 277 | - platform: template 278 | name: "Battery Power" 279 | unit_of_measurement: "W" 280 | device_class: power 281 | state_class: measurement 282 | accuracy_decimals: 0 283 | update_interval: ${update_interval} 284 | lambda: |- 285 | return id(battery_current).state * id(battery_voltage).state; 286 | 287 | - platform: modbus_controller 288 | modbus_controller_id: smg_inverter 289 | name: "Load Voltage" 290 | id: load_voltage 291 | address: 4510 292 | register_type: holding 293 | value_type: U_WORD 294 | unit_of_measurement: "V" 295 | device_class: voltage 296 | state_class: measurement 297 | accuracy_decimals: 1 298 | lambda: |- 299 | return swapBytes(x); 300 | filters: 301 | - multiply: 0.1 302 | 303 | - platform: modbus_controller 304 | modbus_controller_id: smg_inverter 305 | name: "Load Frequency" 306 | address: 4511 307 | register_type: holding 308 | value_type: U_WORD 309 | unit_of_measurement: "Hz" 310 | device_class: frequency 311 | state_class: measurement 312 | accuracy_decimals: 1 313 | lambda: |- 314 | return swapBytes(x); 315 | filters: 316 | - multiply: 0.1 317 | 318 | - platform: modbus_controller 319 | modbus_controller_id: smg_inverter 320 | name: "Load Power VA" 321 | id: load_Power_VA 322 | address: 4512 323 | register_type: holding 324 | value_type: U_WORD 325 | unit_of_measurement: "VA" 326 | device_class: apparent_power 327 | state_class: measurement 328 | accuracy_decimals: 0 329 | lambda: |- 330 | return swapBytes(x); 331 | 332 | - platform: modbus_controller 333 | modbus_controller_id: smg_inverter 334 | name: "Load Power" 335 | id: load_power 336 | address: 4513 337 | register_type: holding 338 | value_type: U_WORD 339 | unit_of_measurement: "W" 340 | device_class: power 341 | state_class: measurement 342 | accuracy_decimals: 0 343 | lambda: |- 344 | return swapBytes(x); 345 | 346 | 347 | - platform: template 348 | name: "Load Current" 349 | id: load_current 350 | unit_of_measurement: "A" 351 | device_class: current 352 | state_class: measurement 353 | accuracy_decimals: 3 354 | update_interval: ${update_interval} 355 | lambda: |- 356 | if (id(load_voltage).state == 0) { 357 | return 0; 358 | } 359 | return id(load_Power_VA).state / id(load_voltage).state; 360 | 361 | 362 | - platform: template 363 | name: "Load Power Factor" 364 | id: load_power_factor 365 | device_class: power_factor 366 | state_class: measurement 367 | accuracy_decimals: 2 368 | update_interval: ${update_interval} 369 | lambda: |- 370 | if (id(load_power).state == 0) { 371 | return 0; 372 | } 373 | return id(load_power).state / id(load_Power_VA).state; 374 | 375 | 376 | 377 | - platform: modbus_controller 378 | modbus_controller_id: smg_inverter 379 | name: "Load Percent" 380 | address: 4514 381 | register_type: holding 382 | value_type: U_WORD 383 | unit_of_measurement: "%" 384 | device_class: power_factor 385 | state_class: measurement 386 | lambda: |- 387 | return swapBytes(x); 388 | 389 | - platform: modbus_controller 390 | modbus_controller_id: smg_inverter 391 | name: "Load Percent2" 392 | address: 4515 393 | register_type: holding 394 | value_type: U_WORD 395 | unit_of_measurement: "%" 396 | device_class: power_factor 397 | state_class: measurement 398 | lambda: |- 399 | return swapBytes(x); 400 | 401 | # #################################### 402 | # # Read second group (20 registers) # 403 | # #################################### 404 | 405 | 406 | - platform: modbus_controller 407 | modbus_controller_id: smg_inverter 408 | name: "Unknown4516" 409 | address: 4516 410 | force_new_range: true 411 | skip_updates: ${read_skip_updates} 412 | register_type: holding 413 | value_type: U_WORD 414 | # unit_of_measurement: "%" 415 | device_class: power_factor 416 | state_class: measurement 417 | lambda: |- 418 | return swapBytes(x); 419 | 420 | - platform: modbus_controller 421 | modbus_controller_id: smg_inverter 422 | name: "Unknown4517" 423 | address: 4517 424 | register_type: holding 425 | value_type: U_WORD 426 | # unit_of_measurement: "%" 427 | device_class: power_factor 428 | state_class: measurement 429 | lambda: |- 430 | return swapBytes(x); 431 | 432 | - platform: modbus_controller 433 | modbus_controller_id: smg_inverter 434 | name: "Unknown4518" 435 | address: 4518 436 | register_type: holding 437 | value_type: U_WORD 438 | # unit_of_measurement: "%" 439 | device_class: power_factor 440 | state_class: measurement 441 | lambda: |- 442 | return swapBytes(x); 443 | 444 | - platform: modbus_controller 445 | modbus_controller_id: smg_inverter 446 | name: "Unknown4519" 447 | address: 4519 448 | register_type: holding 449 | value_type: U_WORD 450 | # unit_of_measurement: "%" 451 | device_class: power_factor 452 | state_class: measurement 453 | lambda: |- 454 | return swapBytes(x); 455 | 456 | - platform: modbus_controller 457 | modbus_controller_id: smg_inverter 458 | name: "Unknown4520" 459 | address: 4520 460 | register_type: holding 461 | value_type: U_WORD 462 | # unit_of_measurement: "%" 463 | device_class: power_factor 464 | state_class: measurement 465 | lambda: |- 466 | return swapBytes(x); 467 | 468 | - platform: modbus_controller 469 | modbus_controller_id: smg_inverter 470 | name: "Unknown4521" 471 | address: 4521 472 | register_type: holding 473 | value_type: U_WORD 474 | # unit_of_measurement: "%" 475 | device_class: power_factor 476 | state_class: measurement 477 | lambda: |- 478 | return swapBytes(x); 479 | 480 | - platform: modbus_controller 481 | modbus_controller_id: smg_inverter 482 | name: "Unknown4522" 483 | address: 4522 484 | register_type: holding 485 | value_type: U_WORD 486 | # unit_of_measurement: "%" 487 | device_class: power_factor 488 | state_class: measurement 489 | lambda: |- 490 | return swapBytes(x); 491 | 492 | - platform: modbus_controller 493 | modbus_controller_id: smg_inverter 494 | name: "Unknown4523" 495 | address: 4523 496 | register_type: holding 497 | value_type: U_WORD 498 | # unit_of_measurement: "%" 499 | device_class: power_factor 500 | state_class: measurement 501 | lambda: |- 502 | return swapBytes(x); 503 | 504 | - platform: modbus_controller 505 | modbus_controller_id: smg_inverter 506 | name: "Unknown4524" 507 | address: 4524 508 | register_type: holding 509 | value_type: U_WORD 510 | # unit_of_measurement: "%" 511 | device_class: power_factor 512 | state_class: measurement 513 | lambda: |- 514 | return swapBytes(x); 515 | 516 | - platform: modbus_controller 517 | modbus_controller_id: smg_inverter 518 | name: "Unknown4525" 519 | address: 4525 520 | register_type: holding 521 | value_type: U_WORD 522 | # unit_of_measurement: "%" 523 | device_class: power_factor 524 | state_class: measurement 525 | lambda: |- 526 | return swapBytes(x); 527 | 528 | - platform: modbus_controller 529 | modbus_controller_id: smg_inverter 530 | name: "Unknown4526" 531 | address: 4526 532 | register_type: holding 533 | value_type: U_WORD 534 | # unit_of_measurement: "%" 535 | device_class: power_factor 536 | state_class: measurement 537 | lambda: |- 538 | return swapBytes(x); 539 | 540 | - platform: modbus_controller 541 | modbus_controller_id: smg_inverter 542 | name: "Unknown4527" 543 | address: 4527 544 | register_type: holding 545 | value_type: U_WORD 546 | # unit_of_measurement: "%" 547 | device_class: power_factor 548 | state_class: measurement 549 | lambda: |- 550 | return swapBytes(x); 551 | 552 | - platform: modbus_controller 553 | modbus_controller_id: smg_inverter 554 | name: "Unknown4528" 555 | address: 4528 556 | register_type: holding 557 | value_type: U_WORD 558 | # unit_of_measurement: "%" 559 | device_class: power_factor 560 | state_class: measurement 561 | lambda: |- 562 | return swapBytes(x); 563 | 564 | - platform: modbus_controller 565 | modbus_controller_id: smg_inverter 566 | name: "Unknown4529" 567 | address: 4529 568 | register_type: holding 569 | value_type: U_WORD 570 | # unit_of_measurement: "%" 571 | device_class: power_factor 572 | state_class: measurement 573 | lambda: |- 574 | return swapBytes(x); 575 | 576 | - platform: modbus_controller 577 | modbus_controller_id: smg_inverter 578 | name: "Unknown4530" 579 | address: 4530 580 | register_type: holding 581 | value_type: U_WORD 582 | # unit_of_measurement: "%" 583 | device_class: power_factor 584 | state_class: measurement 585 | lambda: |- 586 | return swapBytes(x); 587 | 588 | - platform: modbus_controller 589 | modbus_controller_id: smg_inverter 590 | name: "Unknown4531" 591 | address: 4531 592 | register_type: holding 593 | value_type: U_WORD 594 | # unit_of_measurement: "%" 595 | device_class: power_factor 596 | state_class: measurement 597 | lambda: |- 598 | return swapBytes(x); 599 | 600 | - platform: modbus_controller 601 | modbus_controller_id: smg_inverter 602 | name: "Unknown4532" 603 | address: 4532 604 | register_type: holding 605 | value_type: U_WORD 606 | # unit_of_measurement: "%" 607 | device_class: power_factor 608 | state_class: measurement 609 | lambda: |- 610 | return swapBytes(x); 611 | 612 | - platform: modbus_controller 613 | modbus_controller_id: smg_inverter 614 | name: "Unknown4533" 615 | address: 4533 616 | register_type: holding 617 | value_type: U_WORD 618 | # unit_of_measurement: "%" 619 | device_class: power_factor 620 | state_class: measurement 621 | lambda: |- 622 | return swapBytes(x); 623 | 624 | - platform: modbus_controller 625 | modbus_controller_id: smg_inverter 626 | name: "Unknown4534" 627 | address: 4534 628 | register_type: holding 629 | value_type: U_WORD 630 | # unit_of_measurement: "%" 631 | device_class: power_factor 632 | state_class: measurement 633 | lambda: |- 634 | return swapBytes(x); 635 | 636 | - platform: modbus_controller 637 | modbus_controller_id: smg_inverter 638 | name: "Unknown4535" 639 | address: 4535 640 | register_type: holding 641 | value_type: U_WORD 642 | # unit_of_measurement: "%" 643 | device_class: power_factor 644 | state_class: measurement 645 | lambda: |- 646 | return swapBytes(x); 647 | # 4535 -> binary 648 | 649 | # 4536 -> text 650 | 651 | # 4537 -> text 652 | 653 | # 4538 -> text 654 | 655 | # - platform: modbus_controller 656 | # modbus_controller_id: smg_inverter 657 | # name: "Charger Source Priority" 658 | # address: 4536 659 | # register_type: holding 660 | # value_type: U_WORD 661 | # unit_of_measurement: "%" 662 | # device_class: power_factor 663 | # state_class: measurement 664 | # lambda: |- 665 | # return swapBytes(x); 666 | 667 | # - platform: modbus_controller 668 | # modbus_controller_id: smg_inverter 669 | # name: "Output Source Priority" 670 | # address: 4537 671 | # register_type: holding 672 | # value_type: U_WORD 673 | # unit_of_measurement: "%" 674 | # device_class: power_factor 675 | # state_class: measurement 676 | # lambda: |- 677 | # return swapBytes(x); 678 | 679 | # - platform: modbus_controller 680 | # modbus_controller_id: smg_inverter 681 | # name: "AC Input Voltage Range" 682 | # address: 4538 683 | # register_type: holding 684 | # value_type: U_WORD 685 | # unit_of_measurement: "%" 686 | # device_class: power_factor 687 | # state_class: measurement 688 | # lambda: |- 689 | # return swapBytes(x); 690 | 691 | # #################################### 692 | # # Read third group (22 registers) # 693 | # #################################### 694 | 695 | 696 | - platform: modbus_controller 697 | modbus_controller_id: smg_inverter 698 | name: "Charger Source Priority" 699 | address: 4536 700 | # force_new_range: true 701 | # register_count: 22 702 | skip_updates: ${read_skip_updates} 703 | register_type: holding 704 | value_type: U_WORD 705 | # unit_of_measurement: "%" 706 | device_class: power_factor 707 | state_class: measurement 708 | lambda: |- 709 | return swapBytes(x); 710 | 711 | 712 | - platform: modbus_controller 713 | modbus_controller_id: smg_inverter 714 | name: "Output Source Priority" 715 | address: 4537 716 | register_type: holding 717 | value_type: U_WORD 718 | # unit_of_measurement: "%" 719 | device_class: power_factor 720 | state_class: measurement 721 | lambda: |- 722 | return swapBytes(x); 723 | 724 | - platform: modbus_controller 725 | modbus_controller_id: smg_inverter 726 | name: "AC Input Voltage Range" 727 | address: 4538 728 | register_type: holding 729 | value_type: U_WORD 730 | # unit_of_measurement: "%" 731 | device_class: power_factor 732 | state_class: measurement 733 | lambda: |- 734 | return swapBytes(x); 735 | 736 | - platform: modbus_controller 737 | modbus_controller_id: smg_inverter 738 | name: "Unknown4539" 739 | address: 4539 740 | register_type: holding 741 | value_type: U_WORD 742 | # unit_of_measurement: "%" 743 | device_class: power_factor 744 | state_class: measurement 745 | lambda: |- 746 | return swapBytes(x); 747 | 748 | - platform: modbus_controller 749 | modbus_controller_id: smg_inverter 750 | name: "Target Output Frequency" 751 | accuracy_decimals: 0 752 | entity_category: diagnostic 753 | address: 4540 754 | register_type: holding 755 | value_type: U_WORD 756 | unit_of_measurement: "Hz" 757 | lambda: |- 758 | uint16_t value = swapBytes(x); 759 | switch (value) { 760 | case 0: return std::uint16_t(50); 761 | case 1: return std::uint16_t(60); 762 | default: return x; 763 | } 764 | 765 | - platform: modbus_controller 766 | modbus_controller_id: smg_inverter 767 | name: "Max Total Charging Current" 768 | accuracy_decimals: 0 769 | entity_category: diagnostic 770 | address: 4541 771 | register_type: holding 772 | value_type: U_WORD 773 | unit_of_measurement: "A" 774 | lambda: |- 775 | return swapBytes(x); 776 | 777 | - platform: modbus_controller 778 | modbus_controller_id: smg_inverter 779 | name: "Target Output Voltage" 780 | accuracy_decimals: 0 781 | entity_category: diagnostic 782 | address: 4542 783 | register_type: holding 784 | value_type: U_WORD 785 | unit_of_measurement: "V" 786 | lambda: |- 787 | return swapBytes(x); 788 | 789 | - platform: modbus_controller 790 | modbus_controller_id: smg_inverter 791 | name: "Max Utility Charging Current" 792 | accuracy_decimals: 0 793 | entity_category: diagnostic 794 | address: 4543 795 | register_type: holding 796 | value_type: U_WORD 797 | unit_of_measurement: "A" 798 | lambda: |- 799 | return swapBytes(x); 800 | 801 | - platform: modbus_controller 802 | modbus_controller_id: smg_inverter 803 | name: "Back To Utility Source Voltage" 804 | filters: 805 | - multiply: 0.1 806 | accuracy_decimals: 1 807 | entity_category: diagnostic 808 | address: 4544 809 | register_type: holding 810 | value_type: U_WORD 811 | unit_of_measurement: "V" 812 | lambda: |- 813 | return swapBytes(x); 814 | 815 | - platform: modbus_controller 816 | modbus_controller_id: smg_inverter 817 | name: "Back To Battery Source Voltage" 818 | filters: 819 | - multiply: 0.1 820 | accuracy_decimals: 1 821 | entity_category: diagnostic 822 | address: 4545 823 | register_type: holding 824 | value_type: U_WORD 825 | unit_of_measurement: "V" 826 | lambda: |- 827 | return swapBytes(x); 828 | 829 | - platform: modbus_controller 830 | modbus_controller_id: smg_inverter 831 | name: "Bulk Charging Voltage" 832 | filters: 833 | - multiply: 0.1 834 | accuracy_decimals: 1 835 | entity_category: diagnostic 836 | address: 4546 837 | register_type: holding 838 | value_type: U_WORD 839 | unit_of_measurement: "V" 840 | lambda: |- 841 | return swapBytes(x); 842 | 843 | - platform: modbus_controller 844 | modbus_controller_id: smg_inverter 845 | name: "Floating Charging Voltage" 846 | filters: 847 | - multiply: 0.1 848 | accuracy_decimals: 1 849 | entity_category: diagnostic 850 | address: 4547 851 | register_type: holding 852 | value_type: U_WORD 853 | unit_of_measurement: "V" 854 | lambda: |- 855 | return swapBytes(x); 856 | 857 | - platform: modbus_controller 858 | modbus_controller_id: smg_inverter 859 | name: "Low CutOff Voltage" 860 | filters: 861 | - multiply: 0.1 862 | accuracy_decimals: 1 863 | entity_category: diagnostic 864 | address: 4548 865 | register_type: holding 866 | value_type: U_WORD 867 | unit_of_measurement: "V" 868 | lambda: |- 869 | return swapBytes(x); 870 | 871 | - platform: modbus_controller 872 | modbus_controller_id: smg_inverter 873 | name: "Battery Equalization Voltage" 874 | filters: 875 | - multiply: 0.1 876 | accuracy_decimals: 1 877 | entity_category: diagnostic 878 | address: 4549 879 | register_type: holding 880 | value_type: U_WORD 881 | unit_of_measurement: "V" 882 | lambda: |- 883 | return swapBytes(x); 884 | 885 | - platform: modbus_controller 886 | modbus_controller_id: smg_inverter 887 | name: "Battery Equalized Time" 888 | accuracy_decimals: 0 889 | entity_category: diagnostic 890 | address: 4550 891 | register_type: holding 892 | value_type: U_WORD 893 | lambda: |- 894 | return swapBytes(x); 895 | 896 | - platform: modbus_controller 897 | modbus_controller_id: smg_inverter 898 | name: "Battery Equalized Timeout" 899 | accuracy_decimals: 0 900 | entity_category: diagnostic 901 | address: 4551 902 | register_type: holding 903 | value_type: U_WORD 904 | lambda: |- 905 | return swapBytes(x); 906 | 907 | - platform: modbus_controller 908 | modbus_controller_id: smg_inverter 909 | name: "Equalization Interval" 910 | accuracy_decimals: 0 911 | entity_category: diagnostic 912 | address: 4552 913 | register_type: holding 914 | value_type: U_WORD 915 | lambda: |- 916 | return swapBytes(x); 917 | 918 | # 4553 -> binary 919 | 920 | # 4554 -> binary 921 | 922 | # 4555 -> text 923 | - platform: modbus_controller 924 | modbus_controller_id: smg_inverter 925 | name: "Unknown4553" 926 | accuracy_decimals: 0 927 | entity_category: diagnostic 928 | address: 4553 929 | register_type: holding 930 | value_type: U_WORD 931 | lambda: |- 932 | return swapBytes(x); 933 | 934 | - platform: modbus_controller 935 | modbus_controller_id: smg_inverter 936 | name: "Unknown4554" 937 | accuracy_decimals: 0 938 | entity_category: diagnostic 939 | address: 4554 940 | register_type: holding 941 | value_type: U_WORD 942 | lambda: |- 943 | return swapBytes(x); 944 | 945 | - platform: modbus_controller 946 | modbus_controller_id: smg_inverter 947 | name: "Charger Status" 948 | accuracy_decimals: 0 949 | entity_category: diagnostic 950 | address: 4555 951 | register_type: holding 952 | value_type: U_WORD 953 | lambda: |- 954 | return swapBytes(x); 955 | 956 | - platform: modbus_controller 957 | modbus_controller_id: smg_inverter 958 | name: "Temperature" 959 | accuracy_decimals: 0 960 | entity_category: diagnostic 961 | address: 4556 962 | register_type: holding 963 | unit_of_measurement: "°C" 964 | value_type: U_WORD 965 | lambda: |- 966 | return swapBytes(x); 967 | 968 | - platform: modbus_controller 969 | modbus_controller_id: smg_inverter 970 | name: "Temperature2" 971 | accuracy_decimals: 0 972 | entity_category: diagnostic 973 | address: 4557 974 | register_type: holding 975 | unit_of_measurement: "°C" 976 | value_type: U_WORD 977 | lambda: |- 978 | return swapBytes(x); 979 | #text_sensor: 980 | # - platform: modbus_controller 981 | # modbus_controller_id: smg_inverter 982 | # force_new_range: true 983 | # register_count: 3 984 | # name: "Charger Source Priority" 985 | # address: 4536 986 | # register_type: holding 987 | # lambda: |- 988 | # uint16_t value = swapBytes(x); 989 | # switch (value) { 990 | # case 0: return std::string("Utility first"); 991 | # case 1: return std::string("Solar first"); 992 | # case 2: return std::string("Solar and Utility"); 993 | # case 3: return std::string("Only Solar"); 994 | # default: return x; 995 | # } 996 | 997 | # - platform: modbus_controller 998 | # modbus_controller_id: smg_inverter 999 | # name: "Output Source Priority" 1000 | # address: 4537 1001 | # register_type: holding 1002 | # lambda: |- 1003 | # uint16_t value = swapBytes(x); 1004 | # switch (value) { 1005 | # case 0: return std::string("Utility first (USB)"); 1006 | # case 1: return std::string("Solar first (SUB)"); 1007 | # case 2: return std::string("SBU priority"); 1008 | # default: return x; 1009 | # } 1010 | 1011 | # - platform: modbus_controller 1012 | # modbus_controller_id: smg_inverter 1013 | # name: "AC Input Voltage Range" 1014 | # address: 4538 1015 | # register_type: holding 1016 | # lambda: |- 1017 | # uint16_t value = swapBytes(x); 1018 | # switch (value) { 1019 | # case 0: return std::string("90-280VAC"); 1020 | # case 1: return std::string("170-280VAC"); 1021 | # default: return x; 1022 | # } 1023 | 1024 | binary_sensor: 1025 | 1026 | - platform: modbus_controller 1027 | modbus_controller_id: smg_inverter 1028 | name: "Record Fault Code" 1029 | entity_category: diagnostic 1030 | address: 4535 1031 | register_type: holding 1032 | bitmask: 0x1 1033 | 1034 | - platform: modbus_controller 1035 | modbus_controller_id: smg_inverter 1036 | name: "Battery Equalization" 1037 | entity_category: diagnostic 1038 | address: 4535 1039 | register_type: holding 1040 | bitmask: 0x2 1041 | 1042 | - platform: modbus_controller 1043 | modbus_controller_id: smg_inverter 1044 | name: "Equalization Activated Immediately" 1045 | entity_category: diagnostic 1046 | address: 4535 1047 | register_type: holding 1048 | bitmask: 0x4 1049 | 1050 | - platform: modbus_controller 1051 | modbus_controller_id: smg_inverter 1052 | name: "Alarm" 1053 | entity_category: diagnostic 1054 | address: 4535 1055 | register_type: holding 1056 | bitmask: 0x100 1057 | 1058 | - platform: modbus_controller 1059 | modbus_controller_id: smg_inverter 1060 | name: "Backlight" 1061 | entity_category: diagnostic 1062 | address: 4535 1063 | register_type: holding 1064 | bitmask: 0x400 1065 | 1066 | - platform: modbus_controller 1067 | modbus_controller_id: smg_inverter 1068 | name: "Restart On Overload" 1069 | entity_category: diagnostic 1070 | address: 4535 1071 | register_type: holding 1072 | bitmask: 0x800 1073 | 1074 | - platform: modbus_controller 1075 | modbus_controller_id: smg_inverter 1076 | name: "Restart On Overheat" 1077 | entity_category: diagnostic 1078 | address: 4535 1079 | register_type: holding 1080 | bitmask: 0x1000 1081 | 1082 | - platform: modbus_controller 1083 | modbus_controller_id: smg_inverter 1084 | name: "Beep On Primary Source Fail" 1085 | entity_category: diagnostic 1086 | address: 4535 1087 | register_type: holding 1088 | bitmask: 0x2000 1089 | 1090 | - platform: modbus_controller 1091 | modbus_controller_id: smg_inverter 1092 | name: "Return To Default Screen" 1093 | entity_category: diagnostic 1094 | address: 4535 1095 | register_type: holding 1096 | bitmask: 0x4000 1097 | 1098 | - platform: modbus_controller 1099 | modbus_controller_id: smg_inverter 1100 | name: "Overload Bypass" 1101 | entity_category: diagnostic 1102 | address: 4535 1103 | register_type: holding 1104 | bitmask: 0x8000 1105 | 1106 | - platform: modbus_controller 1107 | modbus_controller_id: smg_inverter 1108 | name: "On Battery 4553 0x100" 1109 | address: 4553 1110 | register_type: holding 1111 | bitmask: 0x100 1112 | 1113 | - platform: modbus_controller 1114 | modbus_controller_id: smg_inverter 1115 | name: "Grid Active 4553 0x200" 1116 | address: 4553 1117 | register_type: holding 1118 | bitmask: 0x200 1119 | 1120 | - platform: modbus_controller 1121 | modbus_controller_id: smg_inverter 1122 | name: "Load Off" 1123 | address: 4553 1124 | register_type: holding 1125 | bitmask: 0x1000 1126 | 1127 | - platform: modbus_controller 1128 | modbus_controller_id: smg_inverter 1129 | name: "Grid Active 4553 0x2000" 1130 | address: 4553 1131 | register_type: holding 1132 | bitmask: 0x2000 1133 | 1134 | - platform: modbus_controller 1135 | modbus_controller_id: smg_inverter 1136 | name: "Load Enabled" 1137 | address: 4553 1138 | register_type: holding 1139 | bitmask: 0x4000 1140 | 1141 | - platform: modbus_controller 1142 | modbus_controller_id: smg_inverter 1143 | name: "On Battery" 1144 | address: 4554 1145 | register_type: holding 1146 | bitmask: 0x1 1147 | 1148 | - platform: modbus_controller 1149 | modbus_controller_id: smg_inverter 1150 | name: "Grid Active 4554 0x100" 1151 | id: grid_active2 1152 | address: 4554 1153 | register_type: holding 1154 | bitmask: 0x100 1155 | 1156 | - platform: modbus_controller 1157 | modbus_controller_id: smg_inverter 1158 | name: "Grid Active" 1159 | id: grid_active 1160 | address: 4554 1161 | register_type: holding 1162 | bitmask: 0x8000 1163 | 1164 | # #################################### 1165 | # # Read config registers one by one # 1166 | # #################################### 1167 | 1168 | 1169 | select: 1170 | #Menu6 -5002 1171 | - platform: modbus_controller 1172 | modbus_controller_id: smg_inverter 1173 | name: "Menu 18: Buzzer Alarm" 1174 | optimistic: true 1175 | force_new_range: true 1176 | register_count: 1 1177 | skip_updates: ${select_skip_updates} 1178 | entity_category: config 1179 | address: 5002 1180 | value_type: U_WORD 1181 | optionsmap: 1182 | "OFF": 0 1183 | "ON": 1 1184 | #Menu6 -5005 1185 | - platform: modbus_controller 1186 | modbus_controller_id: smg_inverter 1187 | name: "Menu 06: Auto restart when overload" 1188 | optimistic: true 1189 | force_new_range: true 1190 | register_count: 1 1191 | skip_updates: ${select_skip_updates} 1192 | entity_category: config 1193 | address: 5005 1194 | value_type: U_WORD 1195 | optionsmap: 1196 | "OFF": 0 1197 | "ON": 1 1198 | 1199 | #Menu7 -5006 1200 | - platform: modbus_controller 1201 | modbus_controller_id: smg_inverter 1202 | name: "Menu 07: Auto restart when overheat" 1203 | optimistic: true 1204 | force_new_range: true 1205 | register_count: 1 1206 | skip_updates: ${select_skip_updates} 1207 | entity_category: config 1208 | address: 5006 1209 | value_type: U_WORD 1210 | optionsmap: 1211 | "OFF": 0 1212 | "ON": 1 1213 | 1214 | #menu22-5007 1215 | - platform: modbus_controller 1216 | modbus_controller_id: smg_inverter 1217 | name: "Menu 22: Beep On Primary Source Fail" 1218 | optimistic: true 1219 | force_new_range: true 1220 | register_count: 1 1221 | skip_updates: ${select_skip_updates} 1222 | entity_category: config 1223 | address: 5007 1224 | value_type: U_WORD 1225 | optionsmap: 1226 | "OFF": 0 1227 | "ON": 1 1228 | 1229 | #menu23 - 5009 1230 | - platform: modbus_controller 1231 | modbus_controller_id: smg_inverter 1232 | name: "Menu 23: Overload Bypass" 1233 | optimistic: true 1234 | force_new_range: true 1235 | register_count: 1 1236 | skip_updates: ${select_skip_updates} 1237 | entity_category: config 1238 | address: 5009 1239 | value_type: U_WORD 1240 | optionsmap: 1241 | "OFF": 0 1242 | "ON": 1 1243 | 1244 | #menu16 -5017 1245 | - platform: modbus_controller 1246 | modbus_controller_id: smg_inverter 1247 | id: charger_source_priority_select 1248 | name: "Menu 16: Charger Source Priority" 1249 | optimistic: true 1250 | force_new_range: true 1251 | register_count: 1 1252 | skip_updates: ${select_skip_updates} 1253 | entity_category: config 1254 | address: 5017 1255 | value_type: U_WORD 1256 | optionsmap: 1257 | "Utility first": 0 1258 | "Solar first": 1 1259 | "Solar and Utility": 2 1260 | "Only Solar": 3 1261 | 1262 | #Menu1 -5018 1263 | - platform: modbus_controller 1264 | modbus_controller_id: smg_inverter 1265 | id: output_source_priority_select 1266 | name: "Menu 01: Output Source Priority" 1267 | optimistic: true 1268 | force_new_range: true 1269 | register_count: 1 1270 | skip_updates: ${select_skip_updates} 1271 | entity_category: config 1272 | address: 5018 1273 | value_type: U_WORD 1274 | optionsmap: 1275 | "Utility first (USB)": 0 1276 | "Solar first (SUB)": 1 1277 | "SBU priority": 2 1278 | 1279 | 1280 | #Menu3-5019 1281 | - platform: modbus_controller 1282 | modbus_controller_id: smg_inverter 1283 | name: "Menu 03: AC Input Voltage" 1284 | optimistic: true 1285 | force_new_range: true 1286 | register_count: 1 1287 | skip_updates: ${select_skip_updates} 1288 | entity_category: config 1289 | address: 5019 1290 | value_type: U_WORD 1291 | optionsmap: 1292 | "90-280VAC": 0 1293 | "170-280VAC": 1 1294 | #Menu4 -? 1295 | #Menu5 -5020 1296 | - platform: modbus_controller 1297 | modbus_controller_id: smg_inverter 1298 | name: "Menu 05: Battery Type" 1299 | optimistic: true 1300 | force_new_range: true 1301 | register_count: 1 1302 | skip_updates: ${select_skip_updates} 1303 | entity_category: config 1304 | address: 5020 1305 | value_type: U_WORD 1306 | optionsmap: 1307 | "AGM": 0 1308 | "Flooded": 1 1309 | "User Defined": 2 1310 | "Litium": 3 1311 | 1312 | 1313 | 1314 | #Menu8 -? 1315 | #Menu9 -5021 Output frequency 0 - 50hz, 1 - 60hz 1316 | 1317 | #Menu2-5022 1318 | - platform: modbus_controller 1319 | modbus_controller_id: smg_inverter 1320 | name: "Menu 02: Max Total Charge Current" 1321 | optimistic: true 1322 | force_new_range: true 1323 | register_count: 1 1324 | skip_updates: ${select_skip_updates} 1325 | entity_category: config 1326 | address: 5022 1327 | value_type: U_WORD 1328 | optionsmap: 1329 | "10": 10 1330 | "20": 20 1331 | "30": 30 1332 | "40": 40 1333 | "50": 50 1334 | "60": 60 1335 | "70": 70 1336 | "80": 80 1337 | 1338 | #Menu10 -5023 Output voltage (one of 220, 230, 240) 1339 | 1340 | #Menu11 - 5024 1341 | - platform: modbus_controller 1342 | modbus_controller_id: smg_inverter 1343 | name: "Menu 11: Max Utility Charge Current" 1344 | optimistic: true 1345 | force_new_range: true 1346 | register_count: 1 1347 | skip_updates: ${select_skip_updates} 1348 | entity_category: config 1349 | address: 5024 1350 | value_type: U_WORD 1351 | optionsmap: 1352 | "10": 10 1353 | "20": 20 1354 | "30": 30 1355 | "40": 40 1356 | "50": 50 1357 | "60": 60 1358 | 1359 | #Menu12 - 5025 1360 | - platform: modbus_controller 1361 | modbus_controller_id: smg_inverter 1362 | name: "Menu 12: Back To Utility Source Voltage" 1363 | optimistic: true 1364 | force_new_range: true 1365 | register_count: 1 1366 | skip_updates: ${select_skip_updates} 1367 | entity_category: config 1368 | address: 5025 1369 | value_type: U_WORD 1370 | optionsmap: 1371 | "21": 210 1372 | "21.5": 215 1373 | "22": 220 1374 | "22.5": 225 1375 | "23": 230 1376 | "23.5": 235 1377 | "24": 240 1378 | "24.5": 245 1379 | "25": 250 1380 | "25.5": 255 1381 | 1382 | #Menu13 - 5026 1383 | - platform: modbus_controller 1384 | modbus_controller_id: smg_inverter 1385 | name: "Menu 13: Back To Battery Source Voltage" 1386 | optimistic: true 1387 | force_new_range: true 1388 | register_count: 1 1389 | skip_updates: ${select_skip_updates} 1390 | entity_category: config 1391 | address: 5026 1392 | value_type: U_WORD 1393 | optionsmap: 1394 | "FULL": 0 1395 | "24": 240 1396 | "24.5": 245 1397 | "25": 250 1398 | "25.5": 255 1399 | "26": 260 1400 | "26.5": 265 1401 | "27": 270 1402 | "27.5": 275 1403 | "28": 280 1404 | "28.5": 285 1405 | "29": 290 1406 | 1407 | #Menu26 - 5027 Bulk charging voltage 1408 | #Menu27 - 5028 Floating charging voltage 1409 | #Menu28 - 5029 Low DC cut-off voltage 1410 | #Menu29 - 5030 Battery equalization voltage 1411 | #Menu33 - 5031 Battery equalized time 1412 | #Menu34 - 5032 Battery equalized timeout 1413 | #Menu35 - 5033 Equalization interval 1414 | --------------------------------------------------------------------------------