missing protocol of "date_and_time" in Wiki/Protocols
|
08-03-2019, 02:44 PM
I was busy with the new release. Maybe i can find time to update the manual. In the meanwhile you can create a page yourself and put in a github PR? That would be even better

08-03-2019, 03:09 PM
i found just this after a wile searching
maybe you can Check it, because its from 2015
Code:
Date & Time
Config
"devices": {
"date_and_time": {
"protocol": [ "datetime" ],
"id": [{
"longitude": 6.9174,
"latitude": 51.4681
}],
"year": 2015,
"month": 2,
"day": 11,
"hour": 17,
"minute": 50,
"second": 40,
"weekday": 1,
"dst": 0
}
},
"gui": {
"date_and_time": {
"name": "Date - Time",
"group": [ "Home" ],
"media": [ "all" ],
"format": "dd DD-MM-YYYY HH:mm:ss",
}
},
Optional Settings
Setting Default Format Description
gui-show-datetime 1 1 or 0 Don't display the datetime values
gui-datetime-format HH:mm:ss YYYY-MM-DD see below Datetime formatting
Notes
The ntp-server id is optional. The ntp server will be used to check if the time is in sync with the atomic clock. When using pilight nightly, remove “” at the longtitude and latitude numbers. Also the latest nightly has an extra option: “weekday”. (weekday 1 = sunday)
it was possible to get more than one information out of "date_and_time" in gui, you can use in "format" multiple artguments
Nightly example:
"devices": {
"date_and_time": {
"protocol": [ "datetime" ],
"id": [{
"longitude": 6.9174,
"latitude": 51.4681
}],
"year": 2015,
"month": 5,
"day": 28,
"hour": 0,
"minute": 26,
"second": 37,
"dst": 1,
"weekday": 4
}
},
"gui": {
"date_and_time": {
"name": "Date - Time",
"group": [ "Home" ],
"media": [ "all" ],
"format": "dd DD-MM-YYYY HH:mm:ss",
}
},
"settings": {
"ntp-servers": [ "0.de.pool.ntp.org", "1.de.pool.ntp.org" ]
}
Formatting
Input | Output
M, MM Month Number (1 - 12)
MMM, MMMM Month Name (In currently language set by moment.lang())
D, DD Day of month
DDD, DDDD Day of year
d, dd, ddd, dddd Day of week (NOTE: these formats only make sense when combined with “ww”)
e Day of week (locale) (NOTE: these formats only make sense when combined with “ww”)
E Day of week (ISO) (NOTE: this format only make sense when combined with “WW”)
w, ww Week of the year (NOTE: combine this format with “gg” or “gggg” instead of “YY” or “YYYY”)
W, WW Week of the year (NOTE: combine this format with “GG” or “GGGG” instead of “YY” or “YYYY”)
YY 2 digit year (if greater than 68 will return 1900's, otherwise 2000's)
YYYY 4 digit year
gg 2 digit week year (if greater than 68 will return 1900's, otherwise 2000's)
gggg 4 digit week year
GG 2 digit week year (ISO) (if greater than 68 will return 1900's, otherwise 2000's)
GGGG 4 digit week year (ISO)
a, A AM/PM
H, HH 24 hour time
h, hh 12 hour time (use in conjunction with a or A)
m, mm Minutes
s, ss Seconds
S Deciseconds (1/10th of a second)
SS Centiseconds (1/100th of a second)
SSS Milliseconds (1/1000th of a second)
Z, ZZ Timezone offset as +07:00 or +0700
X Unix timestamp
LT, L, LL, LLL, LLLL Locale dependent date and time representation
To use formatting in the nighly, use the option format in the GUI section of config.json.
Example Formatting Nightly:
"date_and_time": {
"name": "Time",
"group": [ "Group" ],
"format": "HH:mm:ss"
},
In this example, only the time is showed in the GUI (24h notation)
maybe you can Check it, because its from 2015
Where did you find it?
I found some time and added it.
I found some time and added it.
Browsing: 1 Guest(s)