Fibaro Smart Implant: instructions to configure binary inputs (Updated, SKIP first two posts, instructions on the 3rd)

I got two Fibaro Smart Implants. I ordered two Universal Binary Sensors, but I got two FGBS-222 instead. I’m not complaining too much, since I got them for 70 EUR, instead of 100+ :slight_smile:

So, this device is sending 7(+7) channels, and it’s acting as it has 7 channel (+7 channels for temp sensors). It will add:

  • 2 binary sensors
  • 2 voltage sensor (for the analog sensors)
  • 2 switch (because you can switch outputs without triggering the inputs)
  • 1 temp sensor for the internal temperature (not very useful).

The design of its endpoints is questionable, since it will report values even if it is not capable of having them at the same time. Vera will create all the children regardless of the real configuration. I suspect it’s impossible for them to differentiate the configurations, even with a custom device file.
The device can support only 1 configuration for inputs (ie: 1 binary+1 voltage sensor, or 2 binary sensors) and 2 switches. So, if like in my case you want to use only the binary inputs, you have to hide the analog ones. Not a great problem. Out of the box, the device is not reporting anything, it’s not recognized and you have to configure it manually.

Here’s the manual: https://manuals.fibaro.com/content/manuals/en/FGBS-222/FGBS-222-EN-T-v1.2.pdf

After fiddling with parameters, I was able to have binary sensors to report their status.

You have to set it for binary inputs (params 20&21), then change the value reported with IN2 (params 52&54):

My understating of ZWave mapping in Vera is limited, but if I set urn:micasaverde-com:serviceId:ZWaveDevice1 / BasicSetCapabilities to 00=Ue1,FF=Te1,2=Ue2,1=Te2, IN1 is reporting to main device and the _Generic IO 1 device, while IN2 is reporting to _Generic IO 2 only. From my understanding, this device will send Basic Command Class to the same endpoint, regardless of the channel. Out of the box, it will send the same values for both channels, so it will always trigger the same endpoint, in Vera, if you don’t change params 52 and 54.
In order to set this new variable, go to the parent, then Advanced and new service.

New service: urn:micasaverde-com:serviceId:ZWaveDevice1
New variable: BasicSetCapabilities
New value: 00=Ue1,FF=Te1,2=Ue2,1=Te2

Then, on the main device and both children, go to advanced, then Params, and set

Master

device_type urn:schemas-micasaverde-com:device:ComboDevice:1
device_file D_ComboDevice1.xml
device_json: D_ComboDevice1.json
category_num 11
subcategory_num 0

Binary sensors

device_type urn:schemas-micasaverde-com:device:MotionSensor:1
device_file D_MotionSensor1.xml
device_json: D_MotionSensor1.json
category_num 4
subcategory_num 8

Hide the children you don’t need (ia: appliance module 1/2, no name “watts” mapping to it analog endpoints), and you will be good to go. Unfortunately OUT1 and OUT2 are not mapped to IN status, but I suspect it’s something similar to the previous point.
Disable polling on the main device, since this device will report its change instantly.
Using this hack, you can use the binary inputs as in the UBS. I still have to fix the reports associated with external temp sensor, but overall it seems stable. YMMV.

Paging @FIBARO if other customers need to start with this device in Vera.

You can also automate this by running this code:

local masterID = 299 -- change with yours

-- master
luup.attr_set("device_file", "D_ComboDevice1.xml", masterID)
luup.attr_set("device_json", "D_ComboDevice1.json", masterID)
luup.attr_set("device_type", "urn:schemas-micasaverde-com:device:ComboDevice:1", masterID)
luup.variable_set("urn:micasaverde-com:serviceId:ZWaveDevice1", "BasicSetCapabilities", "00=Ue1,FF=Te1,2=Ue2,1=Te2", masterID)
luup.variable_set("urn:micasaverde-com:serviceId:ZWaveDevice1", "VariablesSet", "20-IN1 mode,1d,1,21-IN2 mode,1d,1,52-IN2 value for ON,2d,1,54-IN2 value for OFF,2d,2,67-temp change external channel,2d,3,68-temp periodical report,2d,60", masterID)
luup.variable_set("urn:micasaverde-com:serviceId:ZWaveDevice1", "AssociationSet", "1,1.0,2.0", masterID)
luup.variable_set("urn:micasaverde-com:seraviceId:ZWaveDevice1", "PollSettings", "0", masterID) -- no polling
luup.variable_set("urn:micasaverde-com:serviceId:HaDevice1", "ChildrenSameRoom", "0", masterID) -- if you want to freely move children in other rooms
luup.devices[masterID].subcategory_num = 11
luup.devices[masterID].category_num = 0

