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.

Summary

This text will be hidden

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,z.8;1,z.9;1,z.10;1,z.11", masterID) -- this will report temp from endpoints 8, 9, 10 and 11. if you have less sensors, remove the unused ones
luup.variable_set("urn:micasaverde-com:serviceId:ZWaveDevice1", "MultiChSensType", "m3=15,m4=15,m7=1,m8=1,m9=1,m10=1,m11=1", masterID) -- for child: if you 4 temp sensors, leave it as it is. otherwise, remove or add mx=1 according to your config
luup.variable_set("urn:micasaverde-com:serviceId:ZWaveDevice1", "PollSettings", "0", masterID) -- polling can be disabled
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 "Int 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.

No know issues at the moment: the device is fully functional and temp are reported automatically. In the example we are using 4 temp sensors, modify your script to use your setup.

1 Like

Thanks for this post and for the script, it really helped me since Im replacing a broken fibaro universal sensor.
I can get most of the sensors working which includes both binary sensors and both Appliance Module outputs.They report it statuses and responds good.

However, I cant get the temperature sensors to work, neither the internal/builtin (I removed the invisible flag) or a external sensor. If I try to poll the master/parent device it doesnt get a response and times out and the temperature remains without any value.

How can I troubleshoot this? The master/parent must be working since the child binary sensors and output works, right?

Is the altid’s always the same on different Smart Implants? Just so I know the script updates the correct child devices

Also, Im curious what the MultiChSensType" = “m3=15,m4=15,m7=1,m8=1” does?

AFAIK this code will instruct the engine that the temp sensor is reporting in m8, so 8th channel.

I’ll check and report back, maybe I had to change something on the child as well. Mine is reporting well since 10 days.

Thanks, that would be really appreciated.
So m8 is the 8th channel? what does the ‘m’ stand for? Does ‘=1’ stand for temperatur? Not like the category assignments where temperature is 17?
Sorry for the dumb questions. Im trying to figure out how everything is logically connected because I want to use the Smart Implant for other implementations (in my case using the 0-10v analog input to measure water pressure to detect leaking pipes)

Yes, but I really don’t know that in details, since it’s not publicly documented anywhere. I just copied from a working configuration.

e8 is 8th channel, and m8 is (I guess) multisensor 8th channel, mapped to a temp sensor, as m7. this was missing from my inital pairing, so my 8th channel was never reporting.
as you can see, m3 and m4 (3rd and 4th channels) are reporting as 15, which is like a voltage sensor. I don’t have any to attach and test, but you can test it yourself by removing

elseif altid == "e3" or altid == "e4" and

and use just elseif

Then, you need to change the parameters (corresponding to VariablesSet) in order to report analog change from inputs, as stated in the manual. As I said, I never tested this config and maybe you need to change something as I did to report binary status.

AFAIK SensorMlType and SensorMlType are used to designate the sensor as a temperature sensor. I copied them from a working multi sensor as well.

Try to set a multi-channel association for the endpoints that are linked to the external sensors:
(i.e AssociationSet with value 1,z.8;1,z.9;1,z.10 - for endpoints 8,9,10).
Note that the association must be set on the parent device and the reports are being sent based on the values of configuration parameters 67 and 68.

wonderful, it’s working now with no poll needed! big up for @mcv.bogdanf!

scripts updated to reflect this change.

1 Like

Thanks for the update. More questions from me that havent understood how everything works;

1) In your script, it seems that your temp sensors is e7 to e11.

But in

it looks like the temp sensors are m7 to m11 (if ‘=1’ is a undocumented value for a temp sensor).
Is there a association between e[number] and m[number] or is it a typo ?

2) For e1 and e2: I dont have a json-file called “D_MotionSensorAsSirenNoArm1.json”, is that a custom made file or do you run a different version than me? I have a VeraPlus running on 1.7.4453

3) FYI. I think there is a typo here after the parameter 67:

4) FYI2. I think there is a typo, seems to be a missing ‘1,’ for endpoint 11

Yes. That’s basically the same.
Thanks, I will update the script to fix them.

Guys,
Where are you executing the code from? Is it from an ssh session or via the GUI?
I tried testing the code (after editing my master ID) into : Apps -> Develop Apps -> Test luup code
This fails with “Failed to test code, please try again”

What am I doing wrong?
if I am to execute this from ssh (I can login as root), then do I create a temp file with the contents and run it, or what?
Regards,Tim

