Hi everybody,
I am trying to submit multiple values to my Home Assistant via mqtt
. The payload sent to my mqtt broker will look like this
{"CPU0": "+41.0°C", "CPU1": "+42.0°C", "CPU2": "+42.0°C", "CPU3": "", "sda2 Kapazität": "109G", "sda2 Belegt": "101G", "sda2 Frei (Size)": "2,5G", "sda2 Frei (Prozent)": "98%", "Uptime": " 15:03:56 up 1:14, 3 users, load average: 0,71, 0,65, 0,81", "Letztes Update": "2020-06-21-15:03:56", "IP 1": "10.10.10.40/24", "IP 2": "192.168.178.155/24"}
I have tried setting it up like this
sensor:
- platform: mqtt
name: "Beelink CPU0"
value_template: "{{ value_json.CPU0 }"
- platform: mqtt
name: "Beelink CPU1"
value_template: "{{ value_json.CPU1 }"
- platform: mqtt
name: "Beelink CPU2"
value_template: "{{ value_json.CPU2 }"
# etc.
But Home Assistant requires a state_topic
, so this will not work. Is there something similar to the REST
sensor, where you can at least define multiple json_arguments
(see here under multiple values)?
Or is there some way to just subscribe to the topic itself, and have every key and value be displayed? I named each key so that it would be what I’d like it to be named in Home Assistant, anyway.
I have the option to get each of these values as a payload only to separate topics, for example test/cpu0
would be +41.0°C
, test/cpu1
would be +42.0°C
, etc. but I would very much prefer to send this single json payload only and parse all the results from it - rather than having countless mqtt topics and payloads.
Thank you for your ideas