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

Proper way to send a http-command to another LAN device?


Question

Posted

What is the proper way to send a http-command from the HC2 to another LAN device, like an IP-camera?

The goal is to make a virtual device which can send a http-command to a Panasonic IP-camera. This command will enable or disable the camera's 'privacy mode' mode.

The commands to send is:

Enable privacy modus:

Please login or register to see this code.

Disable privacy command:

Please login or register to see this code.

Status privacymodus:

Please login or register to see this code.

Return: 1 (Enabled)

Return: 0 (Disabled)

Return: -1 (No Func parameter)

Return: -2 (No Kind parameter)

Return: -3 (No Data parameter)

Return: -4 (Invalid Func value or Invalid Kind value, Unsupported feature)

Return: -6 (Error while writing to flash memory)

Return: -7 (Privacy button setting (enable/disable), changed while Privacy Mode was turned on)

Return: -8 (Upper data setting error)

Return: -9 (Administrator ID and password not set)

Return: -11 (Not accessed by administrator)

Thanx in advance!

4 answers to this question

Recommended Posts

  • 0
Posted

Hi Lambik,

Not ignoring but there are a few samples on the forum. Proper is a tough question. If your question is which one is Fibaro way, I guess start from a.socha's posts.

  • 0
  • Inquirer
  • Posted

    Question...

    Please login or register to see this code.

    Now I get data in variable CamResponse:

    Data:1

    How can I filter just the zero, or an other number which is send back, so I can make a if-then construction?

    As I mentioned before, I just taking little steps ahead in this programming thing...

    Please login or register to see this image.

    /emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

    EDIT: or is there a way to compare a string?

    (like if CamResponse = "Data:1" then ....)

    • 0
    Posted

    How can I filter just the zero, or an other number which is send back, so I can make a if-then construction?

    As I mentioned before, I just taking little steps ahead in this programming thing...

    Please login or register to see this image.

    /emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

    EDIT: or is there a way to compare a string?

    (like if CamResponse = "Data:1" then ....)

    In LUA you can do this with : string.byte (myString [, position])

    string.byte ("Data:1" [, 6])

    string.byte ("Data:7" [, 6])

    • 0
  • Inquirer
  • Posted

    Thanx! it works!

    Please login or register to see this image.

    /emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

    BTW, how can I compare a whole string?

    Like:

    if CamResponse == "Data:0"

    then

    ........

    EDIT: I used another function. The function returns a value with corresponds with ascii-table. Used 'string.sub' instead incombination with 'tonumber'

    This what I did:

    Global variable:

    PrivacyModus_AU with values -1, 0, 1, 2

    Main loop:

    Please login or register to see this code.

    Button:

    For switching Privacymodus On/Off (togglebutton)

    Please login or register to see this code.

    If anybody has suggestions, please do!

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