Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team
Search the Community
Showing results for tags 'rest api'.
-
Error with Home Center 3 REST API when trying to add device
jooftian posted a question in Home Center 3
The example JSON in swagger states that a request similar to the first code in this post sent to IP/api/devices as POST should create plugin. Well, response is (verbatim) the second code. I think that extra quotation mark appearing twice in "message" is an indicator of an internal error, and HC can't recongnize the device type. And I'm certain of that because after querying another device (IP/api/devices/{deviceId}), or querying device type hierarchy (IP/devices/hierarchy), that device type exists. I'm open to other opinions, perhaps I'm doing something wrong even. JSON in swagger: { "name": "name", "type": "com.fibaro.binarySwitch", "roomID": 219 } Server response: { "type": "ERROR", "reason": "Type not found", "message": "Plugin for type 'com.fibaro.binarySwitch'' does not exist." }-
- bug
- device type
-
(and 2 more)
Tagged with:
-
Hello, I'm trying to make a method in my C# application which either turns on or off a Wall Plug. If I'm using the POST method/devices/{deviceID}/action/{actionName} on the "FibaroIpAddress/docs" API website, it works e.g. when I type in 11 as deviceId and turnOn/turnOff in actionName. the website then tells me that the request URL will look like this: http://IpAddress/api/devices/11/action/turnOff or http://IpAddress/api/devices/11/action/turnOn In my application I then use the same request URL with the code: try { var endPoint = new Uri(url); //stores credentials for the API access var cache = new CredentialCache { { endPoint, "Basic", new NetworkCredential(userName, password) } }; // Create a new request to the URL endpoint. var request = WebRequest.Create(endPoint); // Adds credentials to the WebRequest. request.Credentials = cache; //Assign the response object of 'WebRequest' to a 'WebResponse' variable using (var response = request.GetResponse()) { //Reads everything from the API call and stores it. using (var reader = new StreamReader(response.GetResponseStream())) { toReturn = reader.ReadToEnd(); } } } catch (UriFormatException e) { Console.WriteLine("Error:" + e); } But nothing happens when this runs. I've also tried this code: // Creates a endpoint to the url. var endpoint = new Uri(url); // Creates credentials for the endpoint. var cache = new CredentialCache { { endpoint, "Basic", new NetworkCredential(userName, password) } }; // Creates a new request and sets credentials. var request = (HttpWebRequest)WebRequest.Create(endpoint); request.Credentials = cache; // Specifies request. request.Method = "POST"; request.ContentType = "application/json"; request.Timeout = 5000; // Gets a streamObject to use to write request data. var dataStream = request.GetRequestStream(); // Sends the data. dataStream.Flush(); But nothing happens here either. I've use the same code for different GET requests or PUT requests (e.g. change name of device) and it works. I've also tried to just run the request URL directly into my browser, but nothing happens there either. Does someone know what I'm doing wrong?
-
Humidity sensor with serial number
BachelorBoysa posted a question in Other Devices / Third-party devices
Hello, I've been trying to use the REST API to make my own application and in order for this to work I'm heavily dependant on the Serial Number which each Fibaro sensor has. The problem is that Fibaro doesn't seem to have any Fibaro Sensor which also measure the Humidity. So I have bought a Cleverio Humidity sensor ( https://www.kjell.com/no/produkter/smarte-hjem/smarte-hjem-losninger/cleverio-smarte-hjem/cleverio-z-wave-temperatursensor-p51112 ) but the problem is that in the REST Api it isn't provided a serial number under the "properties". I am also not able to edit these "properties" in the api. I then bought a Netatmo weather station, but the problem is the same here, no serial number. My question is, do anyone know of a Humidity sensor from Fibaro or a 3rd party humidity sensor which I can connect to my Home Center 2 which contains a serial number? -
Why the rest api document not include the method to set value? there is a method in lua document to do this -- non-parametric 'turnOff' action call of id=12 device fibaro:call(12, 'turnOff'); -- 'setValue' action call with one additional parameter fibaro:call(12, 'setValue', '23'); Call Action URL: /api/devices/deviceID/action/actionName deviceID – ID of an existing device actionName – Name of an action Methods: POST Description: Trigger an action of the specified device Response: and when I call http://xxxxxxxx/api/devices/12/action/setValue it returns error { "error": { "code": -1, "message": "Exception: Server error" }, "id": 1, "jsonrpc": "2.0" } So, how to pass the actionName with the value in rest api.... waiting for your response, thank you very much!
-
I am using version 4.511 beta Home Center 2 fibaro system. I use the REST API to develop a react native app. I want to filter the device by type (blind, door, light, etc). In the api doc, there is only /devices and /devices/{deviceID}, the response type com.fibaro.FGRM222 (blind), com.fibaro.FGD212(light), com.fibaro.binarySwitch(light,door) , can not determine the device type. On the other hand, i want to filter the devices by room id, however the api not included. I am waiting for any help, thank you very much.
-
Hi, I found two issues with the REST API, one with the API and one with the documentation . The two are separate issues API the /api/service/backups is not accessible over local host ip and port This will work local ipaddress = '192.168.1.90' -- IP of HC2 local port = 80 local rs2 = Net.FHttp(ipaddress, port) local result_bkup = rs2:GET("/api/service/backups") but this won't return any data and throws an error local device = fibaro:getSelfId() local localhost = '127.0.0.1' local localport = 11111 local rs1 = Net.FHttp(localhost, localport) local result_bkup = rs2:GET("/api/service/backups") yet this will work (different api call) local device = fibaro:getSelfId() local localhost = '127.0.0.1' local localport = 11111 local rs1 = Net.FHttp(localhost, localport) local result_diag = rs1:GET("/api/diagnostics") local result_info = rs1:GET("/api/settings/info") Documentation http://<HC2IP>/docs shows the call correctly to be /api/service/backups The Fibaro developer site shows the call to be /api/settings/backups and doesn't work I assume it was deprecated at some stage and the documentation not updated Regards _f
-
When you have multiple HCLs as a slave and HC2 as a master for covering whole project, it's needed to import some devices. Sometimes imported devices in HC2 has a different value, from those in HCL. Please Fibaro, can you make additional command to REST API that represent button "Synchonize" located in "Gateway connections". It's realy pain, to make virtual device for such synchonization.
-
global variable to virtual device with REST API
jakub.jezek posted a question in Scenes and Interface
Hi guys, How can i take global variable to label in virtual device on HCL unit, with rest api? I'm making water consumption and i have hydrometer (Bonega T/20), which sending electric pulses throw relay module to universal unit, I have accuracy to 0.5 liters. I made it on HC2 with LUA code and i want it for HCL. LUA code in main loop in virtual device (HC2 unit): local id_virtual = 5 -- virtual unit ID local pulsy = fibaro:getGlobal("pulsy") -- getting value of global variable named pulsy fibaro:debug(pulsy) -- for testing fibaro:call(id_virtual,"setProperty","ui.Label2.value",pulsy .. " litrů") -- save value to label2