Hi,
I have installed a client rest api service on my pc and it returns response shown below.
Then, I have this REST command
- headers:
x-api-key: !secret sa_auth_key_hp_mini
scan_interval: 60
resource: http://192.168.0.195:8080/api/v1/system?memoryUnit=gb
sensor:
- name: "HP Mini CPU Load"
unit_of_measurement: " %"
json_attributes_path: "$.processor"
value_template: "{{ value_json.processor.cpuLoad | round(2) }}"
json_attributes:
- "name"
- "model"
- "family"
- "vendor"
- "cpuLoad"
- "temp"
- name: "HP Mini Memory"
unit_of_measurement: " %"
json_attributes_path: "$.memory"
value_template: "{{ ( value_json.memory.used / value_json.memory.total ) | multiply(100) | round(2) }}"
json_attributes:
- "available"
- "total"
- "used"
that receives the following response
{
"processor": {
"name": "12th Gen Intel(R) Core(TM) i5-12450H",
"family": "6",
"model": "154",
"vendor": "GenuineIntel",
"cpuLoad": 2.703287197231834,
"temp": 0.0
},
"memory": {
"available": 6.3531951904296875,
"total": 15.700065612792969,
"used": 9.346870422363281
}
}
but when the pc is off, I would get a connection error which is expected.
However, on my card I would see something undesirable.
Is there any way to default this to zero (0) if the REST api is not accessible?