I am using a Pi to collect data from my Magnum inverter and associated devices, and send it over to HA via MQTT. No problem there. Once example of the data as seen in MQTT explorer is;
topic magnum/inverter
{
“datetime”: “2024-01-30T14:19:58-06:00”,
“comm_device”: “/dev/ttyUSB0”,
“device”: “INVERTER”,
“data”: {
“revision”: “1.6”,
“mode”: 9,
“mode_text”: “BATSAVER”,
“fault”: 0,
“fault_text”: “None”,
“vdc”: 13.2,
“adc”: 0,
“VACout”: 118,
“VACin”: 117,
“invled”: 1,
“invled_text”: “On”,
“chgled”: 0,
“chgled_text”: “Off”,
“bat”: 18,
“tfmr”: 37,
“fet”: 36,
“model”: 44,
“model_text”: “MSH3012M”,
“stackmode”: 0,
“stackmode_text”: “Stand Alone”,
“AACin”: 12,
“AACout”: 0,
“Hz”: 60.3
}
}
Following an online example for other devices, i added the following to configuration.taml;
mqtt:
sensor:
- name: Magnum Inverter
state_topic: "magnum/inverter"
value_template: "{{value_jason.VACin}}"
The problem is that the entities show as unknown and there is no data.
Here is what I tried;
Adding retain: false
- name: Magnum Inverter
state_topic: "magnum/inverter"
value_template: "{{value_jason.VACin}}"
retain: false
that just generates the error
ERROR (MainThread) [homeassistant.components.mqtt.mixins] extra keys not allowed @ data[‘retain’] for manually configured MQTT sensor item, in /config/configuration.yaml, line 19 Got {‘name’: ‘Magnum Inverter’, ‘state_topic’: ‘magnum/inverter’, ‘value_template’: ‘{{value_jason.VACin}}’, ‘retain’: False}
I verified that the script is using json format in the MQTT messages
I also tried a value|json something… can’t remember the actual syntax and can’t find the example again.
Any suggestions