Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering via Home Assistant stopped working #388

Closed
sapnho opened this issue May 30, 2024 · 75 comments
Closed

Filtering via Home Assistant stopped working #388

sapnho opened this issue May 30, 2024 · 75 comments

Comments

@sapnho
Copy link

sapnho commented May 30, 2024

This one is for the master of Home Assistant, @helgeerbe ! :-)

I have always loved the filter possibilities of Pi3D via Home Assistant. However, some time ago, it stopped working. So, it has no effect if I now enter a keyword or modify the dates. HA is updated all the time, so I guess something broke along the way.

Was there anything that needed to be changed? I still use your old blueprint, which worked wonderfully before it didn't.

@sapnho
Copy link
Author

sapnho commented May 30, 2024

Screenshot_2024-05-30_at_10_42_54

@sapnho
Copy link
Author

sapnho commented May 30, 2024

Screenshot 2024-05-30 at 10 44 13

@helgeerbe
Copy link
Owner

Hi Wolfgang,

I can confirm that this stopped working. I don't know why yet. But I hope I have time this weekend to fix it.

@sapnho
Copy link
Author

sapnho commented May 30, 2024

Ah, good to know! Thanks!

@helgeerbe
Copy link
Owner

Home Assistant changed the way how it handles text sensors. Sensor devices are now limited to numbers. Text sensors have to use now the new text device entity.

I fixed this and created a new blueprint. This works as expected on my own devices.

Will deploy a new versions of picframe and the home assistant blueprint this weekend.

@sapnho
Copy link
Author

sapnho commented May 31, 2024

Oh, wow, great. Many thanks!

@sapnho
Copy link
Author

sapnho commented May 31, 2024

@helgeerbe I just did a fresh install on a Pi 4 with Buster. The max version of picframe I get to is 2023.07.26.post1

During installation, I got the following text:

Collecting picframe
Downloading picframe-2024.5.31-py3-none-any.whl.metadata (3.9 kB)
INFO: pip is looking at multiple versions of picframe to determine which version is compatible with other requirements. This could take a while.
Downloading https://www.piwheels.org/simple/picframe/picframe-2024.2.19-py3-none-any.whl (3.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2/3.2 MB 3.0 MB/s eta 0:00:00
Downloading https://www.piwheels.org/simple/picframe/picframe-2023.7.26.post1-py3-none-any.whl (3.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2/3.2 MB 2.9 MB/s eta 0:00:00

So, could it be that I can't use your latest commit with Buster?

@sapnho
Copy link
Author

sapnho commented May 31, 2024

Which OS version are you using?

@helgeerbe
Copy link
Owner

I use bullseye.

pi@picframe:~ $ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Is there a reason why you try buster?

@helgeerbe
Copy link
Owner

I also updated the blueprint https://gist.github.com/helgeerbe/78f66ecf1f5206ce50ef9599892f202a .

On bullesye everythings works fine for me.

@sapnho
Copy link
Author

sapnho commented May 31, 2024

I remember there was one issue with Bullseye back then which kept me using Buster. I'll do a fresh install with Buster and will check. Would you have the Bullseye specific instructions somewhere?

@helgeerbe
Copy link
Owner

What happens if you try pip install picframe==2024.5.31

@sapnho
Copy link
Author

sapnho commented May 31, 2024

I am in the middle of installing Bullseye.. :-)

What I would need are the raspi config settings and the manual start command line..

@sapnho
Copy link
Author

sapnho commented May 31, 2024

I am also having troubles with all the commands for Buster that I documented here: https://www.thedigitalpictureframe.com/how-to-add-crossfading-slide-transitions-to-your-digital-picture-frame-using-pi3d/

Do we have a Bullseye installation wiki somewhere?

@helgeerbe
Copy link
Owner

This ist still my fastest approach: https://gist.github.com/thomasedoff/3973846101da1e7496524be075f1c02f
And the best, ist doesn't require to run something with sudo as root.

@sapnho
Copy link
Author

