APi Homey no longer working

Hi. I am using a Fibaro HomeCenter to send commands to Homey using the Homey API.

After upgrading Homey to version 2 (what I shouldn’t have done) the API is not longer working.
Anyone who know how to solve it ?

I using the below script:

%% properties
%% events
%% globals

:information_source: Initialisation of user settings (change if necessary)

local globVarCommand = ‘SC_Homey_Command’; – Name of global variable to read command
local globVarValue = ‘SC_Homey_Value’; – Name of global variable to read command value
local homeyToken = ‘’; – Not used yet
local homeyIp = ‘’; – IP-address of your Athom Homey

local debug = true;

– Funtions (do not change)

local function log(str) if debug then fibaro:debug(’’…str…’’); end; end
local function errorlog(str) fibaro:debug(’’…str…’’); end

– Code (do not change)

local selfHttp = net.HTTPClient({timeout=5000});

if (tonumber(fibaro:getGlobalValue(globVarCommand)) == 0) then fibaro:abort();
local command = fibaro:getGlobalValue(globVarCommand);
local command = string.gsub(command,’%s’,’%%20’); – Replace with %20
local value = fibaro:getGlobalValue(globVarValue);
local value = string.gsub((value), ‘%s’, ‘%%20’); – Replace with %20
local value = string.gsub((value),’?’,’%%3F’); – Replace ? with %3F

local apiURL = ‘http://’…homeyIp…’/api/app/com.internet/’…tostring(command)…’/’…value;
if debug then log(apiURL) end;

selfHttp:request(apiURL, {options={headers = selfHttp.controlHeaders, data = requestBody, method = ‘GET’,timeout = 5000},
success = function(status)
local result = json.decode(status.data);
if result.status == 200 then
if debug then log(‘OK’) end;
if debug then log(status.data) end;
error = function(error)
if debug then log(error) end;
– Reset the global command variable to 0 and global value variable to empty
fibaro:setGlobal(globVarCommand, ‘0’);
fibaro:setGlobal(globVarValue, ‘’);

Thanks for the help.

Not a developer here but just the IPadress is not gonna work in 2.0


Is what is working for 2.0

But what if the cloud isn’t working? Or the internet connection is gone?

Hi. Thank you so much. It’s working now.