Hi,
I’m trying to mimic @grapekh setup (Outback Power Mate3s Rest PV Solar System Sensors and Occasionally Unavailable), the problem is my Mate3S returns an invalid JSON i.e. somewhere I got a
,"Error": ["Shorted RTS",],
← don’t look at the ‘error’ word but instead to the coma before a bracket, that is the invalid JSON.
JSON validators tells me that I can’t have ,]. I tried with NodeRed (instead of templates) and a search/replace (,] by ]) works, but I still have to use templates so how can I do a search/replace in my template ?
- platform: rest
name: mate3s_report
resource: "http://192.168.1.182/Dev_status.cgi?Port=0"
value_template: "{{ value_json.devstatus }}"
scan_interval: 30
verify_ssl: false
timeout: 5
json_attributes:
- "gateway_type"
- "sys_time"
- "sys_batt_v"
- "ports"
My devstatus value is the culprit, the one which contains ,]. How can I replace these two characters by only ] ?
If you wonder why I have to use templates, it’s because if I use Node Red (which works) I can only change values of input_text or input_numbers using service calls and there’s no service call to change the value of a sensor. Inputs are not read only while sensors are.
Thanks for helping
Regards
V.