-- children
for deviceNo, d in pairs(luup.devices) do
    local parent = d.device_num_parent or -1
    if parent == masterID then
		local altid = luup.attr_get("altid", deviceNo)
		-- fix binary sensors
		if altid == "e1" or altid == "e2" then
			luup.attr_set("device_file", "D_MotionSensor1.xml", deviceNo)
			luup.attr_set("device_json", "D_MotionSensor1.json", deviceNo)
			luup.attr_set("device_type", "urn:schemas-micasaverde-com:device:MotionSensor:1", deviceNo)
			d.category_num = 4
			d.subcategory_num = 8
		elseif altid == "m1" or altid == "e7" or altid == "e8" or altid == "e9" or altid == "e10" then
			luup.attr_set("device_file", "D_TemperatureSensor1.xml", deviceNo)
			luup.attr_set("device_json", "D_TemperatureSensor1.json", deviceNo)
			luup.attr_set("device_type", "urn:schemas-micasaverde-com:device:TemperatureSensor:1", deviceNo)
			d.category_num = 18
			d.subcategory_num = 0

			luup.attr_set("invisible", "0", deviceNo)
		else
			-- hide all
			luup.attr_set("invisible", "1", deviceNo)
		end
    end
end

This will set all the things discussed previously in one shot. You just need to reload LuuP engine.
Temperarure will not report correctly from external endpoints, but I guess it’s probably a limitation of the way Vera’s handling Sensor Multilevel Reports, so we’re basically out of luck here. But it’s working OK as a substitute of a binary sensor.

Thanks to @mcv.bogdanf, you can have the temp sensors reporting their values. Just pair it as FGS-223 (Fibaro Double Switch 2). The rest of the posts remains valid.

Instructions to pair as generic are still valid. Otherwise, you will not get any binary sensors reports.

New code to configure temperature sensors as well:

local masterID = 301
local desc = "SmartImplant"

-- master
luup.attr_set("device_file", "D_ComboDevice1.xml", masterID)
luup.attr_set("device_json", "D_ComboDevice1.json", masterID)
luup.attr_set("device_type", "urn:schemas-micasaverde-com:device:ComboDevice:1", masterID)
luup.variable_set("urn:micasaverde-com:serviceId:ZWaveDevice1", "BasicSetCapabilities", "00=Ue1,FF=Te1,2=Ue2,1=Te2", masterID)
luup.variable_set("urn:micasaverde-com:serviceId:ZWaveDevice1", "VariablesSet", "20-IN1 mode,1d,1,21-IN2 mode,1d,1,52-IN2 value for ON,2d,1,54-IN2 value for OFF,2d,2,67-ext temp change external channel,2d,3,68-ext temp periodical report,2d,3600", masterID)
luup.variable_set("urn:micasaverde-com:serviceId:ZWaveDevice1", "AssociationSet", "1,1.0,2.0", masterID)
luup.variable_set("urn:micasaverde-com:serviceId:ZWaveDevice1", "MultiChSensType", "m3=15,m4=15,m7=1,m8=1", masterID) -- for child 
luup.variable_set("urn:micasaverde-com:serviceId:ZWaveDevice1", "PollSettings", "3600", masterID) -- polling to be enabled for temperature
luup.variable_set("urn:micasaverde-com:serviceId:HaDevice1", "ChildrenSameRoom", "0", masterID) -- if you want to freely move children in other rooms
luup.attr_set("name", (desc .. " Master"), masterID)
luup.devices[masterID].subcategory_num = 11
luup.devices[masterID].category_num = 0

-- children
for deviceNo, d in pairs(luup.devices) do
    local parent = d.device_num_parent or -1
    if parent == masterID then
		local altid = luup.attr_get("altid", deviceNo)
		-- fix binary sensors
		if altid == "e1" or altid == "e2" then
			luup.attr_set("device_file", "D_MotionSensor1.xml", deviceNo)
			luup.attr_set("device_json", "D_MotionSensorAsSirenNoArm1.json", deviceNo)
			luup.attr_set("device_type", "urn:schemas-micasaverde-com:device:MotionSensor:1", deviceNo)
			luup.attr_set("name", (desc .. " " .. (altid == "e1" and "IN1" or "IN2")), deviceNo)
			d.category_num = 4
			d.subcategory_num = 8
		-- fix for temp sensors
		elseif altid == "e7" or altid == "e8" or altid == "e9" or altid == "e10" or altid == "e11" then
			luup.attr_set("device_file", "D_TemperatureSensor1.xml", deviceNo)
			luup.attr_set("device_json", "D_TemperatureSensor1.json", deviceNo)
			luup.attr_set("device_type", "urn:schemas-micasaverde-com:device:TemperatureSensor:1", deviceNo)
			luup.variable_set("urn:micasaverde-com:serviceId:ZWaveDevice1", "SensorMlScale", 1, deviceNo)
			luup.variable_set("urn:micasaverde-com:serviceId:ZWaveDevice1", "SensorMlType", 1, deviceNo)

			local name = "T #" .. tostring(tonumber(string.sub(altid, 2)) - 7)

			luup.attr_set("name", (desc .. " " .. (altid == "e7" and "Ext T" or name)), deviceNo)

			d.category_num = 17
			d.subcategory_num = 0

			luup.attr_set("invisible", "0", deviceNo)
		-- hide all
		elseif altid == "e3" or altid == "e4" or altid == "e5" or altid == "e6" or altid == "m15" or altid == "m1" or altid == "b10" then
			luup.attr_set("invisible", "1", deviceNo)
		end
    end
end

Only known issue is that you have to poll the master in order to get updated temperature. I’ll update this post if I found the solution.

© 2019 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy