I would like to see an endpoint in the api to get the lovelace configuration file in a json. This will be helpfull for mobile app development so it can copy the ui that the web has. I believe there is no option to do it through the API, but I know Ariela app found a way to obtain it, however, I guess it is a webscrapping method they are using. (https://play.google.com/store/apps/details?id=com.surodev.ariela&hl=en_US)
It is available via websocket endpoint:
Not sure if you can access those via the mobile_app component. @robbiet480?
1 Like
Not supported
Thanks a lot! I’ll try that.
But I don’t understand the mobile_app component question. what is this component.
In any case, I can open a websocket from the mobile app. I am using Xamarin Forms for development.
Thanks, I believe I am in the right track now. To test it I created a Vue.js app, here is the code, I hope it helps someone:
mounted() {
this.socket = new WebSocket('ws://hassio.local:8123/api/websocket');
console.log("breakpoint");
this.socket.addEventListener('open', () => {
this.socket.send('{"type": "auth", "access_token": "**************"}\n');
});
this.socket.addEventListener('message', (event) => {
var data = JSON.parse(event.data);
if(data.type === "auth_ok"){
this.socket.send('{"type": "lovelace/config", "force":false, "id": 15 }\n');
}
else if(data.type === "result" && data.id === 15){
this.views = data.result.views;
}
});
}