json file- RESTful command integration
json
1. Create a Static JSON File in your HA config folder
/data/homeassistant202405/vacumm/rooms.json
2. Enable File Access and REST API In configuration.yaml
In configuration.yaml, ensure the file and rest_command integrations are enabled:
#
# ----------------------------------- json file -----------------------------------
#
# https://community.home-assistant.io/t/allowlist-external-dirs/854545/2?u=msly
homeassistant:
allowlist_external_dirs:
- /config/vacumm
- /config/image
# https://www.home-assistant.io/integrations/rest_command/
rest_command:
write_rooms_json:
url: "http://localhost:8123/api/config/vacumm/rooms.json"
method: POST
headers:
Authorization: "Bearer YOUR_LONG_LIVED_ACCESS_TOKEN"
Content-Type: "application/json"
payload: "{{ updated_json }}"
To call it in developer tools, script or automation:
action: rest_command.write_rooms_json
action: rest_command.write_rooms_json
data:
name: 'Hellstormovo bezva radio!'
deebot_room_id: 'http://opml.radiotime.com/Tune.ashx?id=s14991'
Creating sensors from json list
https://community.home-assistant.io/t/creating-sensors-from-json-list/319512/6
Comments
Be the first to post a comment