Datetime issue

This is for support with a complain!
please see below the log of my app.

the bottom box is when i started my program and state.fromtime and state.totime are clearly in local datetime (ie Sat Oct 12 17:36:00 EDT 2019). These are the datetime were stored in state.fromtime and state.totime and it went through the checktime OK (bottom box)

BUT, less than a second later state.fromtime and state.totime were then reverted to ISO datetime (the top box)

It took me quite a while to figure out what was causing it. The solution was to copy the same checktime and made a second routine called checkISOtime.

The question here is why? why state variable changes from one time format to another? If ISO time is to be used why not storing it from the start. Why allows the local datetime to be used and then change it to ISO time milliseconds later?

The app was using ISO time at the beginning and rerun it give me this error

clearly the input were changed from ISO time to local time!

I change the app to use local time then this error!

I do not mind one way or the other but pick one and stick with it. Hubitat is a flatform for home automation and that is what I am doing with it and this should not happen.

Now i have two routines, one is used during start up to check the time because state.fromtime and state.totime were entered as local datetime

and another routine to checktime called checkISOtime because for what ever the reason the system decided to change my local datetime for state.fromtime and state.totime to ISO time!

here is the app setting that cleary state the state.fromtime and state.totime are in ISO time but my input were in local datetime!

i know growing pains come with new system such as hubitat but this is very basic. my app was working since 2.1.0 release and now in 2.1.5 changes were made without any documentation is not a good thing. I want to grow with hubitat but this is very basic guys.

( told you this was a complain!)

Please post the code and what method you were using that changed. We are only human and sometimes things break that we don't catch.



If you remember, Ariane 5 disaster:

a simple software error... And 370M$ lost.

1 Like

the code is attached. it is in github with both parent and child app

I meant the code that you said was working fine on 2.1.0. I started up 2.1.0 and I have no idea how your code would have worked. There we no changes as far as I know that would affect this. You need to keep in mind that state is a Map and it is serialized into the database and back out again. So if you take a Date object and put it into state, it will be a Date object until you are done running, then it is stored into the database. When state deserialized from the database, that object comes back out as a String, thats why you have to use toDateTime() on it before you can call getHours().

Here is the app state of your app running on 2.1.0:
Notice it is stored in same format as you are showing in 2.1.5.

I'm going to need more information from you if you truly believe this is a platform issue. I would like to track it down and fix it, but as far as I can see it is not.

Also you have an issue with line 171, emergencyLight is not a required field so you need to check if it is null.

I can tell you more than what i was able to report. Thanks for the investigation. Thank for line 171.

i lost my thoughts there. Thanks
def isSWon = "off"
if (emergencyLight) {
isSWon = emergencyLight.currentValue("switch")