HomeSeer HS-FLS100+ Z-Wave Plus Outdoor Floodlight Sensor

First of all, create two new virtual devices for your motion sensor and light sensor. You can do it under Apps, Develop Apps, Create Device.

Light Sensor:

  • DeviceType: urn:schemas-micasaverde-com:device:LightSensor:1
  • Upnp Device Filename: D_LightSensor1.xml
  • device_json: D_LightSensor1.json

Motion Sensor:

  • DeviceType: urn:schemas-micasaverde-com:device:MotionSensor:1
  • Upnp Device Filename: D_MotionSensor1.xml
  • device_json: D_MotionSensor1.json

wait for luup engine to reload every time you create a new virtual device. Note down all the three IDs.

then place this code in your startup luup code:

-- change to yours
local masterID = 666
local sensorID = 667
local lightID = 668
 
function copyVariable(dev_id, service, variable, oldValue, newValue)
	if tonumber(oldValue) ~= tonumber(newValue) then
		local deviceID = variable == "CurrentLevel" and lightID or sensorID
		luup.variable_set(service, variable, newValue, deviceID)
	end
end

luup.variable_watch("copyVariable", "urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", masterID)
luup.variable_watch("copyVariable", "urn:micasaverde-com:serviceId:LightSensor1", "CurrentLevel", masterID)
1 Like

thank you sir!

1 Like

Thank you for posting this - I’d really like to get the switch, light sensor, and motion sensor into Vera too. The device showed up as generic i/o and lux for me too.

I’m very new to Vera so apologies for newbie questions but I’m trying to implement your instructions but it doesn’t seem to be working. I’m not seeing any light or motion events reported on the newly added sensorID or lightID. I’ve added the light sensor and motion sensor as you directed. I also added the startup luup code as follows:

"
local masterID = 61
local sensorID = 89
local lightID = 88

function copyVariable(dev_id, service, variable, oldValue, newValue)
if tonumber(oldValue) ~= tonumber(newValue) then
local deviceID = variable == “CurrentLevel” and lightID or sensorID
luup.variable_set(service, variable, newValue, deviceID)
end
end

luup.variable_watch(“copyVariable”, “urn:micasaverde-com:serviceId:SecuritySensor1”, “Tripped”, masterID)
luup.variable_watch(“copyVariable”, “urn:micasaverde-com:serviceId:LightSensor1”, “CurrentLevel”, masterID)

"

Did I do that correctly?

Thank you in advance for any help you can provide!

UPDATE:
It appears that the motion sensor is working but the light sensor is not - this is still workable since the original light sensor device seems to be reporting still. So huge to have the motion sensor broken out now - thank you!

I have 4 of these sensors though - how should I modify the luup code to accommodate doing this with all 4?

in case you have more devices, you’ll need to modify the script.

devices = {
  [61] = {sensorID = 89, lightID = 88},
  [90] = {sensorID = 91, lightID = 92}
}

function copyVariable(dev_id, service, variable, oldValue, newValue)
  if tonumber(oldValue) ~= tonumber(newValue) then
    local deviceID = variable == "CurrentLevel" and devices[dev_id].lightID or devices[dev_id].sensorID
    luup.variable_set(service, variable, newValue, deviceID)
  end
end

for deviceID, _ in next, devices do
  luup.variable_watch("copyVariable", "urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", deviceID)
  luup.variable_watch("copyVariable", "urn:micasaverde-com:serviceId:LightSensor1", "CurrentLevel", deviceID)
end

Just create the array using this pattern:

[masterID] = {sensorID = childid, lightID = childid},

Thank you so much for getting back to me so quickly - I really appreciate you modifying the code for more than one device. I tried putting that code in but the motions seem to have stopped updating. But I’m thinking we’re almost there.

Note that I did change your directions slightly: in order to not have the non-working virtual light sensor that I got following your original directions, I didn’t add the virtual light sensors. Instead, I only added the virtual motion sensors per your directions, and I kept the two devices created when I enrolled the devices: the parent generic i/o and the child light sensor. Then I filled in: masterID with the device ID of the parent generic i/o; sensorID with the device ID of the virtual motion sensor; and lightID with the device ID of the child light sensor. I did this for each of the devices in the array. Before adopting your new code though, I tested this modification using your old code and it still worked perfectly so I don’t think this is causing the problem.

Here’s the exact code I have entered into the startup luup code - could you please let me know where you think it needs to be modified to work?

