Jump to content

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 'PUT'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • FIBARO Community
    • FIBARO Portal and Forum policy
    • FIBARO
    • Say hello!
    • Off-topics
  • FIBARO Update
    • FIBARO System Update
    • FIBARO Mobile Update
  • FIBARO Community Support
    • Scenes and Interface
    • FIBARO Products
    • FIBARO Mobile
    • FIBARO HomeKit
    • FIBARO Assistant Integrations
    • Other Devices / Third-party devices
    • Tutorials and Guides
    • Home Automation
    • Suggestions
  • FIBARO Społeczność
    • FIBARO
    • Przywitaj się!
    • Off-topic
  • FIBARO Aktualizacja
    • FIBARO System Aktualizacja
    • FIBARO Mobile Aktualizacja
  • FIBARO Wsparcie Społeczności
    • Sceny i Interfejs
    • FIBARO Urządzenia
    • FIBARO Mobilnie
    • FIBARO HomeKit
    • Integracja z Amazon Alexa i Google Home
    • Urządzenia Firm Trzecich
    • Poradniki
    • Automatyka Domowa
    • Sugestie

Categories

  • Scenes
  • Virtual Devices
  • Quick Apps
  • Icons

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Facebook


Google+


Skype


Website URL


WhatsApp


Country


Gateway/s


Interests

