openhab / openhab-core

Core framework of openHAB
https://www.openhab.org/
Eclipse Public License 2.0
897 stars 415 forks source link

[Feature request] Date, Time and Period selector widgets in sitemap #1321

Open Sonic-Amiga opened 4 years ago

Sonic-Amiga commented 4 years ago

There's no UI elements to represent date and time. This kind of element would be very useful to program events in advance, like:

splatch commented 4 years ago

While it is possible to create new types in framework there is no clear indication what are rules for that. I've attempted to do a third party extension for that but I've failed. Time or Period as well as Schedule (see this forum thread where similar issue was discussed) would contribute a lot to visualization and management possibilities.

kaikreuzer commented 4 years ago

I thought that @Sonic-Amiga's request was rather about a new UI widget type. We have DateTime items already and using them for e.g. an alarm clock, it would be nice to have a "time picker".

splatch commented 4 years ago

I thought that @Sonic-Amiga's request was rather about a new UI widget type. We have DateTime items already and using them for e.g. an alarm clock, it would be nice to have a "time picker".

@kaikreuzer I believe that both core and webui need to go in pair. Currently core doesn't allow to reflect time in a clear way. The time of the day and other temporal types such as period are non existent. DateTimeType tries to merry both by gluing extra date or time to passed string: https://github.com/openhab/openhab-core/blob/3811cb95604f69f6a3d77da2caf391d81b05458e/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/DateTimeType.java#L102-L125

Don't you think it would be good to have Time, Date next to DateTime? Even if we try to keep everything in DateTime there are situations where Period would be beneficiary. For example my heating system have pump post run which is a period and currently gets reflected as a Number.

Sonic-Amiga commented 4 years ago

Yes, i was talking mostly about the widget. I wasn't aware that OpenHAB already has DateTime internally, this is good, but on UI side that would be just a string field, where the user can enter arbitrary crap, which is neither good nor convenient. So i think we need a choice of the following widgets to complete it:

  1. Date picker. A commonly used calendar.
  2. Time picker. Something like a clock face or Android/iOS style ("scrolling" numbers)
  3. Period. Would be combination of two widgets: for Start and for End. It needs to be a single item for devices which accept a Period as a single value. Pressing "OK" would set item to a single value, where both Start and End are specified. For better flexibility a Period widget could have attributes like "DateTime", "DateOnly", "TimeOnly" to choose actual selector types.

    This suggestion is based on DeviSmart thermostat capabilities, it employs these data types for programming a weekly heating schedule plus vacation period.

kaikreuzer commented 4 years ago

Date and Time pickers should be fairly easy, because the core has everything that is needed: The DateTimeItem and with it a state description, which can be either a Date, a Time or a combination. The correct widget if you want to allow setting those items would clearly be the Setpoint widget. We would "just" need the UIs to consider this information and render it in a suitable way.

The main use case (as for period as well) are probably configurations and rules, though. For those cases, we have all of this already in place with the config descriptions (see https://www.openhab.org/docs/developer/bindings/config-xml.html#supported-contexts).

I'd hence say that there is no need to change anything in the core.

nimda5 commented 3 years ago

Agree that core DateTime item covering most needs. In combination with Range and two DateTime elements most of the asking features can be covered. What everyone is asking: integrate DateTimePicker into the sitemap. All workaround with js/external plugins don't work in all cases. Supporting webview workarounds is pain for mobile apps... There are no user friendly way to make nice configurable scheduling jobs. Yes, answered million of times- there is workarouds with timers, alarms, rules, crons. I do that with rules, and times hardcoded in scripts. I don't want to show million of items in sitemap just to set date ... I use them for: iRobots start/stop; sprinkles; and so on...

P.S. Nice job with updates, but me personally on 2.3 still and as general user - wanna see visual features coming to OH. Personally compared OH with HA - this specific feature is where OH will loose battle with HA. Just my 5 cents. Please make some UI enhancements in future releases - this will give us trust that UI is important for developers too ;)

lolodomo commented 9 months ago

Date and time pickers are now available in sitemap UIs in 4.0 through the input element.