Yes, you run the code from develop apps->test code. But the code above contains a small error (probably accidently pasted some code in the middle of some other code). Try to remove ‘== “e10” or altid == “e11” then’ from the 9th line about VariablesSet. It should be:

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)

Thanks. It’s great to have some code to work with on this, so great work to both of you.

I have edited the code to reflect the change as suggested. I run from the test code window and it successfully exits which is good. I end up with devices: master, ext and 4 x ‘T #’ sensors. (note : I also have 4 ext probes connected), as follows:

However, I am only getting temperature readings on one single sensor (T #3), and I suspect this is actually the ‘EXT’ one, which is the one inside the device, as this seems to heat a little past ambient temperature due to the circuit inside the implant getting a few degrees hotter.

I know they work as I do get info when I add the device as fgs-223. Looks like my code is slightly wrong still. Code is as follows:

> local masterID = 179
> 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,z.8;1,z.9;1,z.10;1,z.11", masterID) -- this will report temp from endpoints 8, 9, 10 and 11. if you have less sensors, remove the unused ones
> luup.variable_set("urn:micasaverde-com:serviceId:ZWaveDevice1", "MultiChSensType", "e3=15,e4=15,e7=1,e8=1,e9=1,e10=1,e11=1", masterID) -- for child: if you 4 temp sensors, leave it as it is. otherwise, remove mx=1 according to your config
> luup.variable_set("urn:micasaverde-com:serviceId:ZWaveDevice1", "PollSettings", "0", masterID) -- polling can be disabled
> 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_MotionSensor1.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

I only have on attached. I can try with two, but I’m out of town for business until next monday. Code will be fixed soon, thanks for reporting it.

EDIT: uh-oh. Take a look at MultiChCapabilities. It should be like this:

1,7,1,94,108,34,152,159,
2,7,1,94,108,34,152,159,
3,33,1,94,108,34,152,159,
4,33,1,94,108,34,152,159,
5,16,1,94,108,34,152,159,
6,16,1,94,108,34,152,159,
7,33,1,94,133,142,89,49,113,108,34,152,159
8,33,1,94,133,142,89,49,113,108,34,152,159
9,33,1,94,133,142,89,49,113,108,34,152,159
10,33,1,94,133,142,89,49,113,108,34,152,159
11,33,1,94,133,142,89,49,113,108,34,152,159

I will try to incorporate this on the script as well. Try it and let me know.

OK,
Well mine looks slightly different as follows:

1,7,1,94,108,34,152,159,
2,7,1,94,108,34,152,159,
3,33,1,94,108,34,152,159,
4,33,1,94,108,34,152,159,
5,16,1,94,108,34,152,159,
6,16,1,94,108,34,152,159,
7,33,1,94,108,34,152,159,
8,33,1,94,108,34,152,159,
9,33,1,94,108,34,152,159,
10,33,1,94,108,34,152,159,
11,33,1,94,108,34,152,159,

I will have a look and see if I can work it out in the meantime, but your assistance is appreciated when you do get time.
Cheers.

I only have 1 external temp sensor. But I get 2 reported besides the one I thought was the internal one which has altid m1. You got 4 sensors and get 5 besides altid m1 (which is hidden by the script). So maybe m1 isnt a internal one, just a needed “ghost-endpoint”.
Anyone knows what m1 is or why it reports one extra external one?

But since I have 3 less sensors in total my MultiChCapabilities look like this:

1,7,1,94,108,34,152,159, 
2,7,1,94,108,34,152,159, 
3,33,1,94,108,34,152,159, 
4,33,1,94,108,34,152,159, 
5,16,1,94,108,34,152,159, 
6,16,1,94,108,34,152,159, 
7,33,1,94,108,34,152,159, 
8,33,1,94,108,34,152,159,

Which seems logical since I have 3 less endpoints than you.
What does your MultiChEndPoint say. My says “8,0,0” which I dont know if that means that I have 8 channels or that a multichannel is available at endpoint #8, anyone who knows?

Im answering my own question. I paired it as a fgs223 just to see what happened since that reports temp-sensors better for me atm.
altid m1: ghost endpoint, no temperature reported. should be hidden.
altid e7: internal temp sensor.
altid e8: first external temp sensor.

Yep, there are a bunch of ghost device that should be hidden. MultiCh capabilities are crucial and need to be changed as I posted. Same thing for the other variables addressing multiple channels.

Go ahead and change them. This change is needed in order to get the endpoints configured.

Best Home Automation shopping experience. Shop at getvera!

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules