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


Recommended Posts

Posted (edited)

Hello dear Fibaro Users & developers,

 

I am experiencing an issue with my HC3 while making API calls to another system in my network, Domoticz.

Who has the same experience or solution to resolve this?

The Issue:

I created a scene in the HC3 that includes program code to make an API call to Domoticz. However, the API call does not work as expected.

To verify the code, I tested the same API call outside the HC3 using curl commands, and it works flawlessly.

Each time I activate the scene, I see the following error in the Domoticz system log:

 
2024-12-16 23:37:36.517 Status: [WebServer] Deprecated RType () for API request. Call ignored, please use correct API Command! (192.168.xx.yyy)
< We an say that te network connection between both systems is correct. Otherwise Domoticz can not log the incomming API call :-) >

Additional Details:

  • When testing Domoticz without the HC3 making API calls, everything works correctly.
  • It seems the HC3 may be sending an invalid or deprecated request parameter (e.g., RType).
  • My Domoticz system is running the latest version, and the HC3 firmware is up to date (v5.170.16).
Edited by Struikrover
Header changed
  • Struikrover changed the title to Issue with API Calls from HC3 to Domoticz - API code HC3 not up to date?
  • Topic Author
  • Posted (edited)

    The Scene LUA code is:

     

    local http = net.HTTPClient()
     
    -- De Base64-encoded string van username:password
    local base64_auth = "Authorization: Basic bWFyY2Vsxxxxxxxpams1IQ=="  -- Zorg ervoor dat je deze string vervangt door je eigen geëncodeerde string
     
    -- URL zonder gebruikersnaam en wachtwoord
    local url = "http://192.168.99.0/json.htm?type=command&param=switchlight&idx=1918&switchcmd=Off"
     
    -- De HTTP-aanroep met de Authorization header
    http:request(url, {
        options = {
            method = "GET",
            headers = {
                ["Authorization"] = base64_auth
            }
        },
        success = function(response)
            fibaro.debug("SUCCESS", "Status Code: " .. response.status)
            fibaro.debug("Response Data", response.data)
        end,
        error = function(err)
            fibaro.debug("ERROR", "HTTP Request fout: " .. tostring(err))
        end
    })
    Edited by Struikrover
    Posted
    2 hours ago, Struikrover said:

    The Scene LUA code is:

     

    local http = net.HTTPClient()
     
    -- De Base64-encoded string van username:password
    local base64_auth = "Authorization: Basic bWFyY2Vsxxxxxxxpams1IQ=="  -- Zorg ervoor dat je deze string vervangt door je eigen geëncodeerde string
     
    -- URL zonder gebruikersnaam en wachtwoord
    local url = "http://192.168.99.0/json.htm?type=command&param=switchlight&idx=1918&switchcmd=Off"
     
    -- De HTTP-aanroep met de Authorization header
    http:request(url, {
        options = {
            method = "GET",
            headers = {
                ["Authorization"] = base64_auth
            }
        },
        success = function(response)
            fibaro.debug("SUCCESS", "Status Code: " .. response.status)
            fibaro.debug("Response Data", response.data)
        end,
        error = function(err)
            fibaro.debug("ERROR", "HTTP Request fout: " .. tostring(err))
        end
    })

     

    If I am not wrong, I think you have to use a quickapp for this. Since a scene just dies after it have runned once? and wont be alive to se the response.data 🤔 

    I do not use scenes at all so dont take my answar for been 100% correct 😅 

     

    Posted

    Scene should work. Try to urlencode the query part of the url "?type=command&param=switchlight&idx=1918&switchcmd=Off"

    • Like 1

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...