# APi Homey no longer working

**URL:** <https://community.homey.app/t/api-homey-no-longer-working/8153>\
**Category:** Developers\
**Created:** [January 28, 2019, 12:17pm UTC](https://community.homey.app/t/api-homey-no-longer-working/8153 "2019-01-28T12:17:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ypolit](https://avatars.discourse-cdn.com/v4/letter/y/59ef9b/32.png) [@Ypolit](https://community.homey.app/u/Ypolit)\
**Post date:** [January 28, 2019, 12:17pm UTC](https://community.homey.app/t/api-homey-no-longer-working/8153/1 "2019-01-28T12:17:17Z")

</div>

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 SC\_Homey\_Command –]]

## – ℹ 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 = ‘192.168.3.5’; – 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();  
end  
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;  
else  
errorlog(‘failed’);  
if debug then log(status.data) end;  
end  
end,  
error = function(error)  
errorlog(“ERROR”);  
if debug then log(error) end;  
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.

---

<div class="post-metadata">

**Author:** ![Rocodamelshekima](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rocodamelshekima/32/8209_2.png) [@Rocodamelshekima](https://community.homey.app/u/Rocodamelshekima)\
**Post date:** [January 28, 2019, 3:58pm UTC](https://community.homey.app/t/api-homey-no-longer-working/8153/2 "2019-01-28T15:58:56Z")

</div>

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

## https://\<cloudid\>.connect.athom.com/api/app/

Is what is working for 2.0

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [January 28, 2019, 4:01pm UTC](https://community.homey.app/t/api-homey-no-longer-working/8153/3 "2019-01-28T16:01:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ypolit](https://avatars.discourse-cdn.com/v4/letter/y/59ef9b/32.png) [@Ypolit](https://community.homey.app/u/Ypolit)\
**Post date:** [January 28, 2019, 4:27pm UTC](https://community.homey.app/t/api-homey-no-longer-working/8153/4 "2019-01-28T16:27:48Z")

</div>

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