www.homeseer.com    
 

Go Back   HomeSeer Message Board > Developer Support > Scripts & Plug-Ins:Development and Libraries > HS3 Scripting

HS3 Scripting Discussions related to the scripting under HS3.

Reply
 
Thread Tools Display Modes
  #1  
Old January 27th, 2016, 01:48 PM
waynehead99 waynehead99 is offline
Super Seer
 
Join Date: May 2015
Location: Colorado
Posts: 1,982
Virtual Device for Battery Replacement

I am not a coder, but think I can tackle this, but wanted to get some ideas from others that might have already done this. I want to create a virtual device with just one button that updates the date when pressed. I can use this to know and keep track of the last time I replaced a battery in a device.

Is there anyone already doing this that could share, or is there a better way of dealing with this? I really just want to see if I am truly getting the battery life I think and this would be an easy way to deal with it i think.
Reply With Quote
  #2  
Old January 27th, 2016, 03:04 PM
rprade's Avatar
rprade rprade is offline
OverSeer
 
Join Date: Jan 2014
Location: Colorado
Posts: 6,959
This is simple and dirty, but how about a virtual device with a control of Reset and Not coupled with an event that changes it back to Not whenever you click or press on Reset. That would update the last change date each time you press Reset.

You possibly could eliminate the Not control by using an immediate script to set the device value back to Not.
.
Attached Images
 
__________________
Randy Prade
Aurora, CO
Prades.net

PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino
Reply With Quote
  #3  
Old January 27th, 2016, 04:35 PM
rmasonjr's Avatar
rmasonjr rmasonjr is offline
OverSeer
 
Join Date: May 2001
Location: Brookhaven, MS USA
Posts: 6,526
Not a script or separate device, but I use the Battery's Notes section to track battery replacement. Here's one Multisensor Battery device I have:
Attached Images
 
__________________

HS3Pro Running on a Raspberry Pi2 (Raspbian)
64 Z-Wave Nodes, 162 Events, 293 Devices
UPB modules via OMNI plugin/panel
Plugins: Z-Wave, BLRF, OMNI, HSTouch, weatherXML, EasyTrigger
HSTouch Clients: 3 Android, 1 Joggler

Last edited by rmasonjr; January 27th, 2016 at 04:36 PM. Reason: added screenshot
Reply With Quote
  #4  
Old January 27th, 2016, 04:41 PM
waynehead99 waynehead99 is offline
Super Seer
 
Join Date: May 2015
Location: Colorado
Posts: 1,982
Thanks Guys, I didn't even know there was a notes section .

Randy, I think I will do your idea that way I can just do it from my phone when doing the change.

Thanks again.
Reply With Quote
  #5  
Old January 28th, 2016, 12:46 AM
mikedr mikedr is offline
Seer Master
 
Join Date: Oct 2004
Location: Seattle and Phoenix
Posts: 1,197
Yeah, what I was going to suggest is a virtual device, along with a timer. When you click reset on the virtual device, it sets the virtual device to "OK" and sets the timer. As the timer gets closer to the date when it needs to be replaced, it'll set the virtual device to "low," etc.

I'm going to be adding a similar virtual device for a filter changeover for the HVAC.
Reply With Quote
  #6  
Old January 28th, 2016, 06:41 PM
waynehead99 waynehead99 is offline
Super Seer
 
Join Date: May 2015
Location: Colorado
Posts: 1,982
Ok so I combined a couple ideas with a script, I put together what I wanted. Again, I just wanted to have a button to click when I replaced a battery in a device so that I know when I did it last. I also wanted to be able to do this from HSTouch on my phone, and be able to view it from HSTouch (without having to use #script as it creates so many issues, and that is the only way to get last updated to show). I am not a coder at all, so be gentle as I hacked this together from other scripts , but it is working.

I created this script (not sure if you can call it a script... just a couple of lines):
Code:
Sub Main(ByVal Parms As String)

Dim ParmArray() As String = Split(Parms,",")

Dim Device_ID As String = ParmArray(0)

hs.SetDeviceString(Device_ID, Now, True)

End Sub
From there I created a virtual device with only a button called reset. I then created an event that passes the reference ID to the script whenever the reset button is pressed. You would have to create an event for each device you wanted to update this way and just change the device ID that gets passed in the parm section.

There may be a cleaner way of doing this, but this worked with my limited skills and I can easily work with this from HSTouch.
Attached Images
  
Reply With Quote
  #7  
Old January 28th, 2016, 06:54 PM
Steve Q's Avatar
Steve Q Steve Q is offline
OverSeer
 
Join Date: Jun 2005
Location: Michigan
Posts: 3,665
Seems a little complicated. I have been entering the new battery install date in the "notes" box for the device. It's pretty easy. I have about 40 battery operated devices. I don't think I want to add 40 more devices to HS3.


Sent from my iPad using Tapatalk
__________________
HomeSeer Version: HS3 Pro Edition 3.0.0.368, Operating System: Microsoft Windows 10 - Home, Number of Devices: 373, Number of Events: 666, Enabled Plug-Ins
2.0.83.0: BLRF, 2.0.10.0: BLUSBUIRT, 3.0.0.75: HSTouch Server, 3.0.0.58: mcsXap, 3.0.0.11: NetCAM, 3.0.0.36: X10, 3.0.1.25: Z-Wave,Alexa,HomeKit
Reply With Quote
  #8  
Old January 28th, 2016, 07:00 PM
waynehead99 waynehead99 is offline
Super Seer
 
Join Date: May 2015
Location: Colorado
Posts: 1,982
Yea it probably is, but part of my HA stuff is for me to learn new things. I also don't have that many devices (just 12 roughly). Also you can't touch the notes from HSTouch... I try to make it so I don't have to get into the web interface as much as possible to do things.
Reply With Quote
  #9  
Old January 28th, 2016, 09:17 PM
TomTom's Avatar
TomTom TomTom is offline
Seer Master
 
Join Date: Apr 2012
Location: USA
Posts: 1,402
Wayne, I like the idea and thought process. This can be used for other things too like my chlorinator, salt for water softener, Ac filter, etc. Nice work!


Sent from my iPhone
__________________
Tom
baby steps...starting again with HS3
HS3Pro: Z-NET & 80 Z wave Devices,
HSTouch: 4 Joggler (Android Kitkat), 2 iPhone, 3 iPads
Whole House Audio: 5 SqueezePlay Jogglers w Bose Speakers
In The Works: 10 Cameras Geovision, new Adecmo/Envisalink Alarm, Arduinos
System: XP on Fanless Mini-ITX w/ SSD
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Replacement Variable To Identify Device sblamjo HS3 Scripting 11 March 18th, 2018 10:17 AM
Question about Insteon Mini Remote battery replacement mrceolla Lighting & Primary Technology Discussion 1 December 18th, 2015 02:15 PM
Replacement variables in device triggers? travisdh HS3 / HS3PRO Discussion 2 January 3rd, 2015 04:49 AM
HS3 Script Syntax to copy one virtual device status string to another virtual device pjohnson HS3 Scripting 8 December 31st, 2014 02:48 PM


All times are GMT -4. The time now is 02:34 AM.


Copyright HomeSeer Technologies, LLC