devices = {
[61] = {sensorID = 89, lightID = 62},
[65] = {sensorID = 94, lightID = 66},
[63] = {sensorID = 95, lightID = 64}
}

function copyVariableToLighDevice(dev_id, service, variable, oldValue, newValue)
if tonumber(oldValue) ~= tonumber(newValue) then
local deviceID = variable == “CurrentLevel” and devices[dev_id].lightID or devices[dev_id].sensorID
luup.variable_set(service, variable, newValue, deviceID)
end
end

for deviceID, _ in next, devices do
luup.variable_watch(“copyVariable”, “urn:micasaverde-com:serviceId:SecuritySensor1”, “Tripped”, deviceID)
luup.variable_watch(“copyVariable”, “urn:micasaverde-com:serviceId:LightSensor1”, “CurrentLevel”, deviceID)
end

If you don’t need the light sensor, simplify the script:

devices = {
	[61] = {sensorID = 89},
	[65] = {sensorID = 94},
	[63] = {sensorID = 95}
}

function copyVariable(dev_id, service, variable, oldValue, newValue)
	if tonumber(oldValue) ~= tonumber(newValue) then
		luup.log(string.format("Setting %s - %s for #%s to %s", service, variable, tostring(deviceID), tostring(newValue))

		local deviceID = devices[dev_id].sensorID
		luup.variable_set(service, variable, newValue, deviceID)
	end
end

for deviceID, _ in next, devices do
	luup.variable_watch("copyVariable", "urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", deviceID)
end

I noticed a small error in the previous one, sorry for that. This should work.

Thank you again for getting back to me so quickly and reworking that code! I replaced the startup luup code with exactly what you suggested. I double checked the IDs on everything. Unfortunately, still no updates from any of the motions. Any other thoughts on what could be wrong? Thank you again - sincerely - for your help with this!

take a look at logs. easy way is to go to http://vera_ip/cgi-bin/cmh/log.sh?Device=LuaUPnP

Logs - MiCasaVerde

Logs should be easier to undestand.

Thank you for responding so quickly. I didn’t know how to find that log - very helpful. I’ll try to debug but here’s what looks like the relevant part:

01 10/15/20 5:57:32.026 LuaInterface::LoadCode: [string “devices = {…”]:11: ‘)’ expected (to close ‘(’ at line 9) near ‘local’ <0x778f2320>
01 10/15/20 5:57:32.028 JobHandler_LuaUPnP::Run cannot start lua with code:
devices = {
[61] = {sensorID = 89},
[65] = {sensorID = 94},
[63] = {sensorID = 95}
}

function copyVariable(dev_id, service, variable, oldValue, newValue)
if tonumber(oldValue) ~= tonumber(newValue) then
luup.log(string.format(“Setting %s - %s for #%s to %s”, service, variable, tostring(deviceID), tostring(newValue))

	local deviceID = devices[dev_id].sensorID
	luup.variable_set(service, variable, newValue, deviceID)
end

end

for deviceID, _ in next, devices do
luup.variable_watch(“copyVariable”, “urn:micasaverde-com:serviceId:SecuritySensor1”, “Tripped”, deviceID)
end <0x778f2320>

Any quick finds there?

UPDATE:

I tried adding a close parentheses to the end of Line 9 as follows:

luup.log(string.format(“Setting %s - %s for #%s to %s”, service, variable, tostring(deviceID), tostring(newValue)))

That maybe fixed part of the problem - it isn’t erroring in the same way. But now it seems to not be fully implementing (please see below). Any thoughts on how to fix?

10/15/20 10:46:31.150	LuImplementation::Parse can't parse xml /etc/cmh-lu//D_MotionSensor1.json <0x77a70320>

01 10/15/20 10:46:31.150 JobHandler_LuaUPnP::ParseAllImplementations failed to parse D_MotionSensor1.json <0x77a70320>

01 10/15/20 10:46:40.241 LuImplementation::StartLua skipping device 89 implementation valid 1 <0x76fbe520>
01 10/15/20 10:46:40.242 LuImplementation::StartLua skipping device 95 implementation valid 1 <0x76fbe520>

Ok - I think I’ve got it working just about right on! I compared the advanced settings for the two devices that were being skipped to the one that wasn’t and I noticed in the two that were being skipped I’d included the .json file also in the implementation file. So I removed that in both and now all three seem to be working! Huge kudos @therealdb - thank you!

I did notice that when I try to arm the motions it fails to do so and I get in the logs:

08 10/15/20 11:15:35.479 JobHandler_LuaUPnP::HandleActionRequest device: 89 service: urn:micasaverde-com:serviceId:SecuritySensor1 action: SetArmed <0x73af8520>
08 10/15/20 11:15:35.479 JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=89 <0x73af8520>
08 10/15/20 11:15:35.479 JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:micasaverde-com:serviceId:SecuritySensor1 <0x73af8520>
08 10/15/20 11:15:35.480 JobHandler_LuaUPnP::HandleActionRequest argument action=SetArmed <0x73af8520>
08 10/15/20 11:15:35.480 JobHandler_LuaUPnP::HandleActionRequest argument newArmedValue=1 <0x73af8520>
08 10/15/20 11:15:35.480 JobHandler_LuaUPnP::HandleActionRequest argument rand=0.8235879829902095 <0x73af8520>
02 10/15/20 11:15:35.480 Device_LuaUPnP::HandleActionRequest 89 none of the 0 implementations handled it <0x73af8520>
02 10/15/20 11:15:35.480 JobHandler_LuaUPnP::RunAction device 89 action urn:micasaverde-com:serviceId:SecuritySensor1/SetArmed failed with 501/No implementation <0x73af8520>

I suspect I may not have perfectly implemented the virtual devices as you directed. Here’s what they look like:

Did I do anything wrong there?

Sorry about the parenthesis, cut&paste error.

You’ll need a virtual device to support arming the sensor. It’s not that trivial. Try one of my virtual devices here: dbochicchio/vera-VirtualDevices: Virtual HTTP Devices plug-in for Vera and openLuup (github.com)

this should work regardless of the HTTP endpoints, but I’ve never tested it.

No problem at all - thank you again for all the help - you just made these devices functional for me - I really appreciate it!

1 Like

@cw-kid
Dont suppose you ever managed to get Param 1 to control the light on duration? Setting Param 5 to 1 and Param 6 to 0, the manual would lead one to believe that Param 1 would control how long the light stays on, once PIR detected and below the configured LUX setting. No matter what I tried, didnt work… I was only able to control this with the dial on the back of the sensors. Have 2 of the Homeseer versions to tinker with. I did create one virtual motion sensor and trying to figure out the best way to copy over the trigger value from the main device - trying to investigate a way to do this with reactor. Figured out how to monitor, but figure I would need the action to perform a lua call of sorts, since there is no native Reactor support to tinker with virtual device setting values.

That’s what I said previously. So yes looks like I set parameter 1 to 60 seconds.

Parameters 5 & 6 what are those?

Never used Reactor for Vera plugin.

I do use Multi System Reactor however.

Easy to set a Vera device variable in an Action, like setting the virtual motion sensors tripped variable to 0 or 1.

Or you can just use some LUA code to set its tripped variable.

Change the ID number 101 to whatever ID number your virtual motion sensor device is.

LUA code to trip the virtual motion sensor:

luup.variable_set("urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", 1,101)

LUA code to un-trip the virtual motion sensor:

luup.variable_set("urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", 0,101)

In the manual we have the following:

These are defaults, and it should work as you suggested. I have Param 1 set to 300 as 2 byte dec. On the back of the unit, I had the PIR turned all the way counter clockwise, so 8 seconds I believe. Well, it would only light up for 8 seconds when triggered. Almost like BOTH devices were not using the Param 1 value. Of course, I do see the binary light turn on when the light turns on, so both devices are properly included into the Zwave network, and I am getting respective temp and lux readings. I have even tried to tweak the Param 1 value a few times and nothing. Supposedly 8 to 720 is a valid value for this. Strange.

When you say set a Vera device variable in an Action, I only see a limited number of options on the Virtual motion sensor. Take a look at the following:

I suspect that the only way to perform this with Reactor is run lua commands as you suggest.

Parameters 5 & 6 are in the user manual for the Everspring light?

Or a HomeSeer PIR unit?

There is no temp on the Everspring light.

Unless you have a new model or something

In my experience with this Everspring light the Z-Wave parameters for Time and LUX override anything the physical dials might be set as.

There was no parameters 5 & 6 in the user manual I used. Or I would or posted screen shots of them from the manual.

In the top left of your Reactor screen shot what other options do you have in that drop down menu?

The one that is currently using Device Action.

The user manual you are using here is for the HomeSeer HS-FLS100+ PIR.

The parameter settings are different to that of the Everspring unit and there is more of them, 8 parameters in total.

There are only 4 parameter settings in the Everspring user manual.

So either you are using the wrong user manual or you are causing confusion by not stating you have a HomeSeer unit.