sapnho commented May 31, 2024

Even this
python3 -m pip install picframe doesn't work.

/usr/bin/python3: No module named pip

@helgeerbe
Copy link
Owner

sudo apt install python3-pip

@sapnho
Copy link
Author

sapnho commented May 31, 2024

Thanks. That solves one thing but picframe -i . results in

Traceback (most recent call last): File "/home/pi/.local/bin/picframe", line 5, in <module> from picframe.start import main File "/home/pi/.local/lib/python3.9/site-packages/picframe/start.py", line 8, in <module> from picframe import model, viewer_display, controller, __version__ File "/home/pi/.local/lib/python3.9/site-packages/picframe/viewer_display.py", line 1, in <module> import pi3d File "/home/pi/.local/lib/python3.9/site-packages/pi3d/__init__.py", line 10, in <module> from pi3d.constants import (USE_PYGAME, PIL_OK, File "/home/pi/.local/lib/python3.9/site-packages/pi3d/constants/__init__.py", line 200, in <module> PLATFORM, bcm, openegl, opengles = _detect_platform_and_load_libraries() File "/home/pi/.local/lib/python3.9/site-packages/pi3d/constants/__init__.py", line 195, in _detect_platform_and_load_libraries set_gles_function_args(opengles) #function defined in constants/gl.py File "/home/pi/.local/lib/python3.9/site-packages/pi3d/constants/gl.py", line 387, in set_gles_function_args gles.glActiveTexture.argtypes = [GLenum] #

I guess, that's because I didn't install the right driver in raspi config. But which one do I choose?

@sapnho
Copy link
Author

sapnho commented May 31, 2024

I'll have to write a completely revised version for Bullseye once I get it to work.

@sapnho
Copy link
Author

sapnho commented Jun 1, 2024

I use bullseye.

Is there a reason why you try buster?

Yes, the whole batch of problems we saw back then: #195

I never got around to installing a running version with Bullseye with the same performance as Buster. But it seems you have found a way. How did you get it to work on a Pi 4?

@sapnho
Copy link
Author

sapnho commented Jun 1, 2024

What happens if you try pip install picframe==2024.5.31

pip install picframe==2024.5.31
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting picframe==2024.5.31
Could not find a version that satisfies the requirement picframe==2024.5.31 (from versions: 0.1.1, 0.1.3, 0.1.5, 0.1.6, 0.1.9, 2021.2.27a1, 2021.2.27a2, 2021.2.27a3, 2021.2.27a4, 2021.2.27a5, 2021.2.27a6, 2021.3.10, 2021.3.20, 2021.4.2, 2021.5.2, 2021.5.5, 2021.6.26, 2021.7.5, 2021.8.30, 2021.9.22, 2021.10.6, 2021.11.4, 2022.1.20, 2022.1.20.post1, 2022.3.24, 2022.4.19, 2022.6.3, 2022.12.4, 2022.12.13)
No matching distribution found for picframe==2024.5.31

@sapnho
Copy link
Author

sapnho commented Jun 2, 2024

I also updated the blueprint https://gist.github.com/helgeerbe/78f66ecf1f5206ce50ef9599892f202a .

On bullesye everythings works fine for me.

Great, thanks. I can't find your Wiki page where you originally described the integration, and mine is a bit outdated. Would you have the link again, please @helgeerbe ?

@helgeerbe
Copy link
Owner

@sapnho
Copy link
Author

sapnho commented Jun 2, 2024

Thanks. I am a bit lost with the Home Assistant Update.

I replaced the Blueprint, removed the MQTT integration, which came back after restarting picframe and removed the helpers you specified. Everything works fine except for the text inputs, which don't work. Tags, Location, Dates. When I enter a tag, I can see the message sent via MQTT (in MQTT Explorer) but the image choice is not adapted. I went through the original installation but I am not sure where I missed something.

@sapnho
Copy link
Author

sapnho commented Jun 2, 2024

Screenshot 2024-06-02 at 19 45 40

@helgeerbe
Copy link
Owner

can you check in the blueprint the entity ids of your helpers. If you deleted the original ones, they may have a different name.
image

@sapnho
Copy link
Author

sapnho commented Jun 2, 2024

Hmm, not entirely sure what you mean, but the names are the same everywhere.
Screenshot 2024-06-02 at 21 26 43
Screenshot 2024-06-02 at 21 28 42

@helgeerbe
Copy link
Owner

can you show me the topic, where the tags input is send from the mqtt explorer?

@helgeerbe
Copy link
Owner

if you enter a tag in the web frontend of picframe, does it show up in home assistant?

@sapnho
Copy link
Author

sapnho commented Jun 2, 2024

can you show me the topic, where the tags input is send from the mqtt explorer?

Screenshot 2024-06-02 at 22 00 10
I entered "Bike" as a tag.

@helgeerbe
Copy link
Owner

Is the automation triggered, when you enter a tag?

Can you show the traces?

image

@sapnho
Copy link
Author

sapnho commented Jun 3, 2024

Can you tell me exactly what to do so that I can show you this result? Never worked with traces before.

@sapnho
Copy link
Author

sapnho commented Jun 3, 2024

The thing is, I don't see any automation called "picframe".

@sapnho
Copy link
Author

sapnho commented Jun 3, 2024

And when I do "show automations" under your Blueprint, I don't see any.

@sapnho
Copy link
Author

sapnho commented Jun 4, 2024

I guess, it's time to update this great article: https://www.thedigitalpictureframe.com/integrate-raspberry-pi-picture-frame-home-assistant/

Should be a lot shorter because HA creates the front end automatically.

@helgeerbe
Copy link
Owner

Just to be sure. Did you create the automation from the blueprint?

Einstellungen_–_Home_Assistant

@sapnho
Copy link
Author

sapnho commented Jun 4, 2024

Ah, a very good question: No, I hadn't! :.-)

Now, the tags and country filters work fine!

The date filters reduce the number of selected photos but not the right date range...

@sapnho
Copy link
Author

sapnho commented Jun 4, 2024

Can Blueprints also create Helpers? This would make the instructions for users even easier.

@helgeerbe
Copy link
Owner

Good to hear, that it was at the end an easy solution.

What do you mean about the right date range? Can you show what you entered and how the mqqt payload looks like? The automation converts the entered text, into a timestamp number.

Can Blueprints also create Helpers? This would make the instructions for users even easier.

Unfortunately not. For tags and location we could get rid of the helpers, because the input text field elements are now created by mqtt discovery. Problem would be the date fields. The automation takes a text like dd.mm.yyyy and converts ist into a timestamp number. I see 2 possible solution. 1. It might be possible to manipulate the text of the date input field before it's published over mqtt. 2. We extend picframe and convert the date text there into the timestamp. Advantage of the 2nd solution, we wouldn't need blueprint and automation anymore. Disadvatange performance depends on a full communication cyle, because every input has to be processed not in the webfrontend but on the picframe server.

@sapnho
Copy link
Author

sapnho commented Jun 4, 2024

When I enter Date to 31.12.2023, I get this
Screenshot 2024-06-04 at 11 04 42

@sapnho
Copy link
Author

sapnho commented Jun 4, 2024

Date from 01.01.2024 gives
Screenshot 2024-06-04 at 11 06 24

@sapnho
Copy link
Author

sapnho commented Jun 4, 2024

Can Blueprints also create Helpers? This would make the instructions for users even easier.

Unfortunately not. For tags and location we could get rid of the helpers, because the input text field elements are now created by mqtt discovery. Problem would be the date fields. The automation takes a text like dd.mm.yyyy and converts ist into a timestamp number. I see 2 possible solution. 1. It might be possible to manipulate the text of the date input field before it's published over mqtt. 2. We extend picframe and convert the date text there into the timestamp. Advantage of the 2nd solution, we wouldn't need blueprint and automation anymore. Disadvatange performance depends on a full communication cyle, because every input has to be processed not in the webfrontend but on the picframe server.

That would be really nice! Would you expect the communication cycle to be unreasonably long?

@helgeerbe
Copy link
Owner

Convertion seems to be correct:

  • 01.01.2023 -> 1704063600 -> Mon Jan 01 2024 00:00:00 GMT+0100 (Mitteleuropäische Normalzeit)
  • 31.12.2023 -> 1703977200 -> Sun Dec 31 2023 00:00:00 GMT+0100 (Mitteleuropäische Normalzeit)

Problematic could be that images might be included in the start date, but excluded from the end date.

@helgeerbe
Copy link
Owner

Might be better to ad 24 hours to the date_to number.

@sapnho
Copy link
Author

sapnho commented Jun 4, 2024

Which I do would do where?

@helgeerbe
Copy link
Owner

I just updated the blueprint. date_fromstarts at midnight, date_to ends at 23:59:59

@helgeerbe
Copy link
Owner

If this works for you, can you close this issue pleas.

@sapnho
Copy link
Author

sapnho commented Jun 5, 2024

I just updated the blueprint. date_fromstarts at midnight, date_to ends at 23:59:59

What's the best way to update the blueprint? Should I delete the automation first?

@helgeerbe
Copy link
Owner

Havn't tested it, but I would try this:

  1. Update blueprint
  2. reload automations
    Screenshot_05_06_24__12_14

If this is not working, you have to delete the automation, and have to recreated it from the blueprint. But my assumption is, that the above describted workflow will work. Let me know.

@sapnho
Copy link
Author

sapnho commented Jun 5, 2024

Ok, I did that, thanks. The funny thing is that Date To works, but date from is still flawed.

However, Date to doesn't revert to the default value (year 2038) when you delete the entry.

@sapnho
Copy link
Author

sapnho commented Jun 5, 2024

When I enter 01.01.2024 in Date From, this is sent via MQTT:
Screenshot 2024-06-05 at 12 31 45

Does that information help in any way?

@sapnho
Copy link
Author

sapnho commented Jun 5, 2024

Or a full filtering:
Screenshot 2024-06-05 at 12 35 37
Screenshot 2024-06-05 at 12 35 33

@helgeerbe
Copy link
Owner

Hi Wolfgang,

you can test the timestamp yourself: https://www.unixtimestamp.com

  • 1577833200 -> Wed Jan 01 2020 00:00:00 GMT+0100 (Mitteleuropäische Normalzeit)
  • 1704063599 -> Sun Dec 31 2023 23:59:59 GMT+0100 (Mitteleuropäische Normalzeit)

For me the timestamps looks good.

However, Date to doesn't revert to the default value (year 2038) when you delete the entry.

This works for me on Safari and Chrome. Have in mind after deleting you have to press enter, or click into an other ui element. So the input is processed.

@sapnho
Copy link
Author

sapnho commented Jun 5, 2024

Ok, will try that.

This works for me on Safari and Chrome. Have in mind after deleting you have to press enter, or click into an other ui element. So the input is processed.

I did. Maybe something else I should have installed is missing?

@sapnho
Copy link
Author

sapnho commented Jun 5, 2024

@helgeerbe What would I have to remove to completely start from scratch the Home Assistant integration? I'd like to go through the steps that somebody installing the system for the first time encounters after all your great updates.

@helgeerbe
Copy link
Owner

I see the issue on the home assistant app for date_to. The last entered date is restored, when you delete the input. Date_from works.Have to investigate further.

Removing everything

  • delete automation
  • delete blueprint
  • delete helpers
  • delete Mqtt device picframe

@sapnho
Copy link
Author

sapnho commented Jun 6, 2024

Thanks. I'll wait for you to solve this last issue and will then do a clean install.

@helgeerbe
Copy link
Owner

@sapnho can you test the latest blueprint, please

@sapnho
Copy link
Author

sapnho commented Jun 7, 2024

Works beautifully, thanks much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants