mycustomapi is available in Custom-Component Repository.
Use this link to directly go to the release in Github
- Download
project
from the latest release. - Put the files and folders into your
config/custom_components
folder. - Now Restart the Home Assistant. The way to do that:
- Update YAML: Add following code to
configuration.yaml
section.mycustomapi:
- Then Restart: Settings → Developer Tools → YAML → Restart. Now the configuration will check for errors and if everything is ok then a Popup will open. Select
Restart Home Assistant
option from there. Note: If you see any config error please check the configuration.yaml properly and then try restart again.
- Update YAML: Add following code to
With this custom component you can be able call an api from the front end UI to avoid CORS.
- In Cards if you have a functionality to call an api(eg:
http://192.168.0.54/cm?cmnd=power1
) then it will cause CORS issue since the domain is different from thehomeassistant.local:8123
host. - Instead of calling the api directly just call the home assistant script first
http://homeassistant.local:8123/customapi/tasmota?ip=192.168.0.54&power=1
, then in the home assistant script handle the logic to call the exact api and return the response. - This api is created exactly to handle the tasmota pulsetime scenerio. You can change the logic as per your requirement.
- Happy Coding!!!!!.
The design is inspired by Arun’s work.