So here I am trying to get a better understanding of JSON REST sensors.
I have an OPNsense firewall. OPNsense has a API for returning a JSON for different things, like CPU temp.
So I thought I do something like:
rest:
- resource: "https://x.x.x.1/widgets/api/get.php?load=temperature"
scan_interval: 60
sensor:
- name: "Core Temp"
value_template: "{{ value_json[data.temperature[0].temperature] }}"
device_class: temperature
unit_of_measurement: "°C"
Well nothing - don’t know what I might even be doing wrong here - no notification and no entity to retrieve the information from.
If I query that IP from my personal PC I get this JSON in return:
{"system":"OPNsense","plugins":["system","temperature"],"data":{"temperature":[{"device":"dev.pchtherm.0.temperature","device_seq":"0","temperature":"41.5","type":"core","type_translated":"Core"},{"device":"hw.acpi.thermal.tz0.temperature","device_seq":"0","temperature":"27.9","type":"zone","type_translated":"Zone"},{"device":"hw.acpi.thermal.tz1.temperature","device_seq":"1","temperature":"29.9","type":"zone","type_translated":"Zone"}]}}
Wonder if I can get that in better format, let’s try this:
system "OPNsense"
plugins
0 "system"
1 "temperature"
data
temperature
0
device "dev.pchtherm.0.temperature"
device_seq "0"
temperature "41.5"
type "core"
type_translated "Core"
1
device "hw.acpi.thermal.tz0.temperature"
device_seq "0"
temperature "27.9"
type "zone"
type_translated "Zone"
2
device "hw.acpi.thermal.tz1.temperature"
device_seq "1"
temperature "29.9"
type "zone"
type_translated "Zone"
Anyway, I’m a bit out of ideas how to retreive this JSON from OPNSense into my HomeAssistant. I guess this could be a question of userid/pwd of course, but as I wrote, I get no notification about nothing. So…
Sido information: I have the HACS OPNSense integration loaded, and that integration does load all that information without problems. Now the OPNsense integration uses API keys for access, so I was kind of hoping I could ride onto that “logon” so to speak, maybe I am wrong here?