Android App sends Alarm Time as long not DateTime

I recently noticed that the Android app has Tasker integration and can send the next alarm time to an item so I am trying to use these features for my Sleep as Android integration. First problem I ran into was getting my alarm time into an item. I tried the “Send Alarm Time” option but it sends epoch millis not a parable DateTime string as I would have expected. Currently I use AutoAlarm and send a string to a proxy item, but the app can’t read Tasker variables so that’s out too.

Is this the expected behaviour for the app? From a user standpoint it’s not what I would expect.

Log for information:

10-17 17:50:00.802 16880 24878 E ItemUpdateWorker: Error updating item 'saa_mike_alarm_time' to value 1571386500000. Got HTTP error 400

For the time being I will modify my proxy item rule parse millis instead of a string, but I was hoping to drop this rule entirely.

1 Like

It’s currently the expected behavior, but changing that to update DateTime instead of Number items and sending the appropriate format for that should be reasonably easy.

@mueller-ma Was there a specific reason for the current behavior?

It seems counter intuitive when we consider the destination for the information is OH, everything time related is a DateTime type there.

Perhaps a GET to determine the item type and send a DateTime string or number as appropriate? That way it would not break compatibility.

1 Like

That sounds like a great idea actually. I’ll give that a try … it’ll probably require a little refactoring, but it’s definitely doable.

I think a Number item should get millis, a String or DateTime should get the ISO formated time string, and anything else should throw an error in the app and not try to send the update.

Link me an apk if you want me to test anything.

Side note: the wording is not clear and there is no option to choose, does the Tasker integration update or command the item?

Not really. I just haven’t thought about using DateTime items.

:+1:

1 Like

It does a POST on rest/items/<name>, so a command.

1 Like

A preference in the Item picker makes sense.

1 Like

Fair enough when looking at it purely from the Java side, epoch millis is the goto for most languages.


Perfect, that is what I need for my current usage. Though I did find that out through experimentation with my Sleep as Android items last night!


Another thing I noticed in my tests last night, it does not consider the local/remote connection when making the HTTP requests. This is something that I have not gotten around to putting into Tasker, but now on Android 10 they explicitly support HTTP Basic Auth where before you had to Base64 encode username:password into a header manually. My nginx is configured to allow access to 192.168.0.0/24 without password but anyone else must use basic auth. Again, I was expecting the Tasker integration to take my local/remote settings in the openHAB app into consideration but it does not seem to.

What about changing the DateTime items to also accept unix time?

That makes sense yes, it would mean compatibility in general and no changes to the app.


Splendid! I’ve subscribed to those threads and the one for DateTime receivers. Let me know here or there when you have a build if you want me to test it.

1 Like

Both issues have been fixed.

Excellent! I saw the PRs but haven’t had time to test it out yet. Thank you

2.10.20-beta supports sending the alarm clock to a DateTime Item.