Announcement

Collapse
No announcement yet.

How to set Device 0-255 based on Percent 0-100?

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

  • How to set Device 0-255 based on Percent 0-100?

    I would like to set the brightness of a device based on the setting of a dimmer switch.

    The problem is that the dimmer has a value of 0-100 (Percent) and the device takes a value of 0-255. (Basically the device value should be set to 2.55*DimmerControl.)

    What is the typical solution for this problem? This much be a very common situation that others have a standard, good solution to.

  • #2
    I would use the "EasyTrigger: Set Device to Expression" action with the following formula

    Code:
    2.55 * $$DVR:123:
    where 123 is the ref of the dimmer device.
    you may also need to add the Round function if the device only accepts integer values:

    Code:
    Round(2.55 * $$DVR:123:)
    Last edited by spud; October 21st, 2018, 01:26 PM.

    Comment


    • #3
      Where do I get this "Ref" number? Is it the "Node" number? Is it the "Address" field?

      Dod you mean : ) at the end instead of a smiley face?

      Comment


      • #4
        Where did you pull the "Round ()" function out of the hat from? That is, is this documented, and where? Where would I find a list of these functions that can be used in expressions?

        Comment


        • #5
          The Round function is described in the help guide under Action to control a device using an expression.

          The RefID of a device is shown on its "Advanced" tab

          Click image for larger version  Name:	Capture3.PNG Views:	1 Size:	27.9 KB ID:	1254148
          and can be shown in the device manager, by enabling it in Settings under Custom

          Click image for larger version  Name:	capture.png Views:	1 Size:	59.3 KB ID:	1254146

          Click image for larger version  Name:	Capture1.PNG Views:	1 Size:	37.2 KB ID:	1254147


          As far as replacement variables, Spud put a link under the action in the Event Manager showing the choices here. It is the board that changed Spud's text into a Smiley. The old board allowed us to disable smileys, the new one does not. What Spud wrote was
          PHP Code:
          Round(2.55 * $$DVR:123:) 
          It is important to know that HomeSeer only looks at RefID to identify a device. The Address and Code are archaic and leftover from X10, they are no longer used. While Address is still used for Z-Wave, the better way to address the Devices is still through the RefID.

          It is also important to note that Devices are only evaluated by Value, the String and Status text are just for users. Easy Trigger can trigger on and manipulate the String values, but they are not used elsewhere in HomeSeer.

          When converting from one device range to another, it is simple math. If the device is 1-255 and you want to convert it to a range of 1-100, multiply the device by 100/255, to convert from a device with a range of 1-100 to a range of 1-255 multiply it by 255/100 (this is the 2.55 Spud used). This math works on any range.
          Last edited by rprade; October 21st, 2018, 09:19 PM.
          Randy Prade
          Aurora, CO
          Prades.net

          PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

          Comment


          • #6
            Originally posted by SeattleDavid View Post
            Where did you pull the "Round ()" function out of the hat from? That is, is this documented, and where? Where would I find a list of these functions that can be used in expressions?
            I have just added a topic about available operators and expressions: https://forums.homeseer.com/forum/ul...in-easytrigger

            Comment


            • #7
              Thanks Spud

              Comment


              • #8
                Thanks. Looks great.

                Comment

                Working...
                X