Announcement

Collapse
No announcement yet.

One-liner for device status

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

  • Michael McSharry
    replied
    That worked thanks - interestingly it only pickups the integer part of the number, not the decimal places which seem to be there. not a big deal as I’m trying to capture big variations of a volt or more, but technically intriguing why it chops off the decimals.
    Legacy from the original HS. You can get the number from the value property of the device, but if you want to use the script command DeviceValue then it returns the integer as was done in the original HS.

    Substitution variable is $$DSR colon (99) colon. I do not think it will work as substitution variables were not discussed in the scripting help guide.

    Leave a comment:


  • oserani
    replied
    Originally posted by TC1 View Post
    More importantly, if you want to track data over a long term why not just use one of the data collection and charting plug-ins that are available for free, like Jon00 Charting? I've got several charts and databases tracking changes in temp, humidity, or anything else that changes over time. The database is setup to automatically log the time-value pairs whenever a device value changes. One can then easily plot these variations against other things that change in the environment over time.
    And why didn’t I think of going to Jon’s stuff which has saved my hide so many times... Thanks. Will try that - maybe from a windows machine, getting the device over from the Pi with Jon’s HSgateway so I’m not putting more stuff on the already overloaded pi.

    Leave a comment:


  • oserani
    replied
    Originally posted by zwolfpack View Post
    If you want the numeric value, try hs.DeviceValue(dvRef).
    That worked thanks - interestingly it only pickups the integer part of the number, not the decimal places which seem to be there. not a big deal as I’m trying to capture big variations of a volt or more, but technically intriguing why it chops off the decimals...

    Leave a comment:


  • oserani
    replied
    Originally posted by Michael McSharry View Post
    The status is not a direct property like value and string. HS has provided substitution variables for event actions. I do not know if they would work with script one-liner or not. I suspect not, but you could try &nhs.writelogex("Voltage",$$DSR99):,"")
    Tried that - although I’m struggling with what the little sad icon is supposed to be. I’m getting a compile/runtime error with $$DSR:99:

    Leave a comment:


  • TC1
    replied
    More importantly, if you want to track data over a long term why not just use one of the data collection and charting plug-ins that are available for free, like Jon00 Charting? I've got several charts and databases tracking changes in temp, humidity, or anything else that changes over time. The database is setup to automatically log the time-value pairs whenever a device value changes. One can then easily plot these variations against other things that change in the environment over time.

    Leave a comment:


  • zwolfpack
    replied
    If you want the numeric value, try hs.DeviceValue(dvRef).

    Leave a comment:


  • Michael McSharry
    replied
    The status is not a direct property like value and string. HS has provided substitution variables for event actions. I do not know if they would work with script one-liner or not. I suspect not, but you could try &nhs.writelogex("Voltage",$$DSR99):,"")

    Leave a comment:


  • oserani
    started a topic One-liner for device status

    One-liner for device status

    I was just starting to get comfortable with HS3 and HAD to migrate to HS4 as my pi card was getting full so I was due.... for a newbie when it comes to scripting. I am trying to figure out what its the HS4 one-liner to write to the log is. Trying to catch voltage variations in my house which are triggering the generator unexpectedly... and I thought this would be simple but can't get a command that works.

    Simple event - manually run for know one-liner:
    Execute the command:
    &nhs.writelogex("Voltage", hs.Devicestatus(99),"")

    where 99 is the ID of the (child) device that contains VALUE = 123.827 and STATUS = 123.827 Volts. I know that hs.Devicestatus(99) is the wrong command. What should it be? I got &nhs.writelogex("Voltage", "This should be a var","") to work, but figuring out how to populate the second text element with the dynamic voltage in the device is stomping me.

    Thanks for the patience for the "new" old guys as usual.



Working...
X