[SOLVED] BasicUI - keypad

For anyone who is working towards the same idea, I’ve learned the MySensors binding doesn’t query the child sensors state on startup. Without this functionality, the binding won’t know the door / window contacts states until they change. For any alarm type system, both the controller and sensor nodes need to query states on startup. Anyone have another suggestion for an arduino based system that implements that functionality?

There is rule code in this widget thread that will deal with capturing keypad entries with a mask and concatenating ready for validation:

It’s not a full alarm system example but it is binding free from a keypad entry point of view and you can easily adjust the validation code and sendCommand(Alarmstatus, OFF) equivalent to suit your needs. If my alarm code reaches a stable state I’ll share it but at the moment it still has a few too many //TODO comments in it.

I like the BasicUI sample above, nice to have an alternative to the HABPanel widget.

The whole discussion about insurance is something that I’ve thought about and for me it’s not a major concern as I’m only dealing with my residential and house insurance is not relevant to any alarm system I can avoid that specific issue. The security aspect is important in itself and you should always take appropriate system precautions but if I have a plain text copy of a PIN for now I can live with, although it’s on my to do list for one day.

In relation to someone getting at my OH instance and turning off the alarm, yes they could but in reality the people occupying the house have enough troubles using the pretty side of the UI technology so if somebody wants to go to the level of hacking their way in, reverse engineering my OH configuration to disable the alarm then good luck to them. I’m not protecting anything so valuable that I need to worry about that level of a sophisticated attack so I soon reach the conclusion that if someone was going to go to that level of effort I’m not going to keep them out.

But certainly everyone has to assess their own levels of comfort and meet their insurance requirements.

John not sure about MySensors as I’ve not seen it before but you might want to post a new thread before diverting this. Include more details about your requirements, what you have hardware wise what you’d prefer and see what others have to add or suggest.

I had managed to sort out a keypad using the Basic UI, but lost the code on an OS upgrade gone wrong. The examples everyone posted did help. I eventually plan to try a panel, but the basic ui on a phone is needed as a backup.

Agree, the mysensors issue should go in a separate thread so I’ll write it up when I get a chance.

The same rule code can be used behind the BasicUI and HabPanel so it’s easy enough to use them both as and when you like, just pick the rules you prefer and then adapt the keypad UIs to suit.

I like this, is it me or does the keypad button set continue from where it was last used, or could it clear after a time out of no use, so to start code entry with a “clean sheet”, sorry my bad, it does clear after ( 5000 )

[quote=“Chod, post:17, topic:28818”]
ear after


[/quote]’

In 1st frame only one key gets selected at a time
same behaviour in not in 2nd and 3rd frame. Any suggestion to get same behaviour in 2nd and 3rd. I do not want user to select multiple keys at same time. One key at a time .

Sitemap code :
sitemap keypad label=“KeyPad”
{
Frame label=“Alexa” {

Switch item=Bathroom_Power_A label=" keypad" icon=“alarm” mappings=[KEY1=“1”, KEY2=“2”, KEY3=“3”,KEY4=“4”, KEY5=“5”, KEY6=“6”,KEY7=“7”, KEY8=“8”, KEY9=“9”,KEYN=“X”]
// /Switch item=Bathroom_Power_A label="" icon=“alarm”/ mappings=[KEY4=“4”, KEY5=“5”, KEY6=“6”]
// Switch item=Bathroom_Power_A label="" icon=“alarm” mappings=[KEY7=“7”, KEY8=“8”, KEY9=“9”]
// Switch item=Bathroom_Power_A label="" icon=“alarm” mappings=[KEYN=“X”, KEY0=“0”, KEYY=“✓”]
}
Frame label=“Alexa 2”
Frame {
Frame {
Switch item=Bathroom_Power label=“Alarm klavier” icon=“alarm” mappings=[KEY1=“1”, KEY2=“2”, KEY3=“3”]
}
Frame{
Switch item=Bathroom_Power label="" icon=“none” mappings=[KEY4=“4”, KEY5=“5”, KEY6=“6”]
}
Frame{
Switch item=Bathroom_Power label="" icon=“none” mappings=[KEY7=“7”, KEY8=“8”, KEY9=“9”]
}
Frame{ Switch item=Bathroom_Power label="" icon=“none” mappings=[KEYN=“X”, KEY0=“0”, KEYY=“✓”]
}
}

Frame label="Alexa3" {

Switch item=Bathroom_Power_A label=" keypad" icon=“alarm” mappings=[KEY1=“1”, KEY2=“2”, KEY3=“3”]
Switch item=Bathroom_Power_A label="" icon=“alarm” mappings=[KEY4=“4”, KEY5=“5”, KEY6=“6”]
Switch item=Bathroom_Power_A label="" icon=“alarm” mappings=[KEY7=“7”, KEY8=“8”, KEY9=“9”]
Switch item=Bathroom_Power_A label="" icon=“alarm” mappings=[KEYN=“X”, KEY0=“0”, KEYY=“✓”]
}
}

Hi @Dries

Could you please share your Item definition ?

Best Nanna

Related to the key pad?
They are pretty simple:

/* Alarm keypad */
String Tex_Alarm_Keypad					"Alarm klavier"																				<alarm>					(gAlarm)
Number Tex_Alarm_Keypad_counter			"Alarm klavier - teller"																	<text>					(gAlarm)
Switch Tex_Alarm_Keypad_visibility		"Alarm klavier zichtbaar"																	<lock>					(gAlarm)

Hi @Dries

I have the Keypad/Quick arm working, but I have trouble getting your History part working - would you share the complete Item definition part?

Best nanna

Sure:

/* Alarm interface */
String Tex_UDP_Receive					"Receive UDP String [%s]"						<settings>		(gSet)					{ udp="<[192.168.3.10:*:'REGEX((.*))']" }			
String Tex_UDP_Send						"Send UDP String"								<settings>		(gSet)					{ udp=">[192.168.3.10:10000:'REGEX((.*))']" }			

/* Generic alarm items */
Number Tex_Alarm_Status								"Alarm status [MAP(tex_alarmstatus.map):%s]"									<alarm>					(gAlarm, gAlarmlogging)
Number Tex_Alarm_Partition							"Alarm Partitie [%s]"															<alarm>					(gAlarm)
String Tex_Alarm_Textline1							"Alarmklavier - lijn 1 [%s]"													<text>					(gAlarm)
String Tex_Alarm_Textline2							"Alarmklavier - lijn 2 [%s]"													<text>					(gAlarm)		
Number Tex_Alarm_User								"Gebruiker [MAP(tex_alarmusers.map):%s]"										<man_3>					(gAlarm, gAlarmlogging)
Number Tex_Alarm_ArmDisarmUser						"Gebruiker [MAP(tex_alarmusers.map):%s]"										<man_3>					(gAlarm, gAlarmlogging)
DateTime Tex_Alarm_Status_Update 					"Tijdstip wijziging alarm status  [%1$td.%1$tm.%1$tY %1$tT]"					<time>					(gAlarm, gAlarmlogging)

/* Various switches */
Switch Tex_Reset_Contacts					"Alle contacten op gesloten zetten"														<settings>		(gSet, gAlarm)
Switch Tex_QuickArm							"Snel wapenen"																			<settings>		(gAlarm)
Switch Tex_QuickArm_visibility				"Snel wapenen - visibility"																<settings>		(gAlarm)
Switch Tex_Get_LSTATUS						"Get the information on the LCD display"												<settings>		(gAlarm)

/* Waakzaam switches */
Switch Tex_Waakzaam_Status					"Waakzaam Status"		    							                                <settings>		(gAlarm)
Switch Tex_Waakzaam_CommunicatieStop		"Blokkeer communicatie"		    							                            <settings>		(gAlarm)        { expire="5m,command=OFF" }
Switch Tex_Waakzaam_SMS_Dries				"Stuur SMS naar Dries"												                    <text>		    (gAlarm)
Switch Tex_Waakzaam_TG_Dries				"Stuur Telegram naar Dries"												                <text>	    	(gAlarm)
Switch Tex_Waakzaam_SMS_Kris				"Stuur SMS naar Kris"												                    <text>	    	(gAlarm)
Switch Tex_Waakzaam_TG_Kris				    "Stuur Telegram naar Kris"												                <text>		    (gAlarm)


/* Alarm keypad */
String Tex_Alarm_Keypad					"Alarm klavier"																				<alarm>					(gAlarm)
Number Tex_Alarm_Keypad_counter			"Alarm klavier - teller"																	<text>					(gAlarm)
Switch Tex_Alarm_Keypad_visibility		"Alarm klavier zichtbaar"																	<lock>					(gAlarm)

/* Zone Status */
Number Tex_Zone_Z001						"Z01 - Sabotage Sirene [MAP(tex_contacts.map):%s]" 												<error> 		(gAlarm, gAlarmcontact)
Number Tex_Zone_Z002						"Z02 - Glasbreukdetector praktijkruimte [MAP(tex_contacts.map):%s]"								<error> 		(gKE_Praktijkruimte, gGlasbreuk, gAlarmcontact)
Number Tex_Zone_Z003						"Z03 - Glasbreukdetector garage [MAP(tex_contacts.map):%s]"										<error>			(gGV_Garage, gGlasbreuk, gAlarmcontact)
Number Tex_Zone_Z004						"Z04 - Glasbreukdetector berging [MAP(tex_contacts.map):%s]"									<error>			(gGV_Berging, gGlasbreuk, gAlarmcontact)

/* Windows */
Number Tex_Window_W01_GV_Garage_Rechts						"Raam Garage rechts [MAP(windows.map):%s]" 													<raam> 				(gAlarm, gGV_Garage, gRamen, gGV_Ramen)
Number Tex_Window_W02_GV_Garage_LinksVoor					"Raam Garage links voor [MAP(windows.map):%s]" 												<raam> 				(gAlarm, gGV_Garage, gRamen, gGV_Ramen)
Number Tex_Window_W03_GV_Garage_LinksAchter					"Raam Garage links achter [MAP(windows.map):%s]" 											<raam> 				(gAlarm, gGV_Garage, gRamen, gGV_Ramen)

/* History of last contact-changes */
String Tex_History_00				(gAlarm, gAlarmhistory)
String Tex_History_01				(gAlarm, gAlarmhistory)
String Tex_History_02				(gAlarm, gAlarmhistory)

Tkanks @Dries

I compared them to what I got and didn’t see any problems.

When the rule “History of last 10 events - part 5 - alarm status” is activated i get this error in my log, and the rule stops executing:

13:13:12.796 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule 'History of last 10 events - part 5 - alarm status': cannot invoke method public org.joda.time.DateTime org.joda.time.base.AbstractInstant.toDateTime() on null

Do you have any idea why?

The rule uses someItem.lastUpdate. You’d need a suitable persistence service working and the items persisted.
You may need to put up with it until the history gets fully populated.

@rossko57

This is the rule can you point out what to persist?

I’m using Influxdb

rule "History of last 10 events - part 5 - alarm status"

when   
   Item Tex_Alarm_Status changed

then
	var event = Tex_Alarm_Status
	var event_update = event.lastUpdate.toDateTime.toString("dd-MM-yy HH:mm")
	var event_status = transform("MAP","tex_alarmstatus.map",event.state.toString)
	var event_user = transform("MAP","tex_alarmusers.map",Tex_Alarm_ArmDisarmUser.state.toString)
          if (Tex_Alarm_Status.state != 2) {
		postUpdate(Tex_History_00, event_update + " - alarm " + event_status + " door " + event_user)
	}
end

Well, Item Tex_Alarm_Status is the Item you are trying to get lastUpdate for, so that would be a good place to start?

That’s already persisted, and I can confirm stored values.

But is your default db Influxdb? You may need to specify db in lastUpdate.
Failing that, you’ll have to break it down step by step and logInfo it out to see what is missing.

Thanks @rossko57 :slight_smile:

It works now - rr4dj was set as my default db

Hi, I would like to know how to activate a keyboard article on the Basic UI for example with the code 12345 and confirm key Y. and in case of wrong code cancel with the key x.
In practice, that makes the widget on habpanel simple.

you look at the rule example code that checks the typed code and change accordingly

What example?