This is how I do it. I’ve renamed my shelly em’s to Utility and Solar. Home assistant sensor and utility meter config pasted below.
[
{
"id": "bcba7892.f81718",
"type": "api-current-state",
"z": "3ecef44f.692d0c",
"name": "Daily Solar",
"server": "cbbf6ce3.4f5eb",
"version": 1,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"override_topic": false,
"entity_id": "sensor.daily_solar_energy_wh",
"state_type": "str",
"state_location": "payload",
"override_payload": "msg",
"entity_location": "",
"override_data": "none",
"blockInputOverrides": false,
"x": 210,
"y": 620,
"wires": [
[
"91ccdcd1.126c2"
]
]
},
{
"id": "ba80a412.30d8b8",
"type": "inject",
"z": "3ecef44f.692d0c",
"name": "Every 5 Minutes",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "300",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 230,
"y": 540,
"wires": [
[
"bcba7892.f81718",
"12cf0de3.3d1642",
"e3acb2c1.7a983",
"27f9ebae.0c5e14",
"cb1b8a.3b766478",
"88e8e360.2b18e",
"3ea9a1a8.cb079e",
"4e320437.1c9b7c"
]
]
},
{
"id": "b0ef636d.fa8a5",
"type": "join",
"z": "3ecef44f.692d0c",
"name": "",
"mode": "custom",
"build": "object",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "8",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 650,
"y": 540,
"wires": [
[
"e60ed32d.448f"
]
]
},
{
"id": "91ccdcd1.126c2",
"type": "change",
"z": "3ecef44f.692d0c",
"name": "V1",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "v1",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 470,
"y": 620,
"wires": [
[
"b0ef636d.fa8a5"
]
]
},
{
"id": "12cf0de3.3d1642",
"type": "api-current-state",
"z": "3ecef44f.692d0c",
"name": "Total Solar Power",
"server": "cbbf6ce3.4f5eb",
"version": 1,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"override_topic": false,
"entity_id": "sensor.total_solar_power",
"state_type": "str",
"state_location": "payload",
"override_payload": "msg",
"entity_location": "",
"override_data": "none",
"blockInputOverrides": false,
"x": 230,
"y": 660,
"wires": [
[
"708af9f1.e1ff28"
]
]
},
{
"id": "e3acb2c1.7a983",
"type": "api-current-state",
"z": "3ecef44f.692d0c",
"name": "Daily Consumed",
"server": "cbbf6ce3.4f5eb",
"version": 1,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"override_topic": false,
"entity_id": "sensor.daily_consumed_energy_wh",
"state_type": "str",
"state_location": "payload",
"override_payload": "msg",
"entity_location": "",
"override_data": "none",
"blockInputOverrides": false,
"x": 220,
"y": 700,
"wires": [
[
"a3029cb7.1ef1c"
]
]
},
{
"id": "27f9ebae.0c5e14",
"type": "api-current-state",
"z": "3ecef44f.692d0c",
"name": "Consumed Power",
"server": "cbbf6ce3.4f5eb",
"version": 1,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"override_topic": false,
"entity_id": "sensor.total_consumed_power",
"state_type": "str",
"state_location": "payload",
"override_payload": "msg",
"entity_location": "",
"override_data": "none",
"blockInputOverrides": false,
"x": 230,
"y": 740,
"wires": [
[
"b77b4aca.2f1178"
]
]
},
{
"id": "cb1b8a.3b766478",
"type": "api-current-state",
"z": "3ecef44f.692d0c",
"name": "Temperature",
"server": "cbbf6ce3.4f5eb",
"version": 1,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"override_topic": false,
"entity_id": "sensor.temperature",
"state_type": "str",
"state_location": "payload",
"override_payload": "msg",
"entity_location": "",
"override_data": "none",
"blockInputOverrides": false,
"x": 210,
"y": 780,
"wires": [
[
"66dd12e5.e2bffc"
]
]
},
{
"id": "88e8e360.2b18e",
"type": "api-current-state",
"z": "3ecef44f.692d0c",
"name": "Volts",
"server": "cbbf6ce3.4f5eb",
"version": 1,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"override_topic": false,
"entity_id": "sensor.utility_voltage",
"state_type": "str",
"state_location": "payload",
"override_payload": "msg",
"entity_location": "",
"override_data": "none",
"blockInputOverrides": false,
"x": 190,
"y": 820,
"wires": [
[
"3800e3d4.15a57c"
]
]
},
{
"id": "708af9f1.e1ff28",
"type": "change",
"z": "3ecef44f.692d0c",
"name": "V2",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "v2",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 470,
"y": 660,
"wires": [
[
"b0ef636d.fa8a5"
]
]
},
{
"id": "a3029cb7.1ef1c",
"type": "change",
"z": "3ecef44f.692d0c",
"name": "V3",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "v3",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 470,
"y": 700,
"wires": [
[
"b0ef636d.fa8a5"
]
]
},
{
"id": "b77b4aca.2f1178",
"type": "change",
"z": "3ecef44f.692d0c",
"name": "V4",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "v4",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 470,
"y": 740,
"wires": [
[
"b0ef636d.fa8a5"
]
]
},
{
"id": "66dd12e5.e2bffc",
"type": "change",
"z": "3ecef44f.692d0c",
"name": "V5",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "v5",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 470,
"y": 780,
"wires": [
[
"b0ef636d.fa8a5"
]
]
},
{
"id": "3800e3d4.15a57c",
"type": "change",
"z": "3ecef44f.692d0c",
"name": "V6",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "v6",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 470,
"y": 820,
"wires": [
[
"b0ef636d.fa8a5"
]
]
},
{
"id": "4af04a29.1038a4",
"type": "function",
"z": "3ecef44f.692d0c",
"name": "Set API key and site ID",
"func": "msg.action = msg.payload;\nmsg.headers = { \n 'X-Pvoutput-Apikey': 'sd0fusoijflksd',\n 'X-Pvoutput-SystemId': '0909098',\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 720,
"y": 640,
"wires": [
[
"1203ae8.a034a52"
]
]
},
{
"id": "1203ae8.a034a52",
"type": "function",
"z": "3ecef44f.692d0c",
"name": "Set up data",
"func": "msg.action = msg.payload;\n\nmsg.url = \"http://pvoutput.org/service/r2/addstatus.jsp\";\n\n\n\nreturn msg;\n\n",
"outputs": 1,
"noerr": 0,
"x": 710,
"y": 700,
"wires": [
[
"8103e596.265d78"
]
]
},
{
"id": "8103e596.265d78",
"type": "http request",
"z": "3ecef44f.692d0c",
"name": "Post",
"method": "POST",
"ret": "txt",
"paytoqs": false,
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 710,
"y": 760,
"wires": [
[
"6baee9d7.af3e38"
]
]
},
{
"id": "6baee9d7.af3e38",
"type": "debug",
"z": "3ecef44f.692d0c",
"name": "headercheck",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 710,
"y": 820,
"wires": []
},
{
"id": "3ea9a1a8.cb079e",
"type": "moment",
"z": "3ecef44f.692d0c",
"name": "Date",
"topic": "d",
"input": "",
"inputType": "date",
"inTz": "America/Edmonton",
"adjAmount": 0,
"adjType": "days",
"adjDir": "add",
"format": "YYYYMMDD",
"locale": "C",
"output": "payload",
"outputType": "msg",
"outTz": "America/Edmonton",
"x": 470,
"y": 540,
"wires": [
[
"b0ef636d.fa8a5"
]
]
},
{
"id": "4e320437.1c9b7c",
"type": "moment",
"z": "3ecef44f.692d0c",
"name": "Time",
"topic": "t",
"input": "",
"inputType": "date",
"inTz": "America/Edmonton",
"adjAmount": 0,
"adjType": "days",
"adjDir": "add",
"format": "HH:mm",
"locale": "C",
"output": "payload",
"outputType": "msg",
"outTz": "America/Edmonton",
"x": 470,
"y": 580,
"wires": [
[
"b0ef636d.fa8a5"
]
]
},
{
"id": "e60ed32d.448f",
"type": "delay",
"z": "3ecef44f.692d0c",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "5",
"rateUnits": "minute",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"x": 700,
"y": 580,
"wires": [
[
"4af04a29.1038a4"
]
]
},
{
"id": "cbbf6ce3.4f5eb",
"type": "server",
"z": "",
"name": "Home Assistant",
"legacy": false,
"addon": true,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": false
}
]
sensor config
- platform: mqtt
name: "Utility Power 1"
state_topic: "shellies/Utility/emeter/0/power"
qos: 1
unit_of_measurement: "W"
icon: mdi:gauge
- platform: mqtt
name: "Utility Power 2"
state_topic: "shellies/Utility/emeter/1/power"
qos: 1
unit_of_measurement: "W"
icon: mdi:gauge
- platform: mqtt
name: "Utility Voltage"
state_topic: "shellies/Utility/emeter/1/voltage"
qos: 1
unit_of_measurement: "V"
icon: mdi:gauge
- platform: mqtt
name: "Utility Energy 1"
state_topic: "shellies/Utility/emeter/0/energy"
qos: 1
unit_of_measurement: "Wm"
- platform: mqtt
name: "Utility Energy 2"
state_topic: "shellies/Utility/emeter/1/energy"
qos: 1
unit_of_measurement: "Wm"
- platform: mqtt
name: "Solar Power 1 Raw"
state_topic: "shellies/Solar/emeter/0/power"
qos: 1
unit_of_measurement: "W"
icon: mdi:gauge
- platform: mqtt
name: "Solar Power 2 Raw"
state_topic: "shellies/Solar/emeter/1/power"
qos: 1
unit_of_measurement: "W"
icon: mdi:gauge
- platform: mqtt
name: "Solar Voltage"
state_topic: "shellies/Solar/emeter/1/voltage"
qos: 1
unit_of_measurement: "V"
icon: mdi:gauge
- platform: mqtt
name: "Solar Energy 1"
state_topic: "shellies/Solar/emeter/0/energy"
qos: 1
unit_of_measurement: "Wm"
- platform: mqtt
name: "Solar Energy 2"
state_topic: "shellies/Solar/emeter/1/energy"
qos: 1
unit_of_measurement: "Wm"
- platform: integration
source: sensor.total_solar_power
name: total_solar_energy
unit_prefix: k
round: 2
- platform: integration
source: sensor.total_utility_power
name: total_utility_energy
unit_prefix: k
round: 2
- platform: integration
source: sensor.total_consumed_power
name: total_consumed_energy
unit_prefix: k
round: 2
- platform: template
sensors:
solar_power_1:
value_template: >
{{ (states('sensor.solar_power_1_raw')|float - 3) |round(2) }}
friendly_name: 'Solar Power 1'
unit_of_measurement: 'W'
solar_power_2:
value_template: >
{{ (states('sensor.solar_power_2_raw')|float - 3) |round(2) }}
friendly_name: 'Solar Power 2'
unit_of_measurement: 'W'
consumed_power_1:
value_template: >
{{ (states('sensor.solar_power_1')|float
+ states('sensor.utility_power_1')|float) |round(2) }}
friendly_name: 'Consumed Power 1'
unit_of_measurement: 'W'
consumed_power_2:
value_template: >
{{ (states('sensor.solar_power_2')|float
+ states('sensor.utility_power_2')|float) |round(2) }}
friendly_name: 'Consumed Power 2'
unit_of_measurement: 'W'
total_consumed_power:
value_template: >
{{ (states('sensor.consumed_power_1')|float
+ states('sensor.consumed_power_2')|float)| round(2) }}
friendly_name: 'Total Consumed Power'
unit_of_measurement: 'W'
total_solar_power:
value_template: >
{{ (states('sensor.solar_power_1')|float
+ states('sensor.solar_power_2')|float)| round(2) }}
friendly_name: 'Total Solar Power'
unit_of_measurement: 'W'
total_utility_power:
value_template: >
{{ (states('sensor.utility_power_1')|float
+ states('sensor.utility_power_2')|float)| round(2) }}
friendly_name: 'Total Utility Power'
unit_of_measurement: 'W'
total_solar_power_kw:
value_template: >
{{ (states('sensor.total_solar_power')|float /1000) | round(2) }}
friendly_name: 'Total Solar Power kW'
unit_of_measurement: 'kW'
total_utility_power_kw:
value_template: >
{{ (states('sensor.total_utility_power')|float /1000) | round(2) }}
friendly_name: 'Total Utility Power kW'
unit_of_measurement: 'kW'
daily_solar_energy_wh:
value_template: >
{{ (states('sensor.solar_daily_energy_peak')|float *1000) | round(2) }}
friendly_name: 'Daily Solar Energy Wh'
unit_of_measurement: 'Wh'
daily_consumed_energy_wh:
value_template: >
{{ (states('sensor.consumed_daily_energy_peak')|float *1000) | round(2) }}
friendly_name: 'Daily Solar Energy Wh'
unit_of_measurement: 'Wh'
utility meter config
utility_yearly_energy:
source: sensor.total_utility_energy
cycle: yearly
tariffs:
- peak
net_consumption: true
utility_monthly_energy:
source: sensor.total_utility_energy
cycle: monthly
net_consumption: true
tariffs:
- peak
utility_daily_energy:
source: sensor.total_utility_energy
cycle: daily
net_consumption: true
tariffs:
- peak
solar_daily_energy:
source: sensor.total_solar_energy
cycle: daily
net_consumption: true
tariffs:
- peak
solar_monthly_energy:
source: sensor.total_solar_energy
cycle: monthly
net_consumption: true
tariffs:
- peak
solar_yearly_energy:
source: sensor.total_solar_energy
cycle: yearly
net_consumption: true
tariffs:
- peak
consumed_daily_energy:
source: sensor.total_consumed_energy
cycle: daily
net_consumption: true
tariffs:
- peak
consumed_monthly_energy:
source: sensor.total_consumed_energy
cycle: monthly
net_consumption: true
tariffs:
- peak
consumed_yearly_energy:
source: sensor.total_consumed_energy
cycle: yearly
net_consumption: true
tariffs:
- peak