diff --git a/roles/monitoring/templates/mqtt_exporter_config.yaml b/roles/monitoring/templates/mqtt_exporter_config.yaml index 39d147a..e1f1cbb 100644 --- a/roles/monitoring/templates/mqtt_exporter_config.yaml +++ b/roles/monitoring/templates/mqtt_exporter_config.yaml @@ -15,7 +15,8 @@ export: - subscribe: bitlair/# - subscribe: bitlair/climate/+location/# - subscribe: bitlair/climate/+location/dust_mass/+size - - subscribe: bitlair/power/+net/+group/# + - subscribe: bitlair/power/+net/+group/now_w + - subscribe: bitlair/power/+net/total_kwh - subscribe: bitlair/wifi/+ssid/# - subscribe: bitlair/state diff --git a/roles/services/templates/power-mqtt.py b/roles/services/templates/power-mqtt.py index becccc7..2fcd038 100644 --- a/roles/services/templates/power-mqtt.py +++ b/roles/services/templates/power-mqtt.py @@ -21,7 +21,7 @@ while True: sleep(10) try: data = requests.get(f'http://{sdm630_host}/api/v1/data').json() - client.publish('bitlair/power/total_kwh', data['total_power_import_kwh']) + client.publish(f'bitlair/power/{net}/total_kwh', data['total_power_import_kwh']) client.publish(f'bitlair/power/{net}/All/now_w', data['active_power_w']) client.publish(f'bitlair/power/{net}/L1/now_w', data['active_power_l1_w']) client.publish(f'bitlair/power/{net}/L2/now_w', data['active_power_l2_w'])