Found 11 results

  1. My problem: I want to change the "modified" of a global variable to trigger scenes as well, because if you assign global variable the same value it had before, Fibaro does not change the modified entry. Here is my global variable used to document if I this person is at home or somewhere else. { "name": "Christian", "value": "Office", "readOnly": false, "isEnum": true, "enumValues": [ "Office", "Sport", "Home", "ontheway" ], "created": 1644958957, "modified": 1645209384 } We all know the geofencing works only properly if app is active on the smartphone. So it might happen variable still reports "Home" although the Person is not at home. Now the person get's home and geofence switch the Variable to "Home" again. This will not trigger the "modified" because it's still the same value. This means. the globals Person I am using in scenes as trigger does not trigger, beause vaue remains the same. So my intention was to change the "modified". I receive a result 200 (means works), but the "modified" does not change, although I am able to change the "value" for debugging test. Here is the LUA, and my question is, why does it work for Persondata.value (value change) and does not work for Persondata.modified (value remains the original one) local value, modified = fibaro:getGlobal("Christian") print(os.date("%c", modified)) local Person = "Christian" local Persondata = api.get('/globalVariables/'..Person) Persondata.value = "Golf" print(os.date("%c", Persondata.modified)) Persondata.modified = tonumber(os.time() - 1) print(os.date("%c", Persondata.modified)) PersonJSON = json.encode(Persondata) local http = net.HTTPClient() http:request("http://127.0.0.1:11111/api/globalVariables/"..Person, { options = { method = 'PUT', headers = {}, data = PersonJSON, timeout = 10000 }, success = function(response) local result = response.data; if response.status == 200 or response.status == 201 then fibaro:debug(response.status) -- Display('lightgreen', Text, 999) else fibaro:debug(response.status) -- Display('red','Error: ' ..response.status.. ' - Zugriff verweigert',0) end end, error = function(err) fibaro:debug(err) --Display('red','[ERROR] ' .. err, 0) end }) fibaro:sleep(6000) value, modified = fibaro:getGlobal("Christian") print(os.date("%c", modified)) print(value) and the debug is:
  2. Cześć, Mam zagwózdkę z komendą api.put Chcę zmianić parametr urządzenia (nie VD, nie sceny) (np. ikony) Jeśli chodzi o zmianę nazwy urządzenia to rozwiązałem to w ten sposób: --[[ %% autostart %% properties %% weather %% events %% globals --]] function main() local jHome = json.decode(fibaro:getGlobalValue("jMyHomeIDs")) end api.put('/devices/118', {name='pompa'}) działa (może komuś przy okazji się przyda bo przykładów jak używać api.put jak na lekarsto (zwłaszcza odnośnie urządzeń a nie VD) natomiast już: api.put('/devices/118', {"properties": {"deviceIcon":1022}}) niestety nie działa, mimo iż po wpisaniu {"properties": {"deviceIcon":1022}} w http://192.168.1.2/docs/ daje pożądany rezultat i zmienia ikonę proszę o ewenetualne nakierowanie gdzie błąd!? Z góry dziękuję PS. Chcę wykorzystać zmianę ikony (jak i innych parametrów) w ten sposób że do jednego gniazdka streowanego przy pomocy relay switch podłączam rózne urządzenia w zależności od pory roku.
  3. Guys, i simple need to send this command using a VD: Button1: PUT http://admin:[email protected]/ISAPI/ContentMgmt/record/control/manual/start/tracks/101 Button2:PUT http://admin:[email protected]/ISAPI/ContentMgmt/record/control/manual/stop/tracks/101 How can i do? Do u have some example? There ia also a way to check the status of the command? Regards Gianluca
  4. Witam, mam problem z jedną sceną, chciałem żeby akcja wykonywała się tylko kiedy jestem w domu, niestety nie działa. Jedną z rzeczy jakie próbowałem to poprawienie lokalizacji domu na mapie. Nie wiele to daje, ale w związku z tą mapą to dlaczego widnieje na niej napis że jest tylko do celów developerskich? Fibaro nie zapłaciło licencji dla Google? To tak można? Spróbowałem zaktualizować lokalizację z api i tu kolejne rozczarowanie, fibaro ma nowy typ odpowiedzi na request w postaci restartu centralki. Ręce opadają. Może ktoś miał podobne problemy z scenami z lokalizacją? Czego jeszcze spróbować?
  5. Dear forum readers, I wanted to make HTTP request to an IP device of mine. to make it possible to send a body to a Url so that the variables wil change. i have 4 buttons in my virual device and each have to send its one variables to the ip device the Data of the body has to go to this link and de body variables are : <"eec0c0b41b4c43119d33e2bdafe1fc08"><name>Woonkamer</name><type>livingroom</type><preset>asleep</preset></location></locations> I know that i have to use the put command but i don't know how i exactly will put all the variables in the body. plugwise = Net.FHttp("ip", 80) plugwise:setBasicAuthentication("Username", "pass") fibaro:log(response) Can someone help me. on how i can do this on the best way.
  6. Hello, I'm trying to modify a already define global variable using the REST API for the HC2. This is done from a ESP2866 (nodeMCU-isch) board. I can do a http.get towards the HC" and I get the correct JSON information. When I do http.put I seem not to be able to set the variable. My message headers contains a basic auth, and I have payload that looks like this {"value":"On"} The address looks like this http://1.2.3.4/api/globalVariables/thevariable According to the httpclient i'm using i seem to get return code 200 but no result and the variable is not changed. Using the hc2ip/docs link I can test this out with the correct payload and it works fine. However I'm logged in as an Admin then. Trying to change the user from my ESP2866 I just got that the HC" banned me for 30 min. So is there a problem using normal users when trying to modify a global variable ? Do I need to be admin ? Or is there something else I need to check ? Regards P
  7. I find the documentation on network programming in LUA not very elaborate so I put a question here. From my HC2 I want to send a HEX string to a (wifi connected) device in my network and I want to receive a HEX string from the same device. so I start with opening a session to the device with IP and port as shown in the code and next I try to send a 0x07 to the device local WHR = Net.FHttp("172.17.1.221", 8899); res, status, errorCode = WHR:PUT('0x07'); but this results in an error message. Can anybody give me some hints on network programming on the HC2 in VD's of direct me to useful documentation. thanks
  8. Good Morning Guys, I need to create a Virtual Device in order to enable/disable some functionality of my devices. Shortly in need to extract the XML, modify a tag value, re-upload the xml. I have understood that using "Net.FHttp" and GET/PUT command im able to RETRIEVE and PUT the XML.... Example: response,status,errorcode = device:GET('URL') Example: response,status,errorcode = device:PUT('URL',XML) But how the entire process can be writed in LUA? 1) How to store in a variable the entire XML extracted using teh GET command? 2) How to replace the xml tag parameter ? ex. from enable to disable 3) How to re-upload the modified XML? Thanks in advnace Regards Gianluca
  9. Hi to all, Sorry if I started a new discussion but I don't find information about my doubt. My main need is to send some information from an external server to HC2 ... to a scena ... or a virtual device... I try to call HC2 through API from another server using REST API but i cannot find the correct syntax to ... for examples "press a button " in a virtual devices... There is someone that can help me? Thanks a lot in advance Paolino
  10. Hi, I'm trying to test the REST API via PHP. GET is ok, I'm able to read and display each data in my application. Now I want to test the POST and PUT API. I tryed to change a device name, but nothing happens. This is my code: $dati = '{"id":197,"name":"zanna","roomID":6,"type":"com.fibaro.motionSensor","baseType":"com.fibaro.lifeDangerSensor","enabled":true,"visible":true,"isPlugin":false,"parentId":195,"remoteGatewayId":0,"interfaces":["fibaroAlarm","fibaroAlarmArm","fibaroBreach","tamper","zwave","zwaveSceneActivation"],"properties":{"parameters":[{"id":1,"lastReportedValue":0,"lastSetValue":0,"size":2,"value":0},{"id":2,"lastReportedValue":0,"lastSetValue":0,"size":2,"value":0},{"id":3,"lastReportedValue":0,"lastSetValue":0,"size":1,"value":0},{"id":4,"lastReportedValue":0,"lastSetValue":0,"size":1,"value":0},{"id":5,"lastReportedValue":255,"lastSetValue":255,"size":1,"value":255},{"id":6,"lastReportedValue":255,"lastSetValue":255,"size":1,"value":255},{"id":7,"lastReportedValue":255,"lastSetValue":255,"size":1,"value":255},{"id":8,"lastReportedValue":255,"lastSetValue":255,"size":1,"value":255},{"id":9,"lastReportedValue":0,"lastSetValue":0,"size":1,"value":0},{"id":10,"lastReportedValue":20,"lastSetValue":20,"size":1,"value":20},{"id":11,"lastReportedValue":200,"lastSetValue":200,"size":1,"value":200},{"id":12,"lastReportedValue":8,"lastSetValue":8,"size":1,"value":8},{"id":13,"lastReportedValue":0,"lastSetValue":0,"size":1,"value":0},{"id":14,"lastReportedValue":0,"lastSetValue":0,"size":1,"value":0}],"zwaveCompany":"Fibargroup","zwaveInfo":"3,3,52","zwaveVersion":"2.1","pollingTimeSec":0,"alarmDelay":"0","alarmExclude":"false","alarmTimeTimestamp":"0","armConditions":"{}","armConfig":"0","armDelay":"0","armError":"{}","armTimeTimestamp":"0","armed":"false","configured":"true","dead":"false","deviceControlType":"0","deviceIcon":"21","emailNotificationID":"0","emailNotificationType":"0","endPointId":"1","fibaroAlarm":"false","lastBreached":"1479350609","liliOffCommand":"","liliOnCommand":"","log":"","logTemp":"","manufacturer":"","markAsDead":"true","model":"","nodeId":"38","parametersTemplate":"85","productInfo":"1,15,5,1,16,2,2,1","pushNotificationID":"0","pushNotificationType":"0","remoteGatewayId":"0","saveLogs":"true","sceneActivation":"0","serialNumber":"","smsNotificationID":"0","smsNotificationType":"0","tamper":"false","useTemplate":"true","userDescription":"","value":"false"},"actions":{"forceArm":0,"meetArmConditions":0,"reconfigure":0,"sceneActivationSet":0,"setArmed":1},"created":1478196735,"modified":1478196735,"sortOrder":112}'; $stringa_dati = json_encode($dati); // Get cURL resource $curl = curl_init(); // Set some options - we are passing in a useragent too here curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => 1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $stringa_dati, CURLOPT_HTTPHEADER => array('Content-Type: application/json','Content-Length: ' . strlen($stringa_dati)), CURLOPT_URL => $ZanGeneric->domotica_hc2_api . '/devices/197', CURLOPT_TIMEOUT => 5, CURLOPT_USERAGENT => 'Codular Sample cURL Request' )); // Send the request & save response to $resp $resp = curl_exec($curl); //Trasformo la stringa in un oggetto JSON $obj = json_decode($resp,true); // Close request to clear up some resources curl_close($curl); Is there someone can send an example? Thanks
  11. Morning all! Been trying to figure all the documentation all last night about Global Variables and the API. I can look at the status of a variable but no idea how to set it using the API? Does anyone know the line for setting Global Variables using the API? Thanks!!
×
×
  • Create New...