I just need to set a variable in BetterLogic from a Homey-Script.
But it look as if all examples in the net are outdated and I need to use a http fetch request.
But I can’t get it working.
Are there any actual working examples?
I just need to set a variable in BetterLogic from a Homey-Script.
But it look as if all examples in the net are outdated and I need to use a http fetch request.
But I can’t get it working.
Are there any actual working examples?
Start by asking this in the dedicated Better Logic topic please.
You mean the instructions on the BLL app store page don’t function?
Recent changes for Homeyscript
https://athombv.github.io/com.athom.homeyscript/tutorial-migrate.html
Finanly I managed it…
Not much useable docu out there ![]()
If anyone is searching for the same,
here a working extract from me code:
let BLApp = await Homey.apps.getApp({id:"net.i-dev.betterlogic" });
const resBLput = await BLApp.put({path: '/BatteryLoadState/' + "100"});
console.log ("setVar", resBLput)
let check = await BLApp.get({path: '/BatteryLoadState'});
console.log("getVar", check);
You are just awesome! This works like a charm for me!
This was also what I have been looking for and indeed hard to find any documentation. Thanks a lot for sharing this!
Hi @Arie_J_Godschalk ,
To get a listing of all variables, there’s a URL mentioned on the app page in the app store:
http://192.168.12.34/api/app/net.i-dev.betterlogic/ALL
(192.169.12.34 is my Homey 2026 IP)
I’d like to use this URL in a HTTP GET request flow card, but it returns “401 Unauthorized”
This Hscript returns 401 as well
const url = `http://192.168.12.34/api/app/net.i-dev.betterlogic/all`;
fetch(url)
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error('Error fetching data:', error);
});
When I change api to getapi both return ‘404 not found’
However:
When I adjust the script by Michael a bit, it returns my vars correctly:
let BLApp = await Homey.apps.getApp({id:"net.i-dev.betterlogic" });
const resBLget = await BLApp.get({path: '/all/'});
console.log ("AllVars", resBLget)