Can't get MQTT sensor to work

Hi,

I’m trying to create a MQTT sensor but I can’t get it to work, value is shown as unknown.

Here is my sensor (configuration.yaml):

mqtt:
  sensor: 
    - name: "S1000 total capacity"
      state_topic: "storcube/reportEquip"
      value_template: "{{ value_json.1234567890.totalCapacity }}"
      unique_id: "s1000_total_capacity"

Here is message I get:

{
  "1234567890": {
    "totalPv1power": 28,
    "totalInvPower": 0,
    "list": [
      {
        "equipId": "1234567890",
        "temp": 6,
        "soc": 30,
        "capacity": 812
      }
    ],
    "plugPower": 0,
    "totalCapacity": 812,
    "mainEquipId": "1234567890",
    "totalPv2power": 24
  }
}

I can get MQTT messages if I connect to my environment with MQTT Explorer.
Mosquitto is installed on my HA environment and MQTT integration is configured.
Thanks for your help.

Hi
Your unique id and name may be causing a problem as they may be the same. The spaces in the name will be replaced with _ in HA. Try changing one of them by a letter

The key’s name begins with a number so instead of dot notation, use bracket notation.

mqtt:
  sensor: 
    - name: "S1000 total capacity"
      state_topic: "storcube/reportEquip"
      value_template: "{{ value_json['1234567890'].totalCapacity }}"
      unique_id: "s1000_total_capacity"
1 Like

@oli43 Hi Olivier !
Did you have any solution to control/get information from your storcube s1000?

Thanks