hello i want to send my PV Data from my growatt direktly to my VenusOS.
At the moment ich use ESP Home on a Growatt Stick to collect the Data. and send it via MQTT. in the second part i send the values via Node Red on my VenusOS via Nod.
Now i want to try to send the data directly. my yaml works fine without the send part.
substitutions:
devicename: "esphome-growatt-01"
upper_devicename: "ESPHome Growatt 01"
esphome:
name: $devicename
platform: ESP8266
board: esp07s
# Enable logging
logger:
baud_rate: 0
# Enable Home Assistant API
#api:
# password: "01234"
mqtt:
broker: 192.168.1.12
port: 1884
username: Nils
password: !secret mqtt_password
ota:
password: "01234"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "GGrowatt"
password: "oLjULFvNXq1l"
# Enable Web server
web_server:
port: 80
captive_portal:
#time:
# - platform: homeassistant
# id: homeassistant_time
output:
# Blue Led
- id: light_bl
platform: gpio
pin: 16
# Green Led
- id: light_gr
platform: gpio
pin: 0
# Red Led
- id: light_rd
platform: gpio
pin: 2
uart:
id: mod_bus
tx_pin: 1
rx_pin: 3
baud_rate: 115200
modbus:
id: modbus1
uart_id: mod_bus
modbus_controller:
- id: growatt
# the Modbus device addr
address: 0x1
modbus_id: modbus1
update_interval: 10s
setup_priority: -10
sensor:
- platform: modbus_controller
name: "${devicename} DcPower"
address: 5
register_type: "read"
unit_of_measurement: W
device_class: power
icon: mdi:flash
value_type: U_DWORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${devicename} DcVoltage"
address: 3
register_type: "read"
unit_of_measurement: V
device_class: voltage
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${devicename} DcInputCurrent"
address: 4
register_type: "read"
unit_of_measurement: A
device_class: current
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${devicename} AcFrequency"
address: 37
register_type: "read"
unit_of_measurement: Hz
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.01
- platform: modbus_controller
name: "${devicename} AcVoltage"
id: pv_voltage
address: 38
register_type: "read"
unit_of_measurement: V
device_class: voltage
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${devicename} AcOutputCurrent"
id: pv_current
address: 39
register_type: "read"
unit_of_measurement: A
device_class: current
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${devicename} AcPower"
id: pv_power
address: 40
register_type: "read"
unit_of_measurement: W
device_class: power
icon: mdi:flash
value_type: U_DWORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${devicename} EnergyToday"
address: 53
register_type: "read"
unit_of_measurement: kWh
device_class: energy
icon: mdi:flash
value_type: U_DWORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${devicename} EnergyTotal"
id: pv_energy_forward
address: 55
register_type: "read"
unit_of_measurement: kWh
state_class: total_increasing
device_class: energy
icon: mdi:flash
value_type: U_DWORD
accuracy_decimals: 2
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${devicename} Temperature"
address: 93
register_type: "read"
unit_of_measurement: C
device_class: temperature
icon: mdi:thermometer
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: mqtt_subscribe
name: "mqtttest"
id: mqtttest
topic: the/topic
on_value:
then:
- lambda: |-
esphome::modbus_controller::ModbusController *controller = id(growatt);
uint16_t reg = 3; // Register: Max output active power (in %)
float value = id(mqtttest).state;
uint16_t register_value = static_cast<uint16_t>(value);
modbus_controller::ModbusCommandItem setOutputPower_command = modbus_controller::ModbusCommandItem::create_write_single_command(controller, reg, register_value);
controller->queue_command(setOutputPower_command);
#- platform: mqtt_subscribe
# name: "mqtttest"
# id: mqtttest
# topic: the/topic
# on_value:
# lambda: |-
# id(poweroutput).state;
#neu test power factor 02/2023
number:
- platform: modbus_controller
name: "${devicename} Max Output Active Power"
id: poweroutput
address: 3
value_type: U_WORD
min_value: 0
max_value: 100
entity_category: config
step: 1
the mqtt message should have this json
msg.payload = {
"pv": {
"power": msg.payload["P"],
"voltage": msg.payload["V"],
"current": msg.payload["I"],
"energy_forward": msg.payload["W"],
"L1": {
"power": msg.payload["P"],
"voltage": msg.payload["V"],
"current": msg.payload["I"],
"energy_forward": msg.payload["W"],
}
}
}
return msg;
this is my first try
- platform: modbus_controller
name: "${devicename} AcPower"
id: pv_power
address: 40
register_type: "read"
unit_of_measurement: W
device_class: power
icon: mdi:flash
value_type: U_DWORD
accuracy_decimals: 1
filters:
- multiply: 0.1
on_value:
- mqtt.publish_json:
topic: "Growatt/mic2000/meters"
payload: |-
return {"pv": {
power": id(pv_power).state,
"voltage": id(pv_voltage).state,
"current": id(pv_current).state,
"energy_forward": id(pv_energy_forward).state,
"L1": {
"power": id(pv_power).state,
"voltage": id(pv_voltage).state,
"current": id(pv_current).state,
"energy_forward": id(pv_energy_forward).state,
}
}};