Multiple seven_segments

It looks like when I setup 2 seven_segments platforms, it gets messy.
This is my config:

image_processing:
  - platform: seven_segments
    name: UPSBattery
    source:
      - entity_id: camera.upssensorcam
    x_position: 50
    y_position: 80
    height: 230
    width: 370
    threshold: 30
    extra_arguments: dilation 5 invert

  - platform: seven_segments
    name: Washing timer
    source:
      - entity_id: camera.washSensorCam
    extra_arguments: -Dwashcam.png

The cameras are setup correctly and working fine if I have only one ocr enabled.
So, here it is: The component outputs a file “ocr.png” from the camera source and analyses it.
Is there a way to have the second one having another output file “ocr2.png” ? Using the extra argument -D only extracts another file that is “for my eyes only” and is no use for the component.

I am on raspbian stretch.

I am bumping this, as I havent figured it out yet.

My problem is that I have 2 different screens at 2 rooms that I want to read with seven_segments component.
Can this be done?

Here is another bump, just in case some sees that and knows how to do this.

To answer your question, no…

https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/image_processing/seven_segments.py#L72

It looks like multiple instances will take turns overwriting the same file.

You could probably patch it by replacing ‘ocr.png’ with _name.replace(’ ‘,’_’) + ‘.png’ or something like that.

I thought so… Too bad I cant do this. Thank you very much for clearing this to me!

I’ve created a patch… it’s just a one line change… you can find it attached to this issue. Give the patch a try and let the ticket know if it helps resolve your issue.

Wow! I wasnt expecting that! I have no github account also no experience with downloading from it. How can I download your patch?

I managed to copy your code and added it to the file I already had in my home assistant components. Dont know if that was the right way to “download the patch” but it did the trick and now the component does what I originally wanted to do! It can successfully read and recognize 2 cameras and now each file created is named after the entity name of the cameras! The settings like position and extra_arguments, also work correctly!
Thank you very much for this!

One question. I guess now when I update HA, I will have to re-apply the patch, right?

Cool, congratulations!

There are a couple of ways to do it…
You can make a copy of the sevensegments component py file and put it under the custom_components/image_processing folder or you can patch it in place with each release.

Once it’s officially merged and released you should remove the custom_components version, if you go that route.

1 Like