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


binary r/w


10der

Recommended Posts

Hi Fibaro team.

 

as we all knows we havn't access to HC2 file system. We can't save any temp binary files (more than this /tmp).

so. can you allow to write binary data to 

Please login or register to see this link.

 

Please login or register to see this link.

also allow to read binary data from here directlty.

Please login or register to see this link.

 

Please login or register to see this link.

?raw

(^^^^^^^^^^^^^^ no json response = just binary contant)

 

use case ONE:

1) LUA scene trigger a some external event and got for example .JPG file as binary.

2) I have save this value [PUT] Test

3) configure fibaro/en/devices/camera_edit.htm. configure JPG path. as  

Please login or register to see this code.

voila we have snapshot cam what can show a last triggered event with picture

 

use case TWO:

1) LUA scene send to 

Please login or register to see this link.

ello!

2) got raw mp3 file

3) i have save it to global var [PUT] Test

4) call Sonos VD and provide url  http://192.168.1.36:80/api/globalVariables/Test?raw

voila !

I can play any Sonos messages without 3dparty devicees!

 

please! 

Please login or register to see this image.

/monthly_2019_07/image.png.800c6eb0aa36ab20c76b508f3afaf103.png" />

 

thank you!

Edited by 10der
Link to comment
Share on other sites

Well, you can read in a image/jpeg with net.HTTPClient() and store it in a global as binary data is just strings...

However, when serving up the data (http://192.168.1.36:80/api/globalVariables/Test?raw)  you need to associate it with a content type, usually by associating with the prefix or path of the resource.

E.g. "HTTP/1.1 200 OK\nContent-Type: image/jpeg\nContent-Length: XX\n\n"

Now you get the application/json by default and the whole GV struct. Maybe http://192.168.1.36:80/api/globalVariables/Test/value?image/jpeg ?

 

I would prefer that they allowed us to open server sockets...

  • Like 2
Link to comment
Share on other sites

  • Topic Author
  • 21 minutes ago, jgab said:

    I would prefer that they allowed us to open server sockets...

    Jan. thank you for understanding my idea.

    yes, you are right, but implementing server sockets according to quick development by Fibaro (irony) it's not a short term, as for me.

    Link to comment
    Share on other sites

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