Hi all!
I would like to create an add-on what can follow my stock portfolio's value and visualize it. The add-on is ready to use, I can install in HA OS also and I have an automation trigger to update the portfolio data regularly. This portfolio date is saved in a json file in /share folder. The next step should be to create a custom sensor to read the json data and make accessible in visualization.
My json file content is something:
{
"timestamp": "2025-07-18T10:26:00+02:00",
"summary": [
{
"buy_price": 18747.3,
"portfolio_value": 1866.2,
"gain_percent": -0.36,
"gain_huf": -631.11
}
]
}
The sensor definition is:
- platform: command_line
name: portfolio value
command: "cat /share/portfolio_log.json"
scan_interval: 60
json_attributes_path: "$.summary" # Example path, adjust as needed
json_attributes:- "buy_price"
- "portfolio_value"
- "gain_percent"
- "gain_huf"
The problem is this sensor doesn't exist in my HA system after a reboot, I cannot see any error log in system log. I tried some other option like jq instead of cat and value_templates, etc... Sometimes this sensor appears in my HA system but doesn't get any value from file.
I try to seek in documentation, google and AI, but didn't find any solution yet. I saw many people using rest platform for reading json, but this filed is not published.
Any suggestion or solution?
Thanks in advance
Ps.: if it's in wrong topic please let me know and move to the right one.