Hot Water countdown timer

I have an item holding a HH:MM:SS countdown timer, activated by a Switch item state transition to ON.

Would it be an overkill / resource hog in OH to display that timer on a sitemap , second by second ? If so what other design pattern should I be using on OH.

Did you check this conversation

It gives you an example for a countdown timer.

Hot water features rarely have a response time in seconds. Why not just have a minutes counter and display? Minimal impact.

I’m all up for minimal impact/low resource demand on OH so I will indeed display a 60 minute countdown, I’ll take a look at that link you kindly provided.

EDIT: Sorted, works perfectly as a 60 minute timer and turns off the Hot Water 60 mins after selecting ON. Thanks @rossko57

I’m pretty sure that this may not be something you want to consider given what you’ve invested so far into Rules DSL Rules. But I keep coming across your examples and needing help with Rules for which I’ve already written reusable library scripts and modules that would do much if not all of the work for you.

The kicker is you have to use Scripted Automation instead of Rules DSL which right now requires a bit of initial configuration (it’s not much really and soon we will just be able to install an add-on). I’ve suggested this to you before but I don’t know if you had the time/cycles to actually consider it so I’m recommending it again. See [beta testers wanted!] Jython addon w/ helper libraries (requires OH 2.5) for how to get started.

Most of what you’ve already learned about Rules will transfer very well. The syntax will just be a little different, plus you will be working with a popular language instead of a domain specific language used only by openHAB.

I’m positive you will continue to receive support from me and others if you stick with Rules DSL, but given the libraries I and others have already implemented, you might have less work overall using Python.

For example, in this case I have implemented a countdown Timer that you can just import and use.

No Ritch, I didn’t pick up on your recommendation, and I’m all for reuse and consistency. Jython, never heard of that, I’m guessing it’s one of my fraternities nemesis … type unsafe langauges … Python or/on JAVA cough splut. I’ve managed to avoid it for 35 years, in fact i think it may have been called “Beans” when released by mozilla early 90s

anyway, another thing to learn in my OH quest :grin:

my University lecturer would have a cardiac if he ever found out i was using python, java, or any other hackers language lol , because we all know (!!) the only real language is Assembly, period :grin: its sooooo easy and clean, unforgiving, crisp and inexpensive :+1:

Jython is Python that runs on the Java Runtime Environment (JRE).

BTW, Java is a type safe language. It’s one of the major criticisms users who like Python and Ruby have against the most used programming language by several measures. Maybe you are conflating it with JavaScript which is a completely different language. Java was always owned and released by Sun Microsystems until the evil empire Oracle bought out Sun a few years back.

Back in the Netscape days (1995, long before Mozilla) they had Mocha which was a precursor to JavaScript and was loosely based on Scheme (loosely I must say). But Java was starting to become big at that time and support for Java Applets in the browser was added around the same time. So Java was to be used for “serious” stuff and JavaScript was to be used my everyday users. Kind of like the difference between C/C++ (Java) and Visual Basic (JavaScript). In 1996 ECMA took up standardization of JavaScript and to this day controls the standard. So JavaScript is most properly called ECMAScript.

Nah, everyone knows Lisp is the only real language.

Lisp, wow, haven’t seen or used that for decades😁

Oohhhh Ritch, if only we had a debating platform… this thread could go on and on and on, but I’m compelled to at least reply , just the once…

I work at the Assembly level, one level away from pure machine code, so i do have some experience of language analysis of the “trendy” stuff like Java and C# etc , often called upon to identify compliation errors causing machine level faults.

Type safety is inherent in and linked tightly with, memory safety where a restriction is set on the “language” ability to copy arbitrary bit patterns between memory locations. I use “language” loosely to refer to the various stages of compilation and execution

In an implementation of a language that has some sequence of bits (of the appropriate length) , if a resultant machine level operation does not represent a legitimate representative value and is subsequently permitted (through the complier output instructions) to be copied into a [variable] of incompatible register or data level, then it is not type-safe.

I can 101% attest that JAVA is type unsafe, absolutely. Where engineering gets confused is that the Java libraries include and abstract the type-safety mechanisms, thus the “safety” if one can call it such, is inherently an attribute of the LIBRARY and NOT the complier , read JRE !

That is why Java is not nor ever will be used for mission and Safety critical embedded systems where such type-unsafe consequences yield totally unacceptable effects including loss of state machine data, system halts, access violations, register overflows and data loss.

I wouldn’t want to loose all FADEC systems on my flight across the Atlantic. Oh no Ritch, I assure you there is NO Java on flight code, only RTOS (greenhills) Ada and Machine code, and DoD /MoD willing, heavily certified ‘C’ and perhaps a dash of Fortran for the math heavy stuff

java is a country people fly to😁

p.s I know sod all about windows and OH , although i once squeezed a supervisor kernel into z8086 !!

“Trendy” is a funny word to use for a language that was first released 25 years ago (Java) and 18 years ago (C#) respectively and combined has billions and billions of lines of code written in them.

This is the “no true scottsman logical fallacy.” You define “type safety” which, while perhaps in common use in your niche area, is not the common usage in the wider computer science/computer programming world. Engineers are not confused. They are using the commonly used definition for the term. It may not be suitable for embedded real time safety critical uses, but the common definition doesn’t require it be suitable for those uses to be called type safe. It only requires the language to check and enforce type, either at compile time or at run-time or both. Maybe it doesn’t do a good enough job for you, but that doesn’t make it not type safe.

I don’t think anyone is arguing that it should be used for those uses. But in the pie chart of programming problems where that stuff matters and where other things like programmer time, speed to market, wide support on multiple CPU architectures, etc. are more important, the mission and safety critical slice of the pie is very very tiny.

Home automation is not in that tiny slice of the pie. Maybe home security, but you will find that most of us regulars on the forum are very down on people using openHAB to build security systems and outright hostile to those wanting to use it for industrial purposes, so don’t both going there. People! OH is not suitable for industrial uses!

Why be hostile to programming languages that operate in a realm where that stuff doesn’t matter? I promise you won’t get cooties if you use a suitable language in a suitable situation.

Where did I ever claim there was? This is called the “straw man logical fallacy”. I’m not and never claimed that Java or Python any of these other evil languages are used in embedded systems. I never said you would find Java on a F15 or a satellite or missile launcher. I expressly said outside those uses.

But is Java used to process the signals from the satellites? Yep. Is Java used to help commanders tell that F15 where it needs to go? Sure thing. Is Java used to process the pay checks of the pilot flying that jet? Yep. Is Java/Python used to fuse all the sensor data gathered from the thousands of sensors across the world? Yes, I wrote some of it. Is Java used to help process and analyze computer security data to protect military IT systems? Sure is, and Python too. Want to schedule time on a comms satellite? The scheduler is written in Java. Want to ship a brigade of tanks across the world? Java written tools help coordinate it. I could go on.

Embedded real-time is a niche. It’s an important niche and it has exceptionally demanding requirements. But that doesn’t make stuff designed to work in a realm where getting something out the door fast or cost or the ability to find developers to code in it is far more important than safety criticality evil or bad to use.

Sometimes the programmer’s time is the most important factor…