Hi
I was just wondering if anyone had customised any of the device .json file to make use of some of the unused space. For example - I was thinking it would be nice to see on the motion sensors when they were last tripped?
Hi
I was just wondering if anyone had customised any of the device .json file to make use of some of the unused space. For example - I was thinking it would be nice to see on the motion sensors when they were last tripped?
I added a units field to all the Netatmo child sensor devices, including customising the .json files for the standard Temperature and Humidity devices. Straightforward to do and doesn’t change the existing functionality. However, standard device file modifications are, I presume, unlikely to be accepted in any app download from the MiOS store!
Hi @akbooer
Sorry I was referring to the default ones . (I’ll edit the first post)
I was just thinking that you could just edit and then upload a new default .json e.g D_MotionsSensor.json and it would be applied to all exiting devices ?
Have you/anyone done that?
[quote=“parkerc, post:3, topic:178390”]I was just thinking that you could just edit and then upload a new default .json e.g D_MotionsSensor.json and it would be applied to all exiting devices ?
Have you/anyone done that?[/quote]
I may be misunderstanding, but yes, that’s what I’ve done for temperature and humidity.
So sorry my mistake @akbooer , I miss read what you had wrote.
Thats great…
Could I ask how would you go about showing the date/time that the sensor was last tripped on the motion sensor device ? (I’ve looked at the .json and some of the guidance on the wiki, but I struggle with all coding.
It seems like it would be nice customisation to have (in a human readable format)
Ah, well, yes, that’s the thing. What’s easy, is to modify the .json file to display other device variables. What’s harder is to show new stuff that doesn’t already exist. Whilst the time of last change is available from the luup.variable_get() call, it isn’t stored as a separate variable on most devices (I think the Power Meter is a notable exception.). What you’d have to do is run a separate thread which watches your variables of interest and adds the time change as a new variable to each device. This can then be displayed on the UI panel using the .json file.
Gets harder quickly, doesn’t it?
I could see it was going to be a mountain to climb as soon as the idea popped into my head ![]()
The variable LastTrip seems to constant accords all the various motion sensors I have, so focussing on just that device .json - does that make it easier ? (The hardest part has to be the conventions to a human readable date/time)
I can see the temperature sensors .json displays some static text along with the CurrentTemperature variable …
Good that the variable exists (I had checked door sensors, and they don’t have it), bad that it is in the wrong format. You would be back to square one in order to change it.
I’ve been looking at the Temperature Sensor .json and how that presents both a label with a variable value, so I’ve tried to take that bit of code, update it and then put it into the Motion Sensor’ Control section…
I’ve not tested it yet in a live environment for fear of screwing anything up, (no Dev or Staging at home
) but if someone has time to cast their expert eye over the logic I would appreciate it.
"Control": [
{
"ControlGroup": "1",
"ControlType": "label",
"top": "0",
"left": "0",
"Label": {
"lang_tag": "LastTrip",
"text": "Last Tripped"
},
"Display": {
"Top": 60,
"Left": 50,
"Width": 75,
"Height": 20
}
},
{
"ControlGroup": "1",
"ControlType": "button",
"top": "0",
"left": "0",
"Label": {
"lang_tag": "cmd_arm",
"text": "Arm"
},
{
"ControlGroup": "1",
"ControlType": "variable",
"top": "1",
"left": "0",
"Display": {
"Service": "urn:micasaverde-com:serviceId:SecuritySensor1"",
"Variable": "LastTrip",
"Top": 60,
"Left": 145,
"Width": 75,
"Height": 20
}
}
"Display": {
"Service": "urn:micasaverde-com:serviceId:SecuritySensor1",
"Variable": "Armed",
"Value": "1",
"Top": 60,
"Left": 50,
"Width": 75,
"Height": 20
},
"Command": {
"Service": "urn:micasaverde-com:serviceId:SecuritySensor1",
"Action": "SetArmed",
"Parameters": [
{
"Name": "newArmedValue",
"Value": "1"
}
]
},
"ControlCode": "arm"
},
{
"ControlGroup": "2",
"ControlType": "button",
"top": "0",
"left": "1",
"Label": {
"lang_tag": "cmd_bypass",
"text": "Bypass"
},
"Display": {
"Service": "urn:micasaverde-com:serviceId:SecuritySensor1",
"Variable": "Armed",
"Value": "0",
"Top": 60,
"Left": 145,
"Width": 75,
"Height": 20
},
"Command": {
"Service": "urn:micasaverde-com:serviceId:SecuritySensor1",
"Action": "SetArmed",
"Parameters": [
{
"Name": "newArmedValue",
"Value": "0"
}
]
},
"ControlCode": "bypass"
}
]
},
Hi
I just wanted to resurface this post from a while back to see if I could get date/time the device was ‘last tripped’ to be added to the layout of the device .json file , so it would add some real value when just looking at the device icon on the UI. (uI5)
Was my update to the D_MotionSensor1.json correct, how would you covert the linux stamp to human readable date time ?
This is easy…
readableTime = os.date ("%c", machineTime)
You could check this in Lua Test with, for example:
luup.log (os.date ("%c", os.time()))
which gives something like [tt]“Fri Aug 22 20:42:09 2014”[/tt]
other variants available with a different formatting string from “%c”.
Thanks again @akbooer
How does the code look in the MotionSensor1.json?
Considering all the 3 in 1 devices I have, which show a reading for temp and light level, adding last tripped would be a nice touch.
I’ve been trying to work it out by looking at other .json files on Vera via - http://jsonviewer.stack.hu/ but I’m not having much luck working out how to add the last tripped variable above the buttons.
So, something like this, then ?
That’s it !! Thanks @akbooer…
Can it show the date too, as for some sensors it could be a day or two before they have tripped ? E.g
Last Trip : 25/08/14 - 18:34
Hopefully I’m not alone in thinking that would be a nice addition ?
Would you be willing to share the .json for this ?
@akbooer, I’d expect you could charge at least $10 for that feature ![]()
Yes, of course, see previous post. It just needs the right format string. You are, however, limited to 11 characters (in a single variable field) so you’d have to make that: [tt]25/08 18:34[/tt], unless we add separate date and time fields.
Would you be willing to share the .json for this ?Attached. I made the minimum possible changes to the original .json file. You'll need some extra magic to make it work, though. (Maybe that should go to the highest bidder?) ;)
Many thanks @Akbooer
Magic was never my strongest subject at school, ![]()
So taking what spells I do have and looking at your .json - I can see ‘Timestamp’ as the variable mentioned ?
Is the suggestion that I will need to create a new variable on every motion device to hold a converted human readable last tripped value? (Which is no more than 11 characters?)
If you don’t need it on the WebGUI…Imperihome for Android shows the last tripped in the sensor.
Hi @Agilehumor
Totally agree - and that’s the basis/reason for creating this thread
I already have it via HomeWave (iOS) , but it’s surprising how often I access the WebUI, so I wanted to have that capability their too,
Yes, exactly so. The easiest way to do this is to upload this Lua file (I also include the modified .json file again to keep everything in the same place), and add the following to your Lua Startup:
require "TripTimestamp"
This only works for motion sensors, but would be easy to extend to any other sensor with a SecuritySensor service.
The format can be changed by altering the appropriate constant in the Lua file.
Best Home Automation shopping experience. Shop at Ezlo!
© 2024 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules