Closed aver-ua closed 3 months ago
Hello, just FYI: POW-HVM3.6M-24V
issue 3 fixed by editing /modules/inverter.yaml
and flashing new firmware:
- platform: modbus_controller
name: "Max Total Charge Current"
optimistic: true
skip_updates: ${select_skip_updates}
entity_category: config
address: 5022
value_type: U_WORD
optionsmap:
"10": 10
"20": 20
"30": 30
"40": 40
"50": 50
"60": 60
"70": 70
"80": 80
"90": 90
"100": 100
"110": 110
"120": 120
"130": 130
"140": 140
- platform: modbus_controller
name: "Utility Charge Current"
optimistic: true
skip_updates: ${select_skip_updates}
entity_category: config
address: 5024
value_type: U_WORD
optionsmap:
"10": 10
"20": 20
"30": 30
"40": 40
"50": 50
"60": 60
"70": 70
"80": 80
"90": 90
"100": 100
issue 1, "Charger Status". i have an additional information. when there is no utility power and inverter works on battery, "Charger Status"='0a00'. when utility is back, "Charger Status"='0d00'. additionaly, i noticed that binary sensor "On Battery" does not changed its state. it is always 'off'.
how to get working binary sensors "On Battery" and "Grid Active" (verified!)
- platform: modbus_controller
modbus_controller_id: smg_inverter
name: "Grid Active"
id: grid_active
address: 4553
register_type: holding
bitmask: 0x200
- platform: modbus_controller
modbus_controller_id: smg_inverter
name: "On Battery"
address: 4553
register_type: holding
bitmask: 0x100
and temperature sensor:
- platform: modbus_controller
modbus_controller_id: smg_inverter
name: "PV Temperature"
accuracy_decimals: 1
entity_category: diagnostic
address: 4557
register_type: holding
value_type: U_WORD
unit_of_measurement: "°C"
lambda: |-
return swapBytes(x);
i confirm that this is PV Temperature, not inverter internal temperature. so, tеhere should be an inverter temperature register somewhere else.. can someone guess where?
@aver-ua, to fix Charger Status
, you can use this config I made:
- platform: modbus_controller
modbus_controller_id: smg_inverter
name: "Charger Status"
address: 4555
register_type: holding
response_size: 2
raw_encode: HEXBYTES
lambda: |-
uint16_t sensorIndex = swapBytes(modbus_controller::word_from_hex_str(x, 0));
uint8_t byte = sensorIndex & 0x7;
switch (byte) {
case 2: return std::string("Off");
case 5: return std::string("Idle");
case 4: return std::string("Charging");
default: return std::string(x);
}
And thanks for your fix to Grid Active
and On Battery
sensors!
@Andreychik32 , my further investigations about Grid Active
and On Battery
sensor says that their behavior depended on PV power. if PV power is enough and there is no utility power, then sensors states Grid Active
and On Battery
will be: On
and Off
. if PV power is not enough, but it is present - Off
and On
. in short, On Battery
will be On
only if battery power is running out, Grid Active
will be On
if utility power present or PV power is enough. so, you can't use the sensor Grid Active
to determine state of utility if you have PV... maybe only at night :smirk:
thanks for your config for Charger Status
, but I think that this sensor represents only solar charger, because its state Idle
permanently even if battery is charged from utility. I can’t check charging from PV yet.
and there was also an incomprehensible state 0b00
Hi, at the moment my value is "Charger Status". 0c00. I noticed that when charging the battery the "Grid Active" is on and the "On Battery" is Off.
@odya , for POW-HVM4.2M-24V i've added/changed:
inverter.yaml
:
# added for "Battery Daily Charge Energy" sensor
- platform: template
name: "Battery Charge Power"
id: battery_charge_power
unit_of_measurement: "W"
device_class: power
state_class: measurement
accuracy_decimals: 0
update_interval: ${update_interval}
lambda: |-
return id(battery_charge_current).state * id(battery_voltage).state;
# added for "Battery Daily Discharge Energy" sensor
- platform: template
name: "Battery Discharge Power"
id: battery_discharge_power
unit_of_measurement: "W"
device_class: power
state_class: measurement
accuracy_decimals: 0
update_interval: ${update_interval}
lambda: |-
return id(battery_discharge_current).state * id(battery_voltage).state;
# added PV Temperature
- platform: modbus_controller
modbus_controller_id: smg_inverter
name: "PV Temperature"
accuracy_decimals: 0
entity_category: diagnostic
address: 4557
register_type: holding
value_type: U_WORD
unit_of_measurement: "°C"
lambda: |-
return swapBytes(x);
# added - monitoring external utility AC
- platform: modbus_controller
modbus_controller_id: smg_inverter
name: "AC Active"
address: 4553
register_type: holding
bitmask: 0x2000
# changed address
- platform: modbus_controller
modbus_controller_id: smg_inverter
name: "Grid Active"
id: grid_active
address: 4553
register_type: holding
bitmask: 0x200
# changed address
- platform: modbus_controller
modbus_controller_id: smg_inverter
name: "On Battery"
address: 4553
register_type: holding
bitmask: 0x100
# changed lambda
- platform: modbus_controller
modbus_controller_id: smg_inverter
name: "Charger Status"
address: 4555
register_type: holding
response_size: 2
raw_encode: HEXBYTES
lambda: |-
uint16_t sensorIndex = swapBytes(modbus_controller::word_from_hex_str(x, 0));
switch (sensorIndex) {
case 10: return std::string("Off");
case 11: return std::string("Idle");
case 13: return std::string("Charging");
default: return std::string(x);
}
# changes in write registers (configuration)
select:
- platform: modbus_controller
name: "Buzzer Alarm"
optimistic: true
skip_updates: ${select_skip_updates}
entity_category: config
address: 5002
value_type: U_WORD
optionsmap:
"Off": 0
"On": 1
# added
- platform: modbus_controller
name: "Backlight"
optimistic: true
skip_updates: ${select_skip_updates}
entity_category: config
address: 5004
value_type: U_WORD
force_new_range: true
optionsmap:
"Off": 0
"On": 1
# added
- platform: modbus_controller
name: "Restart On Overload"
optimistic: true
skip_updates: ${select_skip_updates}
entity_category: config
address: 5005
value_type: U_WORD
optionsmap:
"Off": 0
"On": 1
# added
- platform: modbus_controller
name: "Restart On Overheat"
optimistic: true
skip_updates: ${select_skip_updates}
entity_category: config
address: 5006
value_type: U_WORD
force_new_range: true
optionsmap:
"Off": 0
"On": 1
- platform: modbus_controller
name: "Beep On Primary Source Fail"
optimistic: true
skip_updates: ${select_skip_updates}
entity_category: config
address: 5007
value_type: U_WORD
optionsmap:
"Off": 0
"On": 1
# added
- platform: modbus_controller
name: "Return To Default Display"
optimistic: true
skip_updates: ${select_skip_updates}
entity_category: config
address: 5008
value_type: U_WORD
force_new_range: true
optionsmap:
"Off": 0
"On": 1
- platform: modbus_controller
name: "Overload Bypass"
optimistic: true
skip_updates: ${select_skip_updates}
entity_category: config
address: 5009
value_type: U_WORD
optionsmap:
"Off": 0
"On": 1
- platform: modbus_controller
id: charger_source_priority_select
name: "Charger Source Priority"
optimistic: true
skip_updates: ${select_skip_updates}
force_new_range: true
entity_category: config
address: 5017
value_type: U_WORD
optionsmap:
"Utility first": 0
"Solar first": 1
"Solar and Utility": 2
"Only Solar": 3
- platform: modbus_controller
id: output_source_priority_select
name: "Output Source Priority"
optimistic: true
skip_updates: ${select_skip_updates}
entity_category: config
address: 5018
value_type: U_WORD
optionsmap:
"Utility first (USB)": 0
"Solar first (SUB)": 1
"SBU priority": 2
# added
- platform: modbus_controller
name: "AC input voltage range"
optimistic: true
skip_updates: ${select_skip_updates}
entity_category: config
address: 5019
force_new_range: true
value_type: U_WORD
optionsmap:
"APL (90-280)": 0
"UPS (170-280)": 1
# added
- platform: modbus_controller
name: "Battery type"
optimistic: true
skip_updates: ${select_skip_updates}
entity_category: config
address: 5020
value_type: U_WORD
optionsmap:
"AGM": 0
"Flooded": 1
"User Defined": 2
# added 90-140
- platform: modbus_controller
name: "Max Total Charge Current"
optimistic: true
skip_updates: ${select_skip_updates}
entity_category: config
address: 5022
value_type: U_WORD
optionsmap:
"10": 10
"20": 20
"30": 30
"40": 40
"50": 50
"60": 60
"70": 70
"80": 80
"90": 90
"100": 100
"110": 110
"120": 120
"130": 130
"140": 140
# added 70-100
- platform: modbus_controller
name: "Utility Charge Current"
optimistic: true
skip_updates: ${select_skip_updates}
entity_category: config
address: 5024
value_type: U_WORD
optionsmap:
"10": 10
"20": 20
"30": 30
"40": 40
"50": 50
"60": 60
"70": 70
"80": 80
"90": 90
"100": 100
# added numbers:
number:
- platform: modbus_controller
name: "Back To Utility Source Voltage"
skip_updates: ${select_skip_updates}
entity_category: config
address: 5025
value_type: U_WORD
force_new_range: true
min_value: 21.0
max_value: 25.5
step: 0.5
multiply: 10
- platform: modbus_controller
name: "Back To Battery Source Voltage"
skip_updates: ${select_skip_updates}
entity_category: config
address: 5026
value_type: U_WORD
min_value: 24.0
max_value: 29.0
step: 0.5
multiply: 10
- platform: modbus_controller
name: "Bulk Charging Voltage"
skip_updates: ${select_skip_updates}
entity_category: config
address: 5027
value_type: U_WORD
force_new_range: true
min_value: 25.0
max_value: 31.5
step: 0.1
multiply: 10
- platform: modbus_controller
name: "Floating Charging Voltage"
skip_updates: ${select_skip_updates}
entity_category: config
address: 5028
value_type: U_WORD
min_value: 25.0
max_value: 31.5
step: 0.1
multiply: 10
common_sensors.yaml
:
uptime human readable, wifi signal %, total daily energy for PV, Load, Battery Charge & Discharge, restart ESP button
- platform: uptime
name: "Uptime"
id: esp_uptime
entity_category: "diagnostic"
device_class: duration
update_interval: 60s
on_raw_value:
then:
- text_sensor.template.publish:
id: uptime_human
state: !lambda |-
int seconds = round(id(esp_uptime).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? String(days) + "d " : "") +
(hours ? String(hours) + "h " : "") +
(minutes ? String(minutes) + "m " : "") +
(String(seconds) + "s")
).c_str();
- platform: wifi_signal
name: "RSSI"
id: wifi_rssi
entity_category: "diagnostic"
update_interval: 60s
- platform: copy # Reports the WiFi signal strength in %
source_id: wifi_rssi
name: "WiFi Signal Percent"
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "%"
entity_category: "diagnostic"
- platform: total_daily_energy
name: "Daily Energy"
power_id: load_power
unit_of_measurement: 'kWh'
state_class: total_increasing
device_class: energy
accuracy_decimals: 3
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
- platform: total_daily_energy
name: "PV Daily Energy"
power_id: pv_power
unit_of_measurement: 'kWh'
state_class: total_increasing
device_class: energy
accuracy_decimals: 3
filters:
- multiply: 0.001
- platform: total_daily_energy
name: "Battery Daily Charge Energy"
power_id: battery_charge_power
unit_of_measurement: 'kWh'
state_class: total_increasing
device_class: energy
accuracy_decimals: 3
filters:
- multiply: 0.001
- platform: total_daily_energy
name: "Battery Daily Discharge Energy"
power_id: battery_discharge_power
unit_of_measurement: 'kWh'
state_class: total_increasing
device_class: energy
accuracy_decimals: 3
filters:
- multiply: 0.001
text_sensor:
# Uptime Human Readable
- platform: template
name: "Uptime HR"
id: uptime_human
icon: mdi:clock-start
button:
# Restart ESP
- platform: restart
name: 'Restart ESP'
all of the above works without problems
Feel free to make PR😉
hi. thanks a lot for your work. i have POW-HVM4.2M-24V inverter. there are some issues that i found.