Show two separate strings from python script in sitemap

I agree with Josar, this sort of thing is what the Serial Binding is made for. Failing that, it is probably better to have your script report to OH rather than have OH polling the script by executing it over and over like Kees recommends.

Finally, as Vincent demonstrates, it is very possible to have OH call the script (note there is a missing open quote in the rule trigger Time "cron 0 0/5 * * * ? *"). However, you will have to take the while True part out of the script and have the script exit once one line has been read from the device.

It would also be possible to use the Exec binding for this, but since the script returns two values on one line you will need a Rule like this one anyway so it doesn’t buy you much.

Note: How to use code fences