Announcement

Collapse
No announcement yet.

Battery reset button

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Corvl1
    replied
    *edit* : got it; there needs to be 2 scripts in the scripts folder:
    battery_reset.vb & battery-reset-button.vb

    I only had the button-script

    Thanks,
    Cor


    Leave a comment:


  • rge
    replied
    Is there anything in the log?

    Leave a comment:


  • Corvl1
    replied
    Thank you,

    I did as you described in your last post. I do get the reset button ( I tried a fibaro window -door sensor and a popp smoke detector) , but when I click the "reset" button , nothing happends.
    Click image for larger version

Name:	2020-08-30 11_51_01-Devices.jpg
Views:	77
Size:	39.7 KB
ID:	1415272

    Thanks,
    Cor

    Leave a comment:


  • rge
    replied
    Originally posted by Corvl1 View Post
    I would like to try/use this as well (all my smoke detectors say 0%).

    What do I do with the [CODE]
    hs.DeviceScriptButton_AddButton(REF, "Reset", 1.0, "battery_reset.vb", Nothing, Nothing, 1, 1, 1)
    [CODE]

    Do I insert this in an event?

    Thanks,
    Cor
    1. Make sure the battery_reset.vb script is in your scripts folder.
    2. Run that command for each device, either in an event or in the Script Commands / Control Panel option from the UI - replacing "REF" with the reference of your device.

    If you're using HS4, unfortunately it forgets them on restart - but for that you can put it in a startup event to recreate them (see https://forums.homeseer.com/forum/ho...artup-shutdown).

    I have another script which helps with that - it takes a comma separated list of device IDs as a parameter and creates a button for each.

    battery-reset-button.vb
    Code:
    Sub Main(parms as object)
      Dim p() As String = CStr(parms).Split(",")
    
      For Each ref as String in p
        hs.WriteLog("Script", "Setting battery reset button device " & ref)
        hs.DeviceScriptButton_AddButton(CInt(ref), "Reset", 1.0, "battery_reset.vb", Nothing, Nothing, 1, 1, 1)
      Next
    End Sub
    Click image for larger version

Name:	Capture.PNG
Views:	104
Size:	199.1 KB
ID:	1414435

    Leave a comment:


  • Corvl1
    replied
    I would like to try/use this as well (all my smoke detectors say 0%).

    What do I do with the [CODE]
    hs.DeviceScriptButton_AddButton(REF, "Reset", 1.0, "battery_reset.vb", Nothing, Nothing, 1, 1, 1)
    [CODE]

    Do I insert this in an event?

    Thanks,
    Cor

    Leave a comment:


  • rge
    replied
    Originally posted by srodgers View Post
    Just restarted and again the reset button disappear. I like this mod so will try adding the script line for adding the reset button to the startup.vb t restore them after each restart unless there is a better way.
    Thanks for the info - I hadn't restarted HS4 since I re-added my buttons and see the same thing, they all disappear :-(

    Will have to do the same with the startup.

    Leave a comment:


  • srodgers
    replied
    Just restarted and again the reset button disappear. I like this mod so will try adding the script line for adding the reset button to the startup.vb t restore them after each restart unless there is a better way.

    Leave a comment:


  • srodgers
    replied
    New problem. I updated to HS4 V4.1.4.0 and When HS4 restarted all the battery reset buttons were gone. Does this change persist across restarts or did the HS update kill this mod?

    Leave a comment:


  • rge
    replied
    Originally posted by srodgers View Post
    Figured out the problem. You have a extra ")" at the end of the add button script command. Should be:

    Code:
    hs.DeviceScriptButton_AddButton(REF, "Reset", 1.0, "battery_reset.vb", Nothing, Nothing, 1, 1, 1)
    Thanks for the correction.

    Leave a comment:


  • srodgers
    replied
    Figured out the problem. You have a extra ")" at the end of the add button script command. Should be:

    Code:
    hs.DeviceScriptButton_AddButton(REF, "Reset", 1.0, "battery_reset.vb", Nothing, Nothing, 1, 1, 1)

    Leave a comment:


  • srodgers
    replied

    Tried this and go this error on HS4. Used the Script Commands in the Tools Menu. HS added the "&".

    8/21/2020 11:26:07 PM
    HomeSeer
    System
    Control Panel Immediate Script: &hs.DeviceScriptButton_AddButton(214, "Reset", 1.0, "battery_reset.vb", Nothing, Nothing, 1, 1, 1))

    8/21/2020 11:26:07 PM

    HomeSeer
    Error
    Running script(2) &hs.DeviceScriptButton_AddButton(214, "Reset", 1.0, "battery_reset.vb", Nothing, Nothing, 1, 1, 1)), init error: Syntax error



    Leave a comment:


  • rge
    started a topic Battery reset button

    Battery reset button

    I have a number of Z-Wave devices which report battery status, but they only do so when it changes and tend to miss when a new battery is installed.

    Here are two scripts which will add a "Reset" button to the battery device, which then calls a script to set the value to 100(%).

    Put this script in yous scripts folder, named battery_reset.vb, to be called by the button:

    Code:
    Sub Main(parms as object)
      Dim ref as Integer = CInt(parms(0))
    
      hs.WriteLog("Script", "Battery reset button device " & ref)
    
      hs.SetDeviceValueByRef(ref, 100, true)
    End Sub
    For each battery device, use this command in Script Commands (HS4) or Control Panel (HS3), replacing REF with the device reference:

    [CODE]
    hs.DeviceScriptButton_AddButton(REF, "Reset", 1.0, "battery_reset.vb", Nothing, Nothing, 1, 1, 1)
    [CODE]
Working...
X