Skip to content

Add breaking changes of next pythonscripting - #1826

Merged
kaikreuzer merged 2 commits into
openhab:mainfrom
HolgerHees:patch-3
Nov 21, 2025
Merged

Add breaking changes of next pythonscripting#1826
kaikreuzer merged 2 commits into
openhab:mainfrom
HolgerHees:patch-3

Conversation

@HolgerHees

Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Holger Hees <holger.hees@gmail.com>
@lsiepel

lsiepel commented Oct 24, 2025

Copy link
Copy Markdown
Contributor

I'm not into the details of the pythonscripting binding, but i hope this can somewhat be condensed and more meaningfull.

For example: Metadata API changed Does a user then know what to adapt to make it run again?

Signed-off-by: Holger Hees <holger.hees@gmail.com>
@HolgerHees

Copy link
Copy Markdown
Contributor Author

For example: Metadata API changed Does a user then know what to adapt to make it run again?

is fixed

ALERT;Freebox Binding: The binding has been removed from the distribution. You should consider migrating to the FreeboxOS binding.
ALERT;JavaScript Automation: The event object in UI-based environments has been aligned with the file-based event object. Properties are now pure JavaScript types and property names have changed. Blockly users need to resave their scripts.
ALERT;JavaScript Automation: Automatic injection of the openHAB JavaScript library now allows for more fine-grained control. It is recommended to manually import required namespaces from the openhab library in file-based scripts and transformations and disable automatic injection for file-based scripts and transformations.
ALERT;PythonScripting Automation: Python "openhab.Timer" removed. Can be replaced with default Threading or Timer implementation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a comment, not on this PR, but on what is being done. I understand that things must break sometimes, but I don't understand why you must remove something like this. It will break every script that use it, and force them to (promptly) figure out how to use the other implementations. I think it would be much better to just document that "using the native implementations is preferred because..." than to just remove stuff.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When thinking about it, I don't understand how native implementations can fully replace openhab.timer either. openhab.Timer can run completely independent of the script, it can run when no scripting engine is running. How can the native implementations achieve this?

@HolgerHees HolgerHees Oct 24, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openhab.Timer was necessary, before the raw python thread cleanup was fully working. The old Timer implementation was registering a custom shutdown handler, which was cleaning/stopping the background thread. This is not necessary anymore, because graalpy itself is now correctly stopped/shutteddown (context is closed properly). So the main purpose is gone.

The leftover functionality (the trigger counter) was mostly used by me. If anyone else is still interested in that behavior, he can check the example, where exactly that is done. I believe this special use case should not be part of the main api.

That's the reason why I eliminated it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, it sounds like I misunderstood what openhab.Timer was. I assumed that it was a wrapper for org.openhab.core.automation.module.script.action.Timer, which provides functionality that you can't do within a scripting language if the scripting engine is closed. But, maybe these are all really wrapping the Java timer?

Anyway, my main point was that I think it's better to leave something as "deprecated" than to remove it, even if better alternatives exist, so that you don't break things for people. The Graal Python add-on in OH is so new that it probably doesn't matter so much in this situation though, I guess the number of scripts that will be broken is quite small.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally I agree, to mark first something as deprecated. But as you said, pythonscripting is so new and my hope was that no one is really using it. So I took the chance ;-)

It is removed since 2 month. And most people are using the latest pythonscripting next, which is already providing this cleaned API and no one was asking for it to bring it back.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't actually mean to just first mark it as deprecated. I meant to leave it as deprecated for "eternity", unless there are very good reasons why it must go 😉

@lsiepel

lsiepel commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

Still, the related PR is merged. This needs to be added before next milestone

@kaikreuzer kaikreuzer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed.

@kaikreuzer
kaikreuzer merged commit 64cd2ad into openhab:main Nov 21, 2025
2 checks passed
@kaikreuzer kaikreuzer added this to the 5.1 milestone Nov 21, 2025
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

Successfully merging this pull request may close these issues.

4 participants