Is there a way to get the device type via a http call? I know there is a luup call: luup.devices[devID].device_type. Is there a way to get this call via http request?
- Garrett
Is there a way to get the device type via a http call? I know there is a luup call: luup.devices[devID].device_type. Is there a way to get this call via http request?
It’s in the user data, isn’t it? Or are you looking for something less heavyweight?
It’s also in the jsonp variable in JavaScript, if you can use AJAX.
I am avoiding the user data as I am using lu_sdata for getting data on the vera. I need a light weight way of getting the device type so I can try and support plugins and custom devices in vera on my app.
Ok, let’s be more creative then. I’m not aware of any pure HTTP method of getting the device type.
How about… Using the RunLua HTTP call to dump the string into an arbitrary file in /www and then fetching it with a followup HTTP call?
How about… Putting a tiny plugin onto the target Vera and use the registered-callback feature to return the string you need?
I’ve got other ideas but they are even dirtier.
I need to make it transparent to the user as AutHomation will need it to figure out the device. I’ve been in contact with MCV to add it to the lu_sdata, but they fear it would make lu_sdata larger in file size. Crossing my fingers to having it added.
Let’s get really dirty:
Use [tt]RunLua[/tt] via [tt]HTTP[/tt] to implant a plugin that registers an [tt]HTML[/tt] handler via [tt]luup.register_handler[/tt] that returns the device type.
Really dirty ideas aside, you could ask the user to put the Luup code for your [tt]HTML[/tt] handler in the ‘Startup Lua’ window.
As always, we’re trying to work around an API defect that should be fixed by MCV.
I’ll ask Aaron to add the device number as a search parameter to the finddevice request.
Thanks MCVFlorin. Thought it would be nice to have the device type in the lu_sdata. Calling finddevice by the device id is a good start.
BTW, could you ask Aaron to fix [tt]http://ipaddress:3480/data_request?id=device&output_format=xml&DeviceNum=x[/tt] (restriction to device number doesn’t seem to work), please?
[quote=“Ap15e, post:9, topic:171134”]@mcvflorin,
BTW, could you ask Aaron to fix [tt]http://ipaddress:3480/data_request?id=device&output_format=xml&DeviceNum=x[/tt] (restriction to device number doesn’t seem to work), please?[/quote]
I noticed that yesterday when trying to get data on devices. It would output all of the devices and not just the one you want. Also noticed that it does not output into json format.
@Ap15e
That functionality is marked as old since 30 September 2010. I doubt he’s going to fix it. I will ask anyway, because you never now…
‘You never know’ would be a good motto for MCV/Vera/MiOS … :-\
I’m developping a webapp with jquery mobile and php. I’m not a developper, but I can do some code.
Listing rooms and devices name is pretty easy. On every calls of pages, I do a refresh on my web server.
Getting device category, is doable.
I do some parsing from sdata and user_data to catch all my info, but device from users have a “0” category and it isn’t easy to get service name.
I want to apply a method where when I had a new device virtual or not, I can pilot it whitout recoding.
Unfortunatly, as MCV don’t do new category number for new device and don’t clearly determine a master serviceId, it isn’t possible to do that automatically (with my knowledge).
What do you suggest ?
I use a json_decode, so I can parse what I want. For example, If I want to discriminate by service, for certain device, there are one or two services whereas for other device there are too many services.
So again waht to do to catch a maximum information automatically ?
Thank you.
gilles, the only way I know of is to do the same as the web browser interface, and start fetching the D_.xml and D_.json files from Vera.
Start Firebug on Firefox and point it at Vera, and watch what HTTP requests are made. If your app does the same thing, you have the information you need.
Futzle,
My apologies for my late answer.
I’m fighting with jquery mobile and I Win ;0)
So my lzst chance is to do a list of the D*.xml.
I don’t know how to do that by httprequest.
Have you got a clue for me. I got a dirty idea which is a ssh script but I will have to had more and more security to my webpages. I prefer another solution.
Envoyé depuis mon gTablet avec Tapatalk
MCVFlorin,
Any update on this? Has Aaron added it? I would really like a way of getting the device type either by lu_sdata or find device so I can better support plugins and custom devices on vera.
[quote=“gilles, post:15, topic:171134”]So my lzst chance is to do a list of the D*.xml.
I don’t know how to do that by httprequest.[/quote]
Go to the Luup Files page and ask to view/download one of the D_*.xml files. Notice the URL that it uses. You can do the same from JavaScript or any other HTTP client.
I don’t think so, I don’t see anything in the SVN logs. I sent him an e-mail to remind him to add the requested features.
[quote=“mcvflorin, post:18, topic:171134”]@garrettwp
I don’t think so, I don’t see anything in the SVN logs. I sent him an e-mail to remind him to add the requested features.[/quote]
Thanks,
Hi,
The last post is longer than one month have you got some news.
For your information I officially ask this at MCV support and got no answer.
neither a recept.
It will be usefull to implement that.
Thank you.
Gilles.
Best Home Automation shopping experience. Shop at Ezlo!
© 2024 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules