Coder Social home page Coder Social logo

Sending a file about hassio-addons HOT 15 CLOSED

agileek avatar agileek commented on July 19, 2024
Sending a file

from hassio-addons.

Comments (15)

14roiron avatar 14roiron commented on July 19, 2024 2

Perfect it s working for both photo and videos
thank you very much 👍

from hassio-addons.

MichaelBitard avatar MichaelBitard commented on July 19, 2024

Hello,

You're welcome!

Well spotted for the documentation, I'll add that to the README.

For your issue, that's strange, it works on my machine ™️

I receive some svg and png daily, without issue. I just tried with a jpg too and it works.

I'll need more information to investigate, are you using the last version of the addon? what signal app are you using to receive the messages ? I tested and it works on android and with the signal app on linux

from hassio-addons.

14roiron avatar 14roiron commented on July 19, 2024

Thanks for your quick answer,

Setup is hassio on a VM, Amd64

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[2021-02-22 18:16:40 +0100] [202] [INFO] Starting gunicorn 20.0.4
[2021-02-22 18:16:40 +0100] [202] [INFO] Listening at: http://0.0.0.0:5000 (202)
[2021-02-22 18:16:40 +0100] [202] [INFO] Using worker: sync
[2021-02-22 18:16:40 +0100] [205] [INFO] Booting worker with pid: 205
SETTING LOG LEVEL TO 10
2021-02-22 18:16:41,065 - root - INFO - Init
2021-02-22 18:16:41,069 - root - INFO - Listening to incoming messages
2021-02-22 18:16:41,069 - root - INFO - Process started and listening on 4a36bbd1-signal
INFO DaemonCommand - Exported dbus object: /org/asamk/Signal

This is the start up screen.

I have the latest version on android and mac.
version 10.11.2 for Hassio Addon

And I downloaded your component few days ago, so it should be the last version.

I thought it was due to

            if data is not None and ATTR_FILE in data:
                files['file'] = (data.get(ATTR_FILE), open(data.get(ATTR_FILE), 'rb'), 'application/octet-stream')

in notify.py of the component, as the file is detected as an octet stream
I will try to run some tests

from hassio-addons.

MichaelBitard avatar MichaelBitard commented on July 19, 2024

The octet-stream is the way to send the data to the http server, but maybe you could try and tweak it.
Is your number trusted? Maybe it's some "security" from signal.

If you want, you can DM (via twitter?) me your phone number and I'll send you a message from my hassio addon with a picture to see if it works?

from hassio-addons.

14roiron avatar 14roiron commented on July 19, 2024

If I use an image from the Web, it seems to be working fine
I am trying to investigate why my pictures are causing issues

from hassio-addons.

MichaelBitard avatar MichaelBitard commented on July 19, 2024

that's interesting, is your image generated from a camera stream? maybe you are missing some headers

from hassio-addons.

14roiron avatar 14roiron commented on July 19, 2024

That's coming from the hassio automation and one of my camera:

alias: Take ScreenShot
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.0x00158d0000000000_contact
    attribute: friendly_name
    from: Closed
    to: Open
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 3
      milliseconds: 0
  - service: camera.snapshot
    data:
      filename: >-
        /config/www/doors/cam_{{ now ().year }}_{{ now ().month }}_{{ now ().day
        }}_{{ now ().hour }}.jpg
    entity_id: camera.reolink_profile000_mainstream
  - delay:
      hours: 0
      minutes: 0
      seconds: 3
      milliseconds: 0
  - service: notify.signal
    data:
      message: Door Open
      data:
        file: >-
          /config/www/doors/cam_{{ now ().year }}_{{ now ().month }}_{{ now
          ().day }}_{{now ().hour }}.jpg
mode: single

and this is the ouput of a file command:

tmpyelfu0fz: JPEG image data, baseline, precision 8, 2560x1920, components 3

The hashes are the same before sending to signal and after.

Let me try another camera. I don't know if the snapshot function is manager by HA or the camera itself, but it's not a bug on signal integration
Thanks
yohann

from hassio-addons.

14roiron avatar 14roiron commented on July 19, 2024

cam_2021_2_22_20_57.jpg.zip

All my camera give me the same file format, even though one use Onvif and the other one, the mjpeg driver, here is a file if you want to try

from hassio-addons.

kevdliu avatar kevdliu commented on July 19, 2024

I ran into this issue with images generated by my IP cameras as well. It seems like signal detects the format of the file via some sort of metadata instead of the file extension. The images generated by the IP cams do not contain that metadata and therefore signal does not show them as images. I ended up writing a simple custom component which basically uses PIL to convert the images into jpgs, which adds the required metadata and fixes the issue.

from hassio-addons.

14roiron avatar 14roiron commented on July 19, 2024

that's why the telegram integration require an additionnal tag as described here:
https://community.home-assistant.io/t/ip-camera-snapshot-automation/41319/3

from hassio-addons.

MichaelBitard avatar MichaelBitard commented on July 19, 2024

I can reproduce you problem with your file indeed. I think we should open an issue to signal to see if there is something that could be done on their side, or something we should ensure before sending the image.

The bug appears on android and linux desktop. Can I use your image for the signal issue @14roiron?

from hassio-addons.

MichaelBitard avatar MichaelBitard commented on July 19, 2024

I think I could also try to fix it by not sending a random file name but rather using the filename given as parameter

from hassio-addons.

14roiron avatar 14roiron commented on July 19, 2024

Yes of course you can use this inage
I was trying to add a specific tag in the data to force the file as a picture, by replacing the octet-stream header
I have the same issue if I try to record a short 5s video and send it to signal

from hassio-addons.

MichaelBitard avatar MichaelBitard commented on July 19, 2024

The octet-stream is not the issue IMHO, because it's the communication side between the home assistant integration and the hassio docker addon, not between the hassio docker addon and the signal server.

from hassio-addons.

MichaelBitard avatar MichaelBitard commented on July 19, 2024

It works \o/ (you have to update to 10.13.1)

@14roiron can you test it too? and close the issue if that's ok

from hassio-addons.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.