[SOLVED] [Main] Konnected Binding

Ok thanks, i am rebuilding that right now and about to upload a new one. - and its updated now

1 Like

its updated now

1 Like

Initial impressions, it might work but when the thing is added it still says “Internal Server ERROR: 500”
It might work anyways because it says the thing is ONLINE this time instead of UNKNOWN as before.

I’ll play around for a bit and see if there are any problems with it.

EDIT:
The buzzer is working now!

1 Like

if you still have trace logging on would you mind sharing you logs with me? I have been seeing the internal log error some times as well and can’t pin down what it is.

Awesome that you have the buzzer working! let me know if you run into any other issues.

1 Like

https://puu.sh/BY6Tx/a9dcbd416b.log

2 Likes

So I was doing some further testing with actuators and sensors, they both seem to work just fine, but sometimes the Konnected modules lie to you and say they’re offline when they’re not, and even still accepting commands oddly. Functionality seems to be just fine so far, besides needing to manually sending config update every time you make a change to the channels and things. I’m hooking it up into my security panel tomorrow and actually doing the coding.

All in all great work!

I added the state monitoring updates late in development so perhaps i need to flesh it out a bit. But the basic idea is that it sets it to offline whenever there is a communication error on the server end but then will set it back online if it receives a message the module. So my suspicion here is that there was an error for some reason (the binding threw an exception, etc.) but then the module later sent a message so the thing was set back online. Or i may have not coded it properly and need to tweak it. But i would need to look through your logs to confirm. If you have your logs that would be great. :slight_smile:

As to the updating of the module. So the binding sends a command to the module on three occasions when openhab is first started, when there is a configuration change, or if the user manually triggers it via the configuration switch. This is currently by design. I choose not to send on channel adds or deletes because of the modules response to receipt of updated settings. So when the module receives a settings update it reboots which takes about 20-30 seconds before the device comes back online. Thus if the user is adding or deleting several channels quickly (such as during the initial setup) there could be several commands that would be sent and potentially not received by the device (if it were in the middle of rebooting) if i were to trigger an update on channel adds or deletes. At this point i have made a design decision to not trigger on channel adds as for the most part this configuration does not happen that often, however, i am open to suggestions on how to handle this more elegantly?

Perhaps this needs to be communicated to the user better? Such as an update to the thing status to indicate that an update in settings should be sent on channel adds and deletes? This status could then be cleared when the module was updated?

Thanks for all your testing!

1 Like

@volfan6415

Sorry for the late response, I am still confused as to why I sometimes do and sometimes I don’t get an email to updates to threads I’m subbed to.

https://puu.sh/C0w0P/3781c6ae2b.log

Here is the latest log file after running the modules for a few days. Everything is running as expected, but there are some interesting exceptions being thrown. Again I have not personally noticed any functionality issues.

As to the updating the channel configurations, I can understand the issue there. In my experience the module takes about 10 seconds to receive and reboot with the new configuration. I think changing the status to pending and note to send update config manually is a great idea. Its not a big deal after you know about its quirks but that could throw off a new user.

1 Like

Im looking at using this binding, can someone please explain how to install the latest version. Its either this, Or i create my own using MQTT commands.

So go to the pull request linked in the above post and download the .jar from the top post of the pull request on github. Then place the.jar (you will need to unzip) in your addons folder. Then you will need to run the command feature:install openhab-transport-upnp from the karaf console. This will install the binding dependency. Then restart openhab.

2 Likes

Thanks for the reply, Done that. And the thing is found easily enough, But its asking for an AUTH TOKEN. This isn’t automatically produced.

Also. do you have an Items file example i can start with?

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:

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.