[SOLVED] BasicUI - keypad

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?

the keypad values need to be concatenated.

@Dries
Hi, I was unable to create what I needed. You can help me. I only need this function.
1-Code 12345
Alarm switch ON
2-Code 12346
Switch Alarm OFF

If you could kindly compile me a complete example with Item, Sitemap and Rules.