I’ve put a first pass driver out on my test channel.
Name: Edge Utility Device V1
Version: 2022-08-21T04:40:53.23049633
Enroll your hub and choose the driver above from the list to install.
Once the driver is on your hub, the next time you run a Scan for nearby devices, you should get a new device created in your ‘No room assigned’ room.
When you open the device you’ll see that it provides both functions you were looking for: a duration for how long the switch is on (Main component), and a counter for how many times the momentary button is pressed (Counter component). There are also reset buttons in both components, and a button to create additional devices.
First, go into device Settings via the 3 vertical-dot menu in the upper right:
- Duration Resolution - choose the granularity you want
- Duration Auto-Update Frequency - this determines how often the driver keeps the duration value current; this will depend on your needs.
- Contact sensor Behavior - I included a contact in the main component as a companion to the switch in case you prefer it.
- Profile Icon - will allow you to change the icon and category of the device to suit your needs (I haven’t implemented this yet)
Operation
On the device Controls screen, turning on the switch will update the contact sensor state per your preferences and begin the duration tracking and auto-updating of the duration field. The duration field will show the value in the units you chose in settings (seconds, minutes, hours, etc). Turning the switch off will reset the duration to 0 and terminate the auto-updating. If you want to refresh the fields between auto updates, just perform the swipe-down action on the screen.
Tapping the reset button with the switch on causes the tracking to start over at 0.
The ‘create another device’ button does just that - if you need multiple of these devices. Each will need to be uniquely configured in settings.
In the Counter component, each time you tap the momentary button, the counter simply increments by 1. Tapping reset will set it back to 0.
Note there is a problem currently with some iOS apps not showing the correct field labels or units. (The duration field should show both the number and units but doesn’t for me at the moment). Don’t know if you’ll see this or not.
Duration and counter fields are available as IF conditions in automation routines.
To be discussed:
- duration value is an integer - is this ok?
- duration calculation persists through driver restarts when the switch is ON
- counter gets reset to 0 any time the driver is restarted
- dashboard: action is the switch; do we need option to change this to the momentary button?; state shown is also the switch; do we need options to display duration or counter values instead?