RoomMe - Presence Detector

Thanks, I’ll look into that too - for now I’m continuing to try and create, what I’m calling ‘Information Widgets’ for Vera, (Static JSON files for devices - templates/examples? - #11 by parkerc ) which aim to just be a single block of code in the start up (or one uploaded luup.file.)

So in this case other than creating the luup.register handler, everything needed to maintain the RoomMe widget on the dashboard will ideally be in a single luup file called a xxRoomMe.lua.

I use the following luup.create_device call to create a device with its required variables, and then each time a http post is received, it will check if that device exists, and if so, it will update the variables.

Here a test script of a RoomMe detector device initial creation, its currently using the D_GenericIO1.xml but I’ll explore other ones.

-- example json content sent by the RoomMe API
local Type = "Event"
local userId = 0
local id = "myregisteredemail@mail.com"
local userName = "parkerc"
local roomName = "Kitchen"
local eventTime = "2021-07-30T20:55:11 01:00"
local sensorId = "5C63C900117A"
local eventName = "RoomExit"
local eventControl = ""

-- Create a RoomMe Presence device with all associated variables
luup.create_device("", userName, "RoomMe Presence Widget", "D_GenericIO1.xml", "", "", "", false, false, 0, 0, 0, "urn:nodecentral-net:serviceId:RoomMe1,userId="..userId.."\nurn:nodecentral-net:serviceId:RoomMe1,id="..id.."\nurn:nodecentral-net:serviceId:RoomMe1,userName="..userName.."\nurn:nodecentral-net:serviceId:RoomMe1,roomName="..roomName.."\nurn:nodecentral-net:serviceId:RoomMe1,eventTime="..eventTime.."\nurn:nodecentral-net:serviceId:RoomMe1,sensorId="..sensorId.."\nurn:nodecentral-net:serviceId:RoomMe1,eventName="..eventName.."\nurn:nodecentral-net:serviceId:RoomMe1,eventControl="..eventControl.."\nurn:nodecentral-net:serviceId:RoomMe1,Version=v0.1\n,manufacturer=NodeCentral", 0, "", "", true, false)
1 Like