Hello,
would it be possible to add the date time like a device? Maybe as a plugin shouldn’t be that complicated to implement, wht do you think about?
-
[Solved] Date / Time device
-
hi @temp,
For this purpose you can create a VariablesDevice with the following expression:date("DDD DD MMM YYYY")
This will give you the output
Sun 28 Jun 2015
.- YY: Last two letters of the year (15 for 2015)
- YYYY: Year
- MM: Two digits of the month (06 for June)
- MMM: Three first letters of the month (Jun for June)
- MMMM: Written-out month (June)
- DD: Two digits of the day
- DDD: First three letters of the day (Sun for Sunday)
- DDDD: Written-out day (Sunday)
- h: Hours
- m: Minutes
- s: Seconds
best,
fletcher -
@temp or use a ShellSensor
{ "id": "system-time", "name": "System Time", "class": "ShellSensor", "attributeName": "time", "attributeType": "string", "attributeUnit": "", "command": "date +%d-%m-%Y\" \"%H:%M\" \"%Z", "interval": 60000 },
-
@Pimagical said:
@temp or use a ShellSensor
{ "id": "system-time", "name": "System Time", "class": "ShellSensor", "attributeName": "time", "attributeType": "string", "attributeUnit": "", "command": "date +%d-%m-%Y\" \"%H:%M\" \"%Z", "interval": 60000 },
Which might be the better solution since you got to update the time and VariablesDevice doesn’t support interval.
Otherwise you have to create a variable
$datetime
with"expression": "date("DDD DD MMM YYYY")"
, a VariablesDevice with"expression": "$datetime"
and a rule to update the variable$datetime
every day/minute/second.But apart from all that: Wouldn’t it be helpful in any case to have the interval enabled on VariablesDevice?
-
@fletcher you’re right
-
Thanks all…for the good work and help here✅😃
-
Hi there,
for me the shell sensor is not working.
Here my config:
{ "id": "system-time", "name": "System Zeit", "class": "ShellSensor", "attributeName": "time", "attributeType": "string", "attributeUnit": "", "command": "date +%d-%m-%Y\" \"%H:%M\" \"%Z", "interval": 60000 }
and this is the output from pimatic:
error [pimatic-shell-execute,ShellSensor]: Error getting attribute value uhrzeit.time: Array.isArray(tags) error [pimatic-shell-execute,ShellSensor]: Error getting attribute value uhrzeit.time: undefined
whats wrong?
(pimatic version 0.9.38)
-
@flozen said in [Solved] Date / Time device:
whats wrong?
The error message is likely to be related to another device!
uhrzeit.time
vs.system-time.time
orSystem Zeit.time
resp."It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law