Unifi Client Datetime Format

Has anyone run into issues with the ‘online’ status of a wireless client because of datetime format?

Unifi binding reports ‘Last Seen’ in dd/mm/yyyy format (e.g. Last Seen 28.03.2020 15:53:16) and my system is in mm/dd/yyyy format which seems to be causing my clients to always appear Online…

If anyone can point me in the right direction it would be greatly appreciated!

Thanks

Welcome to the Community!

How did you install OH? If using openhabian image you may be able to change the datetime format with openhabian-config tool. Not really sure if this is possable but worth a try.

Also please provide more info about what your running OH on e.g. Linux, Windows as that will help to give a better answer if the above does not work.

Hi, thanks for the quick response!

I have OH running in Docker on an Ubuntu esxi VM.

Do a google search for how to change Ubuntu systems datetime format to match the binding.

I’m hesitant to change my system format to dd/mm/yyy since other bindings and persistence are leveraging datetime.

A little further information I’m just noticing, there are two phones I’m trying to use for presence detection one iphone and one android. It looks like the iphone in Habmin (yyyy-mm-dd) has a different datetime format in the item channels from PaperUI (mm/dd/yyyy). The android doesn’t show the channels being linked at all in Habmin but they display in PaperUI.

Maybe you can use a rule to convert the item to whatever format you need.

I can explore this, it might be a good option for a work around but hopefully we can determine root cause in this thread :slight_smile:

What does that mean exactly, what in openHAB represents “your clients”, where are you viewing this state?
Don’t expect Thing status to be meaningful here.

Unifi binding gives you a lastSeen channel to be linked to a DateTime type Item.
Every DateTime Item in openHAB stores an “instant” is in exactly the same form, the data source is totally irrelevant.
But when it comes to presenting that instant for display, the user (you) can choose from lots of different formats. If you don’t choose, you get a default format.
There’s a sytsem default format, then a binding can influence the default format of a linked Item, but that will always be overridden by any user specified format, and neither ever alters the actual Item state.

What does that mean exactly, what in openHAB represents “your clients”, where are you viewing this state?

To clarify the item.state is returning online per the PaperUI Control page.

Unifi binding gives you a lastSeen channel to be linked to a DateTime type Item.

This was my understanding and now I believe it is correct, it looks like the logs are recording the LastSeen in the same format as other bindings such as Astro but it displays differently on the PaperUI Control page. So I guess I no longer think that the datetime format is the issue.

2020-03-28 21:01:21.091 [vent.ItemStateChangedEvent] - Chelsey_LastSeen changed from 2020-03-28T21:01:00.000+0000 to 2020-03-28T21:01:14.000+0000
2020-03-28 21:01:21.093 [vent.ItemStateChangedEvent] - Kyle_LastSeen changed from 2020-03-28T21:01:00.000+0000 to 2020-03-28T21:01:14.000+0000

@kjssaari I format in my item text using the java format option.

Example %1$tm

Unable to find the openHAB reference link at the moment.

Ok so now this looks like it might be an Android issue, with further testing it looks like my wife’s iphone is properly updating both LastSeen and Online when I turn off her wifi.

For some reason my Android appears to continue updating the LastSeen state even when it is no longer connected to wifi…

So I suppose I need to determine a new direction in diagnosing this one.

1 Like