Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

[Virtual Device] UPS Status


Lambik

Question

Hi to you all!

This Virtual device can check values from an UPS connected to a Synology NAS (or even to any NUT-server, didn't check that).
The principle is simple. A Synology uses NUT (

Please login or register to see this link.

) for communicating to an UPS and reporting to other Synology's.

With a Virtual Device you can setup a TCP communication on port 3493 and receive variables about the status of the connected device. I made a Virtual Device which you can use and made an icon to go with it.

Preparations
Synology Preparations:
First of all you need to prepare the Synology (the one where the UPS is connected to) to accept the HC2 to communicate:
- Log on In the DSM as admin and go to: Control Panel --> Hardware & Power --> UPS (tab)
- Check 'Enable network UPS server'
- Click on button 'Permitted DiskStations' and add in the pop-up window the IP-address of your HC2. Confirm with the 'OK'-button
- When the pop-up is closed, click on the 'Apply'-button.
Note: If you have Firewall enabled it is not necessary to add the 3493 port.

HC2 preparitions:
- Add three Global Variables called "VD_UPS_Instance" (to block more then one instances of the Virtual Device running and store status of communication), "VD_UPS_Battery_Lev" (for storing battery level) and 'VD_UPS_Battery_RT' (battery runtime in seconds)
- Import the Virtual Device (attached to this posting)
- Change the Virtual Device IP-Address setting to match the IP of your Synology/NUT-server
- Change the Virtual Device Port setting to match the TCP-communicationport of your Synology/NUT-server (should be 3493 in most cases)

Modding:
In the Virtual Device are variables which can be changed to your needs if necessary. If you want another value read from the UPS-server, check

Please login or register to see this link.

for the different commands.
You can also use Telnet and use the command

Please login or register to see this code.

You get a list of all variables available which van be used in the Virtual Device bij altering line 11 from the 'Check Battery Level'-button :

Please login or register to see this code.

Also if you want more functions just copy the code to a new VD-button and change the variables of your choice.

The debug Window shows what the VD is doing. If everything is working to your satisfaction, you can disable the debug messages by setting 'false' to the line (4)

Please login or register to see this code.

In the main loop you can find some additional info if needed.

 

 

Added:

7 March 2015 V0.3:

- Function to check status every 5 minutes

- Change icon depending battery level

- Batterytime left in seconds



If you suggestions, remarks or questions, don't hesitate to post. If I can I will help. Well, I will give it a try...

Please login or register to see this image.

/emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />
Have Fun!!

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this link.

Link to comment
Share on other sites

16 answers to this question

Recommended Posts

  • 0

Nice little virtual device works here nice!

Only thing I would have is the current battery level set as the label or an auto refresh every minute?

But otherwise well done buddy!

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Thanx mate!

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    The reason I didn't do that is because anyone could make there own VD from the Global Variable. The update could be easily done by creating a scene which does the trick (see attachment).

    Anyway, because this just the first version of the VD I will take your suggestion very serious. So I try to program your wish into the next version.

    Please login or register to see this image.

    /emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

    I will try to do this during this week and report here when done...

    Thank you for responding, it's highly appreciated!

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    i changed the code to check using lua and removed a lot of the testing labels would rather just see the percentage drop 100% 99% etc...

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    But the base of the code i than you for very much!

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • and removed a lot of the testing labels

    You can set the variable debug = true to false, so debug-messages are disabled in the debug window.

    I take your idea and add some code you're asked for. Also I will try to make some icons which correspond with battery levels.

    Link to comment
    Share on other sites

    • 0

    Hi,

    This is another solution:

    Please login or register to see this link.

    The virtual device show:

    Temperature NAS

    Status Fan NAS

    Status Fan CPU NAS

    Status HDD1

    Status HDD2

    Temperature HDD1

    Temperature HDD2

    Battery Charge UPS

    Load UPS

    Thanks.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi,

    This is another solution:

    Thanks for the link!

    They have an other approach. They made a linux script to send SMTP values to the HC2.

    It's a way to do it but you have to ssh into the Synology and I want to keep it simple without modding the Synology.

    Although it has some interesting code I can use as example for later projects...

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    [ Added: 2014-09-21, 17:37 ]

    Just some other status Icons.....

    [ Added: 2014-09-21, 23:28 ]

    In progress....

    Please login or register to see this image.

    /emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Posted V0.3.

    Edited first post.

    Link to comment
    Share on other sites

    • 0

    i have 2 questions:

     

    - I have set the icon id's in the main loop. Somehow when the main loop sent the pressbutton command it will also change icon to the standard virtual device icon? is this normal?

     

    - the virtual device was somehow stuck because the global variable "VD_UPS_Instance" was set to 2. After changing manually to zero it restarted again. 

     

    For the rest many thanx for this virtual device!

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • i have 2 questions:

     

    - I have set the icon id's in the main loop. Somehow when the main loop sent the pressbutton command it will also change icon to the standard virtual device icon? is this normal?

     

    - the virtual device was somehow stuck because the global variable "VD_UPS_Instance" was set to 2. After changing manually to zero it restarted again. 

     

    For the rest many thanx for this virtual device!

    Your welcome!

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

     

    To answer your questions,

    1 - change the button icons to the one with the magnifying glass

    2 - I also noticed that. Happens when updating your HC2 to a newer firmware.

    Please login or register to see this image.

    /emoticons/default_icon_redface.gif" alt=":oops:" />

    Link to comment
    Share on other sites

    • 0

    thank you that explains all

    is there also possibility to check the list thru the vd?

    changed the tcp command without succes to list var in the hope expecting the entire response in the debug view

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • You can do a telnet session connecting your Synology on port 3493.

    Please login or register to see this code.

    Then give command:

    LIST VAR UPS

    (be aware you use capital letters)

     

    Then you see all of the variables and their actual values.

    Link to comment
    Share on other sites

    • 0

    thanx 

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0

    @Lambik with the release of 4.081 the below came available

    HomeCenter.SystemService.shutdown()  

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" /> 

    Link to comment
    Share on other sites

    • 0

     

    If you suggestions, remarks or questions, don't hesitate to post. If I can I will help. Well, I will give it a try...

    Please login or register to see this image.

    /emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

    Have Fun!!

     

    Nice one!

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • @Lambik with the release of 4.081 the below came available

    HomeCenter.SystemService.shutdown()  

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" /> 

    Thanks for reporting!

     

    For now I wouldn't implement this, unless there will be a solution to start up the HC2 again. A Wake On LAN would be nice...

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...