This page details a temporary work-around to configure a CoFyBox running the glue component version 2bf8dfc
or previous to work together with CoFy Cookies and/or Shelly devices. This version of glue has an issue as its default config sums the energy values of all Shelly energy meters connected to the CoFyBox and publishes this sum to the utility_meter
. It also registers the utility meter in Home Assistant. This results in data conflicts and unexpected behaviour when a P1 cookie is present, and/or Shelly energy meters that measure individual appliances.
This information is meant for installers, as it requires a balena account with dev rights.
Note: this step can be prepared before the on-site installation
coyfbox-config
service.cd /cofybox-config
nano glue_keys_blank.json
{
"version": "20220621",
"ingredients": {
},
"recipes": {
}
}
CTRL+X
, confirm with Y
and enter.mv -f glue_keys_blank.json glue_keys.json
Note: these instructions must be performed on-site
If no Shellies have been installed, you are done here. If Shellies are installed, proceed to the next paragraph.
This step is only required if Shelly energy meters have been installed.
Settings
> Devices & Services
> Devices
. You should see the installed Shelly devices displayed with a uniqe code here, e.g. Shelly EM 98CDAC1F2B1A
.coyfbox-config
service.cd /cofybox-config
nano glue_keys_new.json
{
"version": "20220621",
"ingredients": {
"heatpump_internal_total_consumption": {
"friendly_name": "Heatpump internal Total energy consumed",
"topic_in": "shellies/shellyem-98CDAC1F2B1A/emeter/0/total",
"json_template": null
},
"heatpump_internal_total_power": {
"friendly_name": "Heatpump internal Total power",
"topic_in": "shellies/shellyem-98CDAC1F2B1A/emeter/0/power",
"json_template": null
},
"heatpump_internal_voltage": {
"friendly_name": "Heatpump internal Voltage",
"topic_in": "shellies/shellyem-98CDAC1F2B1A/emeter/0/voltage",
"json_template": null
},
"heatpump_external_total_consumption": {
"friendly_name": "Heatpump external Total energy consumed",
"topic_in": "shellies/shellyem-98CDAC1F2B1A/emeter/1/total",
"json_template": null
},
"heatpump_external_total_power": {
"friendly_name": "Heatpump external Total power",
"topic_in": "shellies/shellyem-98CDAC1F2B1A/emeter/1/power",
"json_template": null
}
},
"recipes": {
"heatpump_total_energy_consumed": {
"friendly_name": "Heatpump Total energy consumption",
"topic_out": "data/devices/heatpump/total_energy_consumed",
"recipe": "{{heatpump_internal_total_consumption + heatpump_external_total_consumption}}",
"entity": "heatpump",
"channel": "total_energy_consumed",
"unit": "Wh",
"metricKind": "cumulative",
"metric": "HpElectricityConsumption",
"ignore_after": 300,
"ignore": false
},
"heatpump_total_power": {
"friendly_name": "Heatpump Total active power",
"topic_out": "data/devices/heatpump/total_active_power",
"recipe": "{{heatpump_internal_total_power + heatpump_external_total_power}}",
"entity": "heatpump",
"channel": "total_active_power",
"unit": "W",
"metricKind": "gauge",
"metric": "HpElectricityPower",
"ignore_after": 300,
"ignore": false
},
"heatpump_voltage_phase_l1": {
"friendly_name": "Heatpump Voltage phase 1",
"topic_out": "data/devices/heat_pump/voltage_phase_l1",
"recipe": "{{heatpump_internal_voltage}}",
"entity": "heatpump",
"channel": "voltage_phase_l1",
"unit": "V",
"metricKind": "gauge",
"metric": "HpElectricityVoltage",
"ignore_after": 300,
"ignore": false
}
}
}
{
"version": "20220621",
"ingredients": {
"shellyem_0_total_consumption": {
"friendly_name": "Total energy consumed",
"topic_in": "shellies/shellyem-98CDAC1F44D3/emeter/0/total",
"json_template": null
},
"shellyem_0_total_injection": {
"friendly_name": "Total energy injected",
"topic_in": "shellies/shellyem-98CDAC1F44D3/emeter/0/total_returned",
"json_template": null
},
"shellyem_0_total_power": {
"friendly_name": "Total power",
"topic_in": "shellies/shellyem-98CDAC1F44D3/emeter/0/power",
"json_template": null
},
"shellyem_0_voltage": {
"friendly_name": "Voltage",
"topic_in": "shellies/shellyem-98CDAC1F44D3/emeter/0/voltage",
"json_template": null
},
"heatpump_internal_total_consumption": {
"friendly_name": "Heatpump internal Total energy consumed",
"topic_in": "shellies/shellyem-C45BBE6030BC/emeter/0/total",
"json_template": null
},
"heatpump_internal_total_power": {
"friendly_name": "Heatpump internal Total power",
"topic_in": "shellies/shellyem-C45BBE6030BC/emeter/0/power",
"json_template": null
},
"heatpump_internal_voltage": {
"friendly_name": "Heatpump internal Voltage",
"topic_in": "shellies/shellyem-C45BBE6030BC/emeter/0/voltage",
"json_template": null
},
"heatpump_external_total_consumption": {
"friendly_name": "Heatpump external Total energy consumed",
"topic_in": "shellies/shellyem-C45BBE6030BC/emeter/1/total",
"json_template": null
},
"heatpump_external_total_power": {
"friendly_name": "Heatpump external Total power",
"topic_in": "shellies/shellyem-C45BBE6030BC/emeter/1/power",
"json_template": null
}
},
"recipes": {
"total_energy_consumed": {
"friendly_name": "Total energy consumed",
"topic_out": "data/devices/utility_meter/total_energy_consumed",
"recipe": "{{shellyem_0_total_consumption}}",
"entity": "utility_meter",
"channel": "total_energy_consumed",
"unit": "Wh",
"metricKind": "cumulative",
"metric": "GridElectricityImport",
"ignore_after": 300,
"ignore": false
},
"total_energy_injected": {
"friendly_name": "Total energy injected",
"topic_out": "data/devices/utility_meter/total_energy_injected",
"recipe": "{{shellyem_0_total_injection}}",
"entity": "utility_meter",
"channel": "total_energy_injected",
"unit": "Wh",
"metricKind": "cumulative",
"metric": "GridElectricityExport",
"ignore_after": 300,
"ignore": false
},
"total_active_power": {
"friendly_name": "Total active power",
"topic_out": "data/devices/utility_meter/total_active_power",
"recipe": "{{shellyem_0_total_power}}",
"entity": "utility_meter",
"channel": "total_active_power",
"unit": "W",
"metricKind": "gauge",
"metric": "GridElectricityPower",
"ignore_after": 300,
"ignore": false
},
"voltage_phase_l1": {
"friendly_name": "Voltage phase 1",
"topic_out": "data/devices/utility_meter/voltage_phase_l1",
"recipe": "{{shellyem_0_voltage}}",
"entity": "utility_meter",
"channel": "voltage_phase_l1",
"unit": "V",
"metricKind": "gauge",
"metric": "GridElectricityVoltage",
"ignore_after": 300,
"ignore": false
},
"heatpump_total_energy_consumed": {
"friendly_name": "Heatpump Total energy consumption",
"topic_out": "data/devices/heatpump/total_energy_consumed",
"recipe": "{{heatpump_internal_total_consumption + heatpump_external_total_consumption}}",
"entity": "heatpump",
"channel": "total_energy_consumed",
"unit": "Wh",
"metricKind": "cumulative",
"metric": "HpElectricityConsumption",
"ignore_after": 300,
"ignore": false
},
"heatpump_total_power": {
"friendly_name": "Heatpump Total active power",
"topic_out": "data/devices/heatpump/total_active_power",
"recipe": "{{heatpump_internal_total_power + heatpump_external_total_power}}",
"entity": "heatpump",
"channel": "total_active_power",
"unit": "W",
"metricKind": "gauge",
"metric": "HpElectricityPower",
"ignore_after": 300,
"ignore": false
},
"heatpump_voltage_phase_l1": {
"friendly_name": "Heatpump Voltage phase 1",
"topic_out": "data/devices/heat_pump/voltage_phase_l1",
"recipe": "{{heatpump_internal_voltage}}",
"entity": "heatpump",
"channel": "voltage_phase_l1",
"unit": "V",
"metricKind": "gauge",
"metric": "HpElectricityVoltage",
"ignore_after": 300,
"ignore": false
}
}
}
topic_in
values under the ingredients
section of the config file with the unique Shelly IDs and channel nummbers. You can navigate in the editor with the arrow keys.topic_in
value for heatpump_internal_total_consumption
:topic_in
value for shellyem_0_total_consumption
:You need to change the values in bold to the unique IDs and channels of the Shellies installed.
CTRL+X
, confirm with Y
and enter.mv -f glue_keys_new.json glue_keys.json
The installation is now complete.
On the CoFyBox app device page, you should see the configured sensors appear (might take a few minutes).
On the Home Assistant instance, you should see the installed P1 cookies appear as MQTT devices.