No announcement yet.

Echo Skill Helper for Homeseer 3 - formatting numbers to be used in Alexa Response

  • Filter
  • Time
  • Show
Clear All
new posts

    Echo Skill Helper for Homeseer 3 - formatting numbers to be used in Alexa Response

    Is there a way to format numbers that are used in the Alexa Response field. For example, I have Alexa speaking the room temperature by using [DeviceValue 21]. However, the value is often something like 74.9. I'd like Alexa to read that as a rounded number of 75. I've tried Round ([DeviceValue 21],0), but Alexa actually reads the word "round". Is there a way to do this?


    Unfortunately, there is nothing built in to do this.

    You can however write a small script to return the rounded device value using the [scriptfunc] tag. Let me know if you would like some help with this.


      Hi Jon. Thank you for the fast reply and offer to help. I would like to take you up on that if it’s okay. I’m still a scripting novice and spend a crazy amount of time just trial and error developing small pieces of code.

      So so the situation I have is that I use a Response Trigger to catch the desired trigger. And I currently use Instant Scripting of that Response Trigger to preform the desired action. The instant script reads:

      &hs.CAPIControlHandler(hs.CAPIGetSingleControl(23,false,CStr (hs.devicevalue(23)+2),false,true))

      This code increase the thermostat set point 2 degrees. I have a 1000ms delay in the Response Trigger. If I add a small script in the same response trigger, when does that get executed Dash before or after the immediate script? I guess on that same note, is it possible to have lots of actions on the same response trigger like CAPI control, SetDevice, etc. in what order would they be executed?

      Thanks again for your help and all your hard work supporting this community!


        Yes you can have multiple actions. They should run simultaneously.

        Try this script:

        Function Main (ByVal Parm As Object) As String
            hs.CAPIControlHandler(hs.CAPIGetSingleControl(23,false,CStr (hs.devicevalue(23)+2),false,true))
            hs.waitsecs (0.05)
            Return hs.DeviceValue(23)
        Catch Ex As Exception
        End Try
        Return "Error"
        End Function
        Save it as Tstat.vb in your scripts directory.

        Set up your response trigger as shown below:

        Click image for larger version  Name:	ts.PNG Views:	0 Size:	14.0 KB ID:	1322096

        As you can see, I've incorporated your CAPI code so you can remove it as an immediate script entry.

        Make sure you select the script name starting with $

        hs.DeviceValue will only return Integers, whereas hs.devicevalueEx will return values with a decimal point (as used by my replacement tags)