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


  • 0

How to call a simple HTTPS command


Question

Posted (edited)

I am trying to get this to work... I have a Fibaro Movement Sensor in the hallway and want to do the following.. 

When the sensor is breached, it should send out a https message to macrodroid link which will in turn turn the brightness of the Android Tablet sitting next to the door to 100% and then set the CCTV app to full screen. I am using Macrodroid to automate the part of the android bit and it all works. I just can't work out how to call the https link.

 

The link is like this. Any ideas how I can call it??  It can be either a scene or VD.

 

Please login or register to see this link.

 

Many thanks in advance.. ( I have done a search of the forum and the examples listed are just too complex for me to understand.. hence I am asking here.) ;-)

Edited by rajp

5 answers to this question

Recommended Posts

  • 0
Posted (edited)

On French forum you have good example for https with HC2

Please login or register to see this link.

For unblock download you need create account and post welcome post in section "Nouveau ? Présentez-vous"

 

Edited by drboss
  • Like 1
  • 0
Posted

Hello @rajp

 

I have done a similar thing in that I make https requests to a service on the internet using lua code

 

Below is a link to my code repository, on the line indicated you will see a http request call being made. You will need to ensure checkcertificate is false as the fibaro system cannot verify ssl (https) requests.

 

Please login or register to see this link.

 

Additonally, this code only works within a scene, not inside a virtual device. This should still work for you as I expect you will create a scene which is triggered by the PIR being ‘breached’

 

I hope that helps you to get going

 

Ian

 

  • Like 2
  • 0
  • Inquirer
  • Posted

    Thank you both.. I have the following code that does work now.. I could not get the syntax of getting the function defned properly.. but your code was very helpful... this is still quite raw, I will refne it further and then implement it....

     

    --[[
    %% properties
    %% globals
    --]]

    baseUrl = "https://trigger.macrodroid.com" 
    local timeout = 10
    local http = net.HTTPClient({timeout=2000})

    function sendRequest(url)
    fibaro:debug("GOne into Send Req")
    fibaro:debug("BaseUrl is " .. baseUrl .. url)
        http:request(baseUrl .. url, 
        { 
            options = {
                timeout = 5000,
                checkCertificate = false
            }})
    fibaro:debug("GOne out of Send Req")        
    end

    function run()
    fibaro:debug("Gone into Run FUnction")
    sendRequest("/**************")
    end

    run()
    fibaro:debug("Running")

    • 0
    Posted

    Hi @rajp

    Have you got any documentation or link about macrodroid. I don't use it yet but it seems very powerfull with https from hc2 .

    • 0
  • Inquirer
  • Posted
    3 hours ago, pepite said:

    Hi @rajp

    Have you got any documentation or link about macrodroid. I don't use it yet but it seems very powerfull with https from hc2 .

    The only documentation was what is on their site... pretty powerful and useful too.. I just downloaded it and got it to run fairly quickly..

    • 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
    Answer this question...

    ×   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...