[SOLVED] [Main] Konnected Binding

Ok. So after some testing.

I have created the Auth token myself, seems its a number i can select, and then that is what i use in the items file to link to the channel

I have added channels myself Zone_1 to Zone_6
And I have figured which pins are connected to which zones on the unit

I have also figured that If i add Aux_1 to Aux_6 it turns that zone/pin into an output

One question i have though, does openhab control the zones and then sirens, or does the Konnected firmware trigger a siren when the zone is open/closed.

I have found no way of changing the konnected firmwares settings, is there an option or a way for this to happen.

More documentation on this would be brilliant.

One other thing, when the device goes offline, there is no notification of it.
It just stays as online,

The openHAB konnected binding is sending the commands to the alarm panel modules. So if you setup a channel as an actuator type and then send a command of either OFF or ON the binding will then transmit that command to the alarm panel of the thing. The firmware on the alarm panel itself will then receive that command and transmit the command to the physical device itself.

This is correct. However, I am still developing the binding and I am about to release a revised version of the binding with the binding itself will handle the auth token and this will not need to be configured by the user at all. But with the current version as of 11/14 you are correct that it will accept any string.

Which settings are you referring to? The binding can has the ability to send settings for blink and to disable device discovery. Both of these can be found under the configuration page under the show more tab. However, be careful with disabling the device discovery that you have assigned a static IP address and that the thing was added to openHAB with the static IP address. Otherwise the binding will not be able to communicate with the alarm panel and you will have to manually reset the alarm panel via its status page. (which can be found at http://deviceip/port, this is address is listed on the properties of the thing, the port is randomly set by each alarm panel and is not configurable.

here is a link to the current readme, its a work in progress. :slight_smile:

https://github.com/openhab/openhab2-addons/tree/9b744e5101285005b27ac9271b31b46c33041448/addons/binding/org.openhab.binding.konnected

Still developing the binding and working through the notification system. Definitely still some kinks to work out. Right now the binding will put the thing offline when there are any communication errors, but will put the device back online when it receives a command from the module. I probably need to have it recheck on communication failures before setting it offline to confirm that the particular failure wasn’t just a one off failure.

Thank you for testing and please report any and all bugs or issues you come across here so i can work on them.

I want to thank you for your work on this.

I initially thought the Alarm system worked on the NODEMCU completely and OH just handled some commands and also notifications. But I was wrong, I now understand the Konnected device just sends contact status to OH and also receives actuator status from OH. so if OH is off, the alarm system wont work. This means ill have to input some sort of battery backup for my router, OH sytem and the konnected devices.

I have worked out the commands and channels last night, but I would suggest that the channels automatically come through in a future revision of the binding.

Zone_1, Zone_2, Zone_3, Zone_4, Zone_5, Zone_6 and Zone_7 are the channels i worked out. Also Aux_1,Aux_2,Aux_3,Aux_4,Aux_5,Aux_6.

Zone_7 being the siren output.

Also, if you have an Aux_n (where n being a zone number) set, it turns that zone into an OUTPUT on the Konnected device, and not an INPUT as a zone.

Is there a channel for a beeper? Lets say for instance a door is opened while the alarm is set in OH, and you want a beeper to go off for 10 seconds before the siren does. Is there a channel for this, or do you just set it using an Aux channel?

Do you have an Items file example i can look at, Maybe a sitemap example also. I currently have a sitemap and items file setup for an alarm system that is pretty crude, it has a keypad, with a pre configured code that needs to be entered. Then you can arm, disarm, or stay the alarm, and this then presses buttons on a remote that i have wired up. Its crude but it works.

Now that i know the pinouts, im in the process of making my own addon board similar to Konnected’s.

Also, I would add, in the binding, maybe you can change whether a contact is NO or NC, as some contacts do not have multiple configurations and are set already as either NO or NC. This way you wont have to alter OH code to account for a reversed contact.

Edit: I have just read the readme, some of my questions above are actually answered

I think this is in the readme, but you set it up as an actuator channel. As per the konnected alarm panel specs zones 1-5 or the out terminal can function as an actuators. So you can pick any of those. Then set the config parameters for times,pause and momentary as appropriate for your needs. For the rest of this part you would need to have two things setup. A beeper and then the siren. Then you would want a rule that first fires the beeper for ten seconds … and then if something doesn’t happen in ten seconds it activates the siren channel. There are several ways that this could probably be done in rules i haven’t personally done it but i would search the design patters or forums here first for that specifically for some ideas. (sorry not to pass the buck on this one).

So the two channels that are added are a design choice. There are numerous configurations for each thing (I have several in my house and they each have multiple types on them) However the reason i have these two as defaults is because physically speaking on the alarm board zone 6 is always a sensor (it could be a temp sensor so then you would delete this channel) but the out is always the out. Thus these two serve as an example of the base functionality (actuator/sensor) while not requiring alot of channels to be deleted for every thing that is added. For my things i only have channels for things i actually have connected to the panel. The thing is extensible and the user can add whatever channels there particular situation requires.

So currently the binding itself is agnostic to the state of the device. If the alarm panel sends a 0 it reports it as closed and if it sends a 1 it reports it as open. Or on off for the actuator type. I didn’t think that a config parameter here was necessary as the user can easily change what these mean in the sitemap or other UI interfaces. For example the open/closed states can be mapped to whatever the user desires to present. But i am open to rethinking this as i know there are some UI elements that derive from the physical state and not its presentation.

/* Konnected Sensors*/
Contact	Konnected_Zone_1	"Middle M" 			(Motion_Sensors){channel="konnected:module:1586287:Zone_3"}
Contact Konnected_Zone_4	"Back M"		(Motion_Sensors)	{channel="konnected:module:4543348:Zone_3"}
Contact Konnected_Front_Zone_2	"Front Motion"	(Motion_Sensors)	{channel="konnected:module:1586517:Zone_2"}
Switch 	Konnected_Out		"Siren"				{channel="konnected:module:16631321:Zone_7"}
Contact Konnected2_Zone_1	"Door Bell"     	{channel="konnected:module:1673491:Zone_1"}
Contact Konnected2_Zone_2	"Den Right Window" 	{channel="konnected:module:1673491:Zone_2"}
Contact Konnected2_Zone_3	"Den Left Window" 	{channel="konnected:module:1673491:Zone_3"}
Contact Front_Door_Sensor 	"Front Door" 		{channel="konnected:module:1673491:Zone_6"}
Contact Back_Door_Sensor	"Back Door"			{channel="konnected:module:1673491:Zone_5"}
Contact Konnected2_Zone_4 	"Smoke Alarm"		{channel="konnected:module:1673491:Zone_4"}
Switch 	Konnected2_Out		"Motion"			{channel="konnected:module:1673491:Zone_7", expire="5s, command=OFF"}
Contact	Konnected_Den_Zone_2	"Den" 		(Motion_Sensors)	{channel="konnected:module:3830205:Zone_2"}





/*Konnected AC Control */
Switch 	Konnected_AC_Out		"Relay Power"				{channel="konnected:module:14108879:Zone_7"}
Switch 	Konnected_AC_Zone_1		"Zone 1"				{channel="konnected:module:14108879:Zone_1"}
Switch 	Konnected_AC_Zone_2		"AC Control"				{channel="konnected:module:14108879:Zone_2"}
Switch 	Konnected_AC_Zone_3		"Zone 2"				{channel="konnected:module:14108879:Zone_3"}
Switch 	Konnected_AC_Zone_4		"Zone 4"				{channel="konnected:module:14108879:Zone_4"}
Switch 	Konnected_AC_Zone_5		"Zone 5"				{channel="konnected:module:14108879:Zone_5"}
Number:Temperature Konnected_Attic1         "Attic Temperature [%.1f °F]"             <temperature>(Temp) {channel="konnected:module:14108879:AtticTemp6"}


Number:Temperature Front_Den_Temperature         "Living Room [%.1f °F]"             <temperature>(Temp) {channel="konnected:module:1586517:Zone_1"}
Number:Temperature Kitchen_Temperature         "Kitchen [%.1f °F]"             <temperature>(Temp) {channel="konnected:module:1586287:Zone_1"}
Number:Temperature Stairway_Temperature         "Stairway [%.1f °F]"             <temperature>(Temp) {channel="konnected:module:4543348:Zone_1"}
Number:Temperature Den_Temperature              "Den [%.1f °F]"             <temperature>(Temp) {channel="konnected:module:3830205:Zone_1"}
Number:Temperature Server_Closet_Temperature         "Server Closet [%.1f °F]"             <temperature>(Temp) {channel="konnected:module:3830205:Zone_3"}
Number:Temperature Konnected_Outside_Temperature         "Outside Temperature [%.1f °F]"             <temperature>(Temp) {channel="konnected:module:3830205:Zone_4"}

Switch item=Front_Door_Sensor label="Front Door" icon="frontdoor" mappings=[OPEN="Open", CLOSED="Closed"] 
Switch item=Back_Door_Sensor label="Back Door" icon="door" mappings=[OPEN="Open", CLOSED="Closed" ]
Switch item=Motion_Shed_Door icon="door" mappings=[OPEN="Open", CLOSED="Closed"]
Switch item=Konnected_Zone_4 icon="motion" mappings=[OPEN="Open",CLOSED="Closed"] 
Switch item=Konnected_Front_Zone_2 icon="motion" mappings=[OPEN="Open", CLOSED="Closed"]
Switch item=Konnected_Zone_1 icon="motion" mappings=[OPEN="Open", CLOSED="Closed"]
Switch item=Konnected_Den_Zone_2 icon="motion" mappings=[OPEN="Open",CLOSED="Closed"]
Switch item=Konnected2_Zone_2 icon="window" mappings=[OPEN="Open", CLOSED="Closed"]
Switch item=Konnected2_Zone_3 icon="window" mappings=[OPEN="Open", CLOSED="Closed"]
Switch item=Konnected2_Zone_1 icon="door" mappings=[OPEN="Open", CLOSED="Closed"]
Switch item=Konnected2_Zone_4 icon="fire" mappings=[OPEN="Alarm", CLOSED="Off"]
Switch item=Konnected_Out icon="siren" mappings=[ON="Open", OFF="Closed"]
Switch item=Konnected2_Out icon="Alarm" mappings=[ON="Open", OFF="Closed"]
			


Text item=Front_Den_Temperature
Text item=Kitchen_Temperature
Text item=Stairway_Temperature
Text item=Den_Temperature 
Text item=Server_Closet_Temperature
Text item=Konnected_Outside_Temperature

rules file

import org.eclipse.xtext.xbase.lib.Functions
val Functions$Function3<GenericItem, GenericItem, GenericItem, Object> motionSwitch= [relayItem, AlarmItem, TriggerItem |
	if (AlarmItem.state==ON){
	logDebug("Alarmrule.rules","Opening the alarm trigger as system is Armed")	
	relayItem.sendCommand(ON)
	sendNotification("volfan6415@gmail.com", "Activating the alarm from sensor: " + transform("MAP", "sensorName.map", TriggerItem.name))
	}
	else{
		logDebug("Alarmrule.rules","System was not armed so not activating the switch")
	}
	]
	


rule "Back Door Open"
	when
	Item Back_Door_Sensor changed from CLOSED to OPEN
	then
	Back_Door_Control.sendCommand(ON)
	motionSwitch.apply(Konnected2_Out,Armed,Back_Door_Control)
	
	end

rule "Front Door Open"
	when
	Item Front_Door_Sensor changed from CLOSED to OPEN
	then
	motionSwitch.apply(Konnected2_Out,Armed,Front_Door_Sensor)
	Front_Door_Control.sendCommand(ON)
	Echo_Den_TTS.sendCommand("Front door opened.") 
	end
	
rule "Shed Door Open"
	when
	Item Motion_Shed_Door changed from CLOSED to OPEN or
	Item Motion_Shed_Door changed from NULL to OPEN
	then
	Light17.sendCommand(ON)
	motionSwitch.apply(Konnected2_Out,Armed,Motion_Shed_Door)
	end

rule "Motion Sensors"
	when
	//back motion
	Item Konnected_Zone_4 changed from CLOSED to OPEN or
	//front motion
	Item Konnected_Front_Zone_2 changed from CLOSED to OPEN or
	//middle motion
	Item Konnected_Zone_1 changed from CLOSED to OPEN or
	//den motion
	Item Konnected_Den_Zone_2 changed from CLOSED to OPEN
	then
	//only send the motion switch to trip alarm when we are away
	

	Motion_Sensors.members.filter[motion | motion.state == OPEN].forEach[motion|
	if (System_State.state == OFF){motionSwitch.apply(Konnected2_Out,Armed,motion)}
	else{Armed_Automation.sendCommand(OFF)}
	Motion_Ten.sendCommand(ON)
	]
	end

rule "back motion"
when
Item Konnected_Zone_4 changed from CLOSED to OPEN
then
Back_Motion_Control.sendCommand(ON)
end

rule "front motion"
when
Item Konnected_Front_Zone_2 changed from CLOSED to OPEN
then
Front_Motion_Control.sendCommand(ON)
end

rule "middle motion"
when
Item Konnected_Zone_1 changed from CLOSED to OPEN
then
Kitchen_Motion_Control.sendCommand(ON)
end

rule "den motion"
when
Item Konnected_Den_Zone_2 changed from CLOSED to OPEN
then
Den_Motion_Control.sendCommand(ON)
end


	
rule "Back Window Right or left"
	when
	Item Konnected2_Zone_2 changed from CLOSED to OPEN
	then
	motionSwitch.apply(Konnected2_Out,Armed, Konnected2_Zone_2)
	end
	
rule "Back Window Right or left"
	when
	Item Konnected2_Zone_3 changed from CLOSED to OPEN
	then
	motionSwitch.apply(Konnected2_Out,Armed, Konnected2_Zone_3)
	end

rule "Alarm Set"
	when
	Item Armed changed from OFF to ON
	then
	Echo_Den_TTS.sendCommand("Be careful when leaving. The Alarm is now set.") 
	end

rule "Armed Automation - Off"
	when
	Item Armed_Automation received command OFF
	then
	Armed.sendCommand(OFF)
	end

rule "Armed Automation - ON"
	when
	Item Armed_Automation received command ON
	then

	if (System_State.state == ON){
		logDebug("Alarmrule.rules","People are home so we are not auto re arming the system")
		//unless it is between 1-7 in the morning then we are sleeping and so we will rearm the system
		if (vTimeOfDay.state == "BED"){
		Armed.sendCommand(ON)	
		}

		
		}
	else{
		logDebug("Alarmrule.rules","no one is home so rearming the system")
		Armed.sendCommand(ON)
	}

	end

	rule "smoke alarm"
	when
	Item Konnected2_Zone_4 received command OPEN
	then
	Echo_Den_TTS.sendCommand("Smoke Alarm Active.")
	Echo_Bedroom_TTS.sendCommand("Smoke Alarm Active.")
	Echo_Kitchen_TTS.sendCommand("Smoke Alarm Active.")
	sendNotification("volfan6415@gmail.com", "Smoke Alarm Active.")
	end

I should also add that that the basic function of my arming and disarming works off of the design pattern from the presence detection. (Design Pattern: Sensor Aggregation) But the idea is that i have all of the senors that i want to track if people are home or not (phones, doors opening and closing, my media center playing, motion sensors, etc.) then when all of those leave the system arms itself.

The system also arms itself via our good night routine that is fired off via our amazon echos.

rule "Everyone is Gone"
	when
		Item System_State changed from ON to OFF
	then
	logDebug("Presense.rules","Everyone is gone so we are locking the front doors and tunring the lights off and arming the system")
	Lights.sendCommand(OFF)
	Front_Door_Lock.sendCommand(ON)
	Shed_Door_Lock.sendCommand(ON)
	Armed.sendCommand(ON)
	end
Switch System_State "Home/Away" (Persist)
Switch Armed_Automation (Persist) {expire="1h, command=ON"}
Switch Armed "Sensor Status: [MAP(Armed.map):%s]" (Persist)

The armed automation group functions to allow my motion sensors to auto disarm and arm the sensor when we are at home and sleeping as detected by our phones. Otherwise if our phones aren’t present it will activate the alarm on the motion sensor movement. But if the phones are home it does not activate the alarm.

Also i am more than happy to discuss this in more detail with you, but don’t want to hijack this thread which i would like to keep focused on the konnected binding itself. I posted the above as it is still related and others using will find it useful. But if we want to discuss it further lets start a separate thread. :slight_smile:

Thanks for that
I understand most of it now.

where you said

Blockquote
For the rest of this part you would need to have two things setup. A beeper and then the siren.

do you mean an you would need two ‘items’ setup in the items file, not ‘thing’.

I already have alarm rules setup, and working. so this would be easy to integrate.

If you want the siren to beep and then blare with different tone differences you will need difference channels …

But question in the physical device sense are you trying to make two difference devices beep or one device behave differently?

1 Like

what i mean is in the samsung smartthings app, there are more “thing” types than what you have in your binding.

They have beepers.

I assume that for me to connect a beeper, I just put it in a zone, change that zone to an actuator and adjust the pulses.

Then I have an item linked to that thing, and a rule that triggers that item.

I assume that for me to connect a beeper, I just put it in a zone, change that zone to an actuator and adjust the pulses.

Correct

1 Like

Hey Zachary, Any idea why it wont discover devices anymore. I had to reset the konnected device as it got stuck in a bootloop. and now it wont show it as being discovered.

nevermind, i needed to install the UPNP service as mentioned in the first few posts again after updating to the openhab snapshot 2.4

nevermind, i needed to install the UPNP service as mentioned in the first few posts again after updating to the openhab snapshot 2.4

:+1: glad you got it worked out.

1 Like

Happy to report that the binding has now been merged! Should be part of the snapshots builds and into the 2.4. M6 testing releases. For those not running snapshots and until testing M6 is released i will place a .jar in the first post of this thread that can be used that is equivalent to what will be in the release.

2 Likes

@volfan6415
I can’t seem to get my modules to communicate with my openhab after update. I didn’t read the remove channels and things part until after I ran into troubles and deleted them afterwards, but now its does not work. How do you factory reset these things?

oof.

EDIT: Ignore me. I fixed it by reflashing the module and erasing memory. That’s what I get for not reading.

1 Like

I will say that earlier versions of the binding were not as clear with the discovery flag being set correctly. So it is possible that your devices had discovery disabled and you didn’t realize it. I ran into that issue last night myself. :slight_smile: This has been corrected with the newest version so going forward this won’t be a problem as long as you remember to turn discovery back on and have the setting sync before you remove the thing. (assuming you have it disabled.) But as the articles mention i would only disable device discovery if you are having specific problems. In most cases its best to leave it on.

@volfan6415
Actually I do need help. I’ve upgraded to the latest snapshot build of openhab and its just not updating the modules. When I first added them it said Online, but after I added all the channels, pushed the update button for manual update, I tested them and it did not work. After I restarted Openhab the module says “Unknown”. The device status web page says there are no sensors or actuators.

Log to follow, I think I need to re-enable debug level

yes please enable debug log level and send it over. Also there were two major bugs (tiny lines of code but had major effect) that i didn’t discover until today. They have been merged but not sure if they made it into the snapshot that you are running.

Granted those bugs dealt with the sensor type reporting as a contact type instead of a switch type. So the module still should come online properly.

@volfan6415
https://puu.sh/C3zAO/011507ff7d.log

EDIT:
Also worth to note that I just did the update so I’m running build #1430
https://ci.openhab.org/job/openHAB-Distribution/1430/

Here is a log that only includes start up, and attempting to send manual update to module.

https://puu.sh/C3zMb/628975a57f.log