MQTT sensors randomly read value 0 while "0" is never posted to MQTT server?

I’m reading MQTT sensor values from a Smappee Genius energy monitoring device. It’s posting MQTT values to the mosquito broker running on my HA system. It’s posting all sensors data in json format.

In my HA config I have configs like this:

mqtt:
 sensor:
  - name: "Device1"
    state_topic: "servicelocation/1a9cc55c-89d1-4823-896d-xxxxxxxf2/realtime"
    unit_of_measurement: "W"
    object_id: "smappee-watt-device1"
    unique_id: "smappee-watt-device1"
    value_template: "{{ (value_json.channelPowers[35].power|float) | round(0) }}"

In my charts I see that it randomly drops to 0W but I have no idea why.

While debugging I already logged all MQTT topics with a timestamp and compared it to the charts.
If I take any random point on the chart, where the value reads 0W, and search for the MQTT topic, in my mqtt server log, I can always find a mqtt topic sent at exactly the same timestamp.
But this MQTT topic is always good and never reads 0W.

I also tried reposting the exact same MQTT topic with ‘mosquito_pub’ but when doing that HA isn’t reading 0W either.

I have no idea anymore where to look. The MQTT data is fine so it looks like the problem is something else. But what could it be?

The biggest issue with this is that other sensors, reporting energy, are causing massive jumps in energy usage in my energy dashboard because it thinks these drops to 0 are resets of the meter.

I hope someone can help me getting this fixed. I’m out of ideas where to look for now.

Any errors or warnings in the Log related to this sensor?


On a separate note, the sensor’s value_template uses float but it’s now a requirement to provide float with a default value in the event it encounters a value it’s unable to convert to a floating point number.

Reference: Templating - Numeric function and filters

It’s only a requirement if the input value has a chance to not be a float. Round has the same default requirement, however because the float is before the round, then the round will always have a number to deal with. Seeing that his result is JSON, the likelihood of it being anything other than a number is low. I’d argue he doesn’t even need the float or the round. Just an int without a default.

In the logs there’s nothing about the smappee mqtt sensors. No warning, no error, nothing.

I can set a default value for the float, but I guess this is not an issue that could cause the values becoming 0 randomly, right?

What version of HA are you on? Older versions of HA will default a float to 0 when the conversion fails. However you’re using the current style MQTT setup, so it’s assumed you’re on the latest version. Float with a default would cause this problem typically.

Do you know what the true value of channelPowers[35].power is when the MQTT Sensor (erroneously) reports 0?

I’m using the latest HA release. Home Assistant 2022.9.6

Then I’d look into the logs like 123 suggested. Your template will not cause the 0.

FWIW, your template can be simplified to

"{{ value_json.channelPowers[35].power | round(0) }}"

or

"{{ value_json.channelPowers[35].power | int }}"

You don’t need to worry about supplying a default unless your JSON response from your device has quotes around the value for power and the device reports something other than a number at times.

Yes I know the true value of channelPowers[35].power.

The device is sending MQTT topics like this every 15 seconds:

servicelocation/1a9cc55c-89d1-4823-896d-99a12ca0b4f2/realtime {"totalPower":0,"totalReactivePower":0,"totalExportEnergy":219600,"totalImportEnergy":2203642800,"monitorStatus":0,"utcTimeStamp":1664107800000,"measuredFrequency":0,"serviceLocationId":90215,"channelPowers":[{"publishIndex":0,"formula":"$5500034817/0$","power":2,"exportEnergy":0,"importEnergy":73285200,"phaseId":0,"current":3,"apparentPower":82,"cosPhi":2,"serviceLocationId":90038},{"publishIndex":1,"formula":"$5500034817/1$","power":13,"exportEnergy":0,"importEnergy":88729200,"phaseId":1,"current":5,"apparentPower":118,"cosPhi":11,"serviceLocationId":90038},{"publishIndex":2,"formula":"$5500034817/2$","power":9,"exportEnergy":0,"importEnergy":88304400,"phaseId":2,"current":3,"apparentPower":78,"cosPhi":12,"serviceLocationId":90038},{"publishIndex":3,"formula":"$5500034817/3$","power":0,"exportEnergy":0,"importEnergy":5835600,"phaseId":0,"current":4,"apparentPower":90,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":4,"formula":"$5500047314/3$","power":1,"exportEnergy":0,"importEnergy":8982000,"phaseId":1,"current":4,"apparentPower":88,"cosPhi":1,"serviceLocationId":90038},{"publishIndex":5,"formula":"$5500047314/2$","power":0,"exportEnergy":79200,"importEnergy":3600,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":-79,"serviceLocationId":90038},{"publishIndex":6,"formula":"$5500047314/1$","power":2,"exportEnergy":0,"importEnergy":5511600,"phaseId":0,"current":2,"apparentPower":38,"cosPhi":4,"serviceLocationId":90038},{"publishIndex":7,"formula":"$5500047314/0$","power":1,"exportEnergy":0,"importEnergy":19288800,"phaseId":1,"current":0,"apparentPower":4,"cosPhi":17,"serviceLocationId":90038},{"publishIndex":8,"formula":"$5500047440/3$","power":1,"exportEnergy":3600,"importEnergy":2840400,"phaseId":2,"current":0,"apparentPower":8,"cosPhi":6,"serviceLocationId":90038},{"publishIndex":9,"formula":"$5500047440/2$","power":29,"exportEnergy":0,"importEnergy":19468800,"phaseId":0,"current":2,"apparentPower":45,"cosPhi":65,"serviceLocationId":90038},{"publishIndex":10,"formula":"$5500047440/1$","power":0,"exportEnergy":3600,"importEnergy":27878400,"phaseId":1,"current":0,"apparentPower":2,"cosPhi":7,"serviceLocationId":90038},{"publishIndex":11,"formula":"$5500047440/0$","power":28,"exportEnergy":0,"importEnergy":316058400,"phaseId":0,"current":8,"apparentPower":204,"cosPhi":13,"serviceLocationId":90038},{"publishIndex":12,"formula":"$5500049939/3$","power":14,"exportEnergy":0,"importEnergy":136746000,"phaseId":1,"current":3,"apparentPower":76,"cosPhi":18,"serviceLocationId":90038},{"publishIndex":13,"formula":"$5500049939/2$","power":1,"exportEnergy":0,"importEnergy":122335200,"phaseId":2,"current":3,"apparentPower":75,"cosPhi":1,"serviceLocationId":90038},{"publishIndex":14,"formula":"$5500049939/1$","power":5,"exportEnergy":0,"importEnergy":64573200,"phaseId":0,"current":2,"apparentPower":39,"cosPhi":11,"serviceLocationId":90038},{"publishIndex":15,"formula":"$5500049939/0$","power":5,"exportEnergy":0,"importEnergy":63734400,"phaseId":1,"current":2,"apparentPower":39,"cosPhi":13,"serviceLocationId":90038},{"publishIndex":16,"formula":"$5500047471/3$","power":4,"exportEnergy":0,"importEnergy":63759600,"phaseId":2,"current":2,"apparentPower":37,"cosPhi":9,"serviceLocationId":90038},{"publishIndex":17,"formula":"$5500047471/2$","power":0,"exportEnergy":36000,"importEnergy":36000,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":-20,"serviceLocationId":90038},{"publishIndex":18,"formula":"$5500047471/1$","power":0,"exportEnergy":50400,"importEnergy":10800,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":-16,"serviceLocationId":90038},{"publishIndex":19,"formula":"$5500047471/0$","power":481,"exportEnergy":0,"importEnergy":86796000,"phaseId":0,"current":26,"apparentPower":619,"cosPhi":77,"serviceLocationId":90038},{"publishIndex":21,"formula":"$5500049922/2$","power":1,"exportEnergy":0,"importEnergy":47264400,"phaseId":2,"current":0,"apparentPower":11,"cosPhi":5,"serviceLocationId":90038},{"publishIndex":22,"formula":"$5500049922/3$","power":1,"exportEnergy":0,"importEnergy":51861600,"phaseId":1,"current":0,"apparentPower":7,"cosPhi":10,"serviceLocationId":90038},{"publishIndex":23,"formula":"$5500049922/1$","power":0,"exportEnergy":7200,"importEnergy":14536800,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":11,"serviceLocationId":90038},{"publishIndex":24,"formula":"$5500049922/0$","power":89,"exportEnergy":0,"importEnergy":193510800,"phaseId":1,"current":6,"apparentPower":141,"cosPhi":62,"serviceLocationId":90038},{"publishIndex":12,"formula":"$5500047333/3$","power":5,"exportEnergy":0,"importEnergy":5180400,"phaseId":2,"current":0,"apparentPower":10,"cosPhi":53,"serviceLocationId":90264},{"publishIndex":15,"formula":"$5500047333/0$","power":21,"exportEnergy":0,"importEnergy":21654000,"phaseId":2,"current":2,"apparentPower":40,"cosPhi":52,"serviceLocationId":90264},{"publishIndex":16,"formula":"$5500047384/3$","power":0,"exportEnergy":0,"importEnergy":1152000,"phaseId":2,"current":0,"apparentPower":3,"cosPhi":3,"serviceLocationId":90264},{"publishIndex":18,"formula":"$5500047384/1$","power":0,"exportEnergy":0,"importEnergy":154800,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":-15,"serviceLocationId":90264},{"publishIndex":19,"formula":"$5500047403/3$","power":1,"exportEnergy":0,"importEnergy":619200,"phaseId":2,"current":0,"apparentPower":1,"cosPhi":45,"serviceLocationId":90264},{"publishIndex":20,"formula":"$5500047403/2$","power":3,"exportEnergy":0,"importEnergy":9306000,"phaseId":0,"current":0,"apparentPower":5,"cosPhi":54,"serviceLocationId":90264},{"publishIndex":21,"formula":"$5500047403/1$","power":1,"exportEnergy":0,"importEnergy":1130400,"phaseId":1,"current":3,"apparentPower":72,"cosPhi":1,"serviceLocationId":90264},{"publishIndex":22,"formula":"$5500047403/0$","power":189,"exportEnergy":0,"importEnergy":180997200,"phaseId":2,"current":8,"apparentPower":192,"cosPhi":98,"serviceLocationId":90264},{"publishIndex":23,"formula":"$5500034746/3$","power":4,"exportEnergy":0,"importEnergy":4453200,"phaseId":0,"current":0,"apparentPower":6,"cosPhi":74,"serviceLocationId":90264},{"publishIndex":24,"formula":"$5500034746/2$","power":1,"exportEnergy":0,"importEnergy":1918800,"phaseId":1,"current":2,"apparentPower":40,"cosPhi":1,"serviceLocationId":90264},{"publishIndex":25,"formula":"$5500034746/1$","power":6,"exportEnergy":0,"importEnergy":2041200,"phaseId":2,"current":2,"apparentPower":51,"cosPhi":11,"serviceLocationId":90264},{"publishIndex":26,"formula":"$5500034746/0$","power":250,"exportEnergy":0,"importEnergy":183348000,"phaseId":0,"current":12,"apparentPower":287,"cosPhi":87,"serviceLocationId":90264},{"publishIndex":27,"formula":"$5500034747/3$","power":18,"exportEnergy":0,"importEnergy":5778000,"phaseId":1,"current":3,"apparentPower":63,"cosPhi":29,"serviceLocationId":90264},{"publishIndex":0,"formula":"$5500034747/2$","power":10,"exportEnergy":0,"importEnergy":16128000,"phaseId":2,"current":3,"apparentPower":81,"cosPhi":12,"serviceLocationId":90264},{"publishIndex":1,"formula":"$5500034747/1$","power":27,"exportEnergy":0,"importEnergy":27759600,"phaseId":0,"current":3,"apparentPower":66,"cosPhi":41,"serviceLocationId":90264},{"publishIndex":2,"formula":"$5500034747/0$","power":165,"exportEnergy":0,"importEnergy":179247600,"phaseId":1,"current":9,"apparentPower":210,"cosPhi":78,"serviceLocationId":90264},{"publishIndex":3,"formula":"$5500047333/2$","power":1,"exportEnergy":0,"importEnergy":954000,"phaseId":0,"current":0,"apparentPower":12,"cosPhi":7,"serviceLocationId":90264},{"publishIndex":4,"formula":"$5500047333/1$","power":19,"exportEnergy":0,"importEnergy":21416400,"phaseId":1,"current":1,"apparentPower":29,"cosPhi":66,"serviceLocationId":90264},{"publishIndex":5,"formula":"$5500047384/2$","power":0,"exportEnergy":0,"importEnergy":21600,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":-6,"serviceLocationId":90264},{"publishIndex":6,"formula":"$5500047384/0$","power":0,"exportEnergy":14400,"importEnergy":11350800,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":-33,"serviceLocationId":90264},{"publishIndex":7,"formula":"$5500047396/3$","power":0,"exportEnergy":3600,"importEnergy":140400,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":37,"serviceLocationId":90264},{"publishIndex":8,"formula":"$5500047396/2$","power":0,"exportEnergy":0,"importEnergy":21600,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":39,"serviceLocationId":90264},{"publishIndex":9,"formula":"$5500047396/1$","power":0,"exportEnergy":0,"importEnergy":21600,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":10,"formula":"$5500047396/0$","power":0,"exportEnergy":7200,"importEnergy":64800,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":-15,"serviceLocationId":90264},{"publishIndex":11,"formula":"$5500047576/3$","power":0,"exportEnergy":0,"importEnergy":349200,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":6,"serviceLocationId":90264},{"publishIndex":13,"formula":"$5500047576/2$","power":0,"exportEnergy":7200,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":-16,"serviceLocationId":90264},{"publishIndex":14,"formula":"$5500047576/1$","power":0,"exportEnergy":7200,"importEnergy":28800,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":-4,"serviceLocationId":90264},{"publishIndex":17,"formula":"$5500047576/0$","power":1,"exportEnergy":0,"importEnergy":1699200,"phaseId":2,"current":0,"apparentPower":7,"cosPhi":21,"serviceLocationId":90264},{"publishIndex":0,"formula":"$5500047339/3$","power":3,"exportEnergy":0,"importEnergy":5760000,"phaseId":0,"current":2,"apparentPower":56,"cosPhi":5,"serviceLocationId":90293},{"publishIndex":1,"formula":"$5500047339/2$","power":3,"exportEnergy":0,"importEnergy":2822400,"phaseId":0,"current":2,"apparentPower":56,"cosPhi":5,"serviceLocationId":90293},{"publishIndex":2,"formula":"$5500047339/1$","power":3,"exportEnergy":0,"importEnergy":2746800,"phaseId":0,"current":2,"apparentPower":55,"cosPhi":5,"serviceLocationId":90293},{"publishIndex":3,"formula":"$5500047339/0$","power":41,"exportEnergy":0,"importEnergy":4878000,"phaseId":0,"current":3,"apparentPower":71,"cosPhi":57,"serviceLocationId":90293},{"publishIndex":4,"formula":"$5500047382/3$","power":41,"exportEnergy":0,"importEnergy":3294000,"phaseId":0,"current":3,"apparentPower":71,"cosPhi":57,"serviceLocationId":90293},{"publishIndex":5,"formula":"$5500047382/2$","power":3,"exportEnergy":0,"importEnergy":1850400,"phaseId":0,"current":2,"apparentPower":56,"cosPhi":5,"serviceLocationId":90293},{"publishIndex":6,"formula":"$5500047382/1$","power":3,"exportEnergy":0,"importEnergy":1965600,"phaseId":1,"current":2,"apparentPower":54,"cosPhi":5,"serviceLocationId":90293},{"publishIndex":7,"formula":"$5500047382/0$","power":3,"exportEnergy":0,"importEnergy":2037600,"phaseId":1,"current":2,"apparentPower":54,"cosPhi":5,"serviceLocationId":90293}],"voltages":[{"voltage":240,"phaseId":0,"serviceLocationId":90038},{"voltage":238,"phaseId":1,"serviceLocationId":90038},{"voltage":235,"phaseId":2,"serviceLocationId":90038},{"voltage":238,"phaseId":0,"serviceLocationId":90264},{"voltage":234,"phaseId":1,"serviceLocationId":90264},{"voltage":240,"phaseId":2,"serviceLocationId":90264},{"voltage":238,"phaseId":0,"serviceLocationId":90293},{"voltage":235,"phaseId":1,"serviceLocationId":90293},{"voltage":240,"phaseId":2,"serviceLocationId":90293}]}

I logged them using: mosquitto_sub -h x.x.x.x -u smappee -P xxxxx -v -t servicelocation/# | ts > LOG
This way I have a timestap in the LOG file for every topic the MQTT server sends back to the clients.

If I go to the HA chart and hover over a point that shows 0W, It tells me the time when it was 0W.
If I then grep for “hh:mm:ss” in the LOG file I always find the exact MQTT topic posted at that time.

The MQTT topic posted at that moment never shows a value of 0W for the entity.

PS: this problem happens for all sensors at the same timestamps

look at the log directly before that entry.

Sounds like your device is actually sending that value then. Nothing in your config points to a “This would cause a 0 value”.

I checked the log entry right before and right after the one from the timestamp.
I even created a small python script like this to make sure the json is parseable and I’m checking the right values…

import json
f = open("json_file_extract.txt")
data = json.load(f)
f.close()
print(json.dumps(data['channelPowers'][35], indent=4))

channelPowers[35].power was never “0”

Can please you post the json? 3 before and 3 after (including the one where it occured).

Are you saying that every MQTT Sensor you’ve configured in your system reports an incorrect value at exactly the same moment in time?

Or are you saying only the MQTT Sensors that are subscribed to one specific topic (servicelocation/1a9cc55c-89d1-4823-896d-xxxxxxxf2/realtime).

Well, I think I know your problem. I don’t think your values are sorted and I believe you’re getting the wrong index randomly.

Do you believe your values are always in the same order? Why doesn’t publishIndex match the actual index in the list? Are you sure you’re getting the correct information?

Here’s a table I created that matches your publishedIndex to your power. Notice how you have multiple publishedIndex’s? I sorted the list too, as it was not in order in relation to publishIndex

publishIndex power
0 2
0 10
0 3
1 13
1 27
1 3
2 9
2 165
2 3
3 0
3 1
3 41
4 1
4 19
4 41
5 0
5 0
5 3
6 2
6 0
6 3
7 1
7 0
7 3
8 1
8 0
9 29
9 0
10 0
10 0
11 28
11 0
12 14
12 5
13 1
13 0
14 5
14 0
15 5
15 21
16 4
16 0
17 0
17 1
18 0
18 0
19 481
19 1
20 3
21 1
21 1
22 1
22 189
23 0
23 4
24 89
24 1
25 6
26 250
27 18

All sensors have the exact same state_topic… All sensors data is posted to the same /realtime topic in json format and they are under channelsPower[]

I created a new python script for debuggin:

import json

for line in open("mqtt.LOG",'r'):
    if "servicelocation/1a9cc55c-89d1-4823-896d-99a12ca0b4f2/realtime" in line:
        ts = line[:15]
        data = json.loads(line[line.find('{'):])
        cp35power = data['channelPowers'][35]['power']
        if cp35power == 0:
            print(ts+':'+str(cp35power))

This reads all entries in my mqtt log file and only prints channelPowers[35].power if it was 0. I expected no results but I was surprised to see 19 results and my HA chart has 19 drops to 0W too.

It turned out that using “| ts” to log my MQTT topics somehow messed up the timestamp. It’s 2 hours ahead and because of that I compared the wrong MQTT topic to the HA chart.

So I now finally know that the smappee genius device is posting faulty json data randomly.

It should always be in the same order. That’s at least what smappee told me. And I think it’s fine too because the readings are correct, except for the value of 0 randomly.

I have many devices and if the order would change randomly I should see more problems besides this value of 0W

Please, post what I requested then.

because this is the table I see

index in json publishIndex power
0 0 2
1 1 13
2 2 9
3 3 0
4 4 1
5 5 0
6 6 2
7 7 1
8 8 1
9 9 29
10 10 0
11 11 28
12 12 14
13 13 1
14 14 5
15 15 5
16 16 4
17 17 0
18 18 0
19 19 481
20 21 1
21 22 1
22 23 0
23 24 89
24 12 5
25 15 21
26 16 0
27 18 0
28 19 1
29 20 3
30 21 1
31 22 189
32 23 4
33 24 1
34 25 6
35 26 250
36 27 18
37 0 10
38 1 27
39 2 165
40 3 1
41 4 19
42 5 0
43 6 0
44 7 0
45 8 0
46 9 0
47 10 0
48 11 0
49 13 0
50 14 0
51 17 1
52 0 3
53 1 3
54 2 3
55 3 41
56 4 41
57 5 3
58 6 3
59 7 3

The values you posted are correct. It’s the index in json that represents the device number and the power represents the power this device consumes. The publishindex is never used.

Here’s an example of mqtt topic posted by the smappee genius device cause problems:

servicelocation/1a9cc55c-89d1-4823-896d-99a12ca0b4f2/realtime {"totalPower":0,"totalReactivePower":0,"totalExportEnergy":0,"totalImportEnergy":0,"monitorStatus":0,"utcTimeStamp":1664100885000,"measuredFrequency":0,"serviceLocationId":90215,"channelPowers":[{"publishIndex":0,"formula":"$5500034817/0$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":1,"formula":"$5500034817/1$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":2,"formula":"$5500034817/2$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":3,"formula":"$5500034817/3$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":4,"formula":"$5500047314/3$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":5,"formula":"$5500047314/2$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":6,"formula":"$5500047314/1$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":7,"formula":"$5500047314/0$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":8,"formula":"$5500047440/3$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":9,"formula":"$5500047440/2$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":10,"formula":"$5500047440/1$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":11,"formula":"$5500047440/0$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":12,"formula":"$5500049939/3$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":13,"formula":"$5500049939/2$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":14,"formula":"$5500049939/1$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":15,"formula":"$5500049939/0$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":16,"formula":"$5500047471/3$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":17,"formula":"$5500047471/2$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":18,"formula":"$5500047471/1$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":19,"formula":"$5500047471/0$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":21,"formula":"$5500049922/2$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":22,"formula":"$5500049922/3$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":23,"formula":"$5500049922/1$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":24,"formula":"$5500049922/0$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90038},{"publishIndex":12,"formula":"$5500047333/3$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":15,"formula":"$5500047333/0$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":16,"formula":"$5500047384/3$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":18,"formula":"$5500047384/1$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":19,"formula":"$5500047403/3$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":20,"formula":"$5500047403/2$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":21,"formula":"$5500047403/1$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":22,"formula":"$5500047403/0$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":23,"formula":"$5500034746/3$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":24,"formula":"$5500034746/2$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":25,"formula":"$5500034746/1$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":26,"formula":"$5500034746/0$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":27,"formula":"$5500034747/3$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":0,"formula":"$5500034747/2$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":1,"formula":"$5500034747/1$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":2,"formula":"$5500034747/0$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":3,"formula":"$5500047333/2$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":4,"formula":"$5500047333/1$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":5,"formula":"$5500047384/2$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":6,"formula":"$5500047384/0$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":7,"formula":"$5500047396/3$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":8,"formula":"$5500047396/2$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":9,"formula":"$5500047396/1$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":10,"formula":"$5500047396/0$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":11,"formula":"$5500047576/3$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":13,"formula":"$5500047576/2$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":14,"formula":"$5500047576/1$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":17,"formula":"$5500047576/0$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":2,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90264},{"publishIndex":0,"formula":"$5500047339/3$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90293},{"publishIndex":1,"formula":"$5500047339/2$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90293},{"publishIndex":2,"formula":"$5500047339/1$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90293},{"publishIndex":3,"formula":"$5500047339/0$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90293},{"publishIndex":4,"formula":"$5500047382/3$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90293},{"publishIndex":5,"formula":"$5500047382/2$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":0,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90293},{"publishIndex":6,"formula":"$5500047382/1$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90293},{"publishIndex":7,"formula":"$5500047382/0$","power":0,"exportEnergy":0,"importEnergy":0,"phaseId":1,"current":0,"apparentPower":0,"cosPhi":0,"serviceLocationId":90293}],"voltages":[{"voltage":0,"phaseId":0,"serviceLocationId":90038},{"voltage":0,"phaseId":1,"serviceLocationId":90038},{"voltage":0,"phaseId":2,"serviceLocationId":90038},{"voltage":0,"phaseId":0,"serviceLocationId":90264},{"voltage":0,"phaseId":1,"serviceLocationId":90264},{"voltage":0,"phaseId":2,"serviceLocationId":90264},{"voltage":0,"phaseId":0,"serviceLocationId":90293},{"voltage":0,"phaseId":1,"serviceLocationId":90293},{"voltage":0,"phaseId":2,"serviceLocationId":90293}]}

so it does post a value of 0 like you already though. I just didn’t see it because of the mismatching timestampt cause by the “| ts” pipe I used while created the mqtt logs

So the device is posting zero then. Ok, then you know where your problem lies.

You can attempt to template that out.