Announcement

Collapse
No announcement yet.

Script help

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

    #16
    To me that string looks ok. There are other potential other issues in your script though like this section:

    Code:
    Dim  Dev_ChargeStatus as String
    Dev_ChargeStatus = hs.devicestringbyname(2536)
    Dim  Dev_EnergyAddedbyLastCharge as Double
    Dev_EnergyAddedbyLastCharge = hs.devicevalueEx(2537)
    Dim  Dev_EnergyCostLastCharge as Double
    Dev_EnergyCostLastCharge = hs.deviceValueEx(2555)
    Dim  Dev_EnergyCostKwh as Double
    Dev_EnergyCostKwh = hs.deviceValueEx(2554)
    Dim  Dev_Odometer as Integer
    Dev_Odometer = hs.deviceValueEx(2497)
    Dim  Dev_BatteryLevel as Integer
    Dev_BatteryLevel = hs.deviceValueEx(2498)
    Dim  Dev_BatteryRangeEstimated as Integer
    Dev_BatteryRangeEstimated = hs.deviceValueEx(2499)
    Dim  Dev_BatteryRangeIdeal as Integer
    Dev_BatteryRangeIdeal = hs.deviceValueEx(2500)
    Dim  Dev_BatteryRange as Integer
    Dev_BatteryRange = hs.deviceValueEx(2501)
    Dim  Dev_MilesAddedLastChargeEstimated as Integer
    Dev_MilesAddedLastChargeEstimated = hs.deviceValueEx(2539)
    Dim  Dev_MilesAddedLastChargeIdeal as Integer
    Dev_MilesAddedLastChargeIdeal = hs.deviceValueEx(2538)
    Dim  Dev_InsideTemperature as Integer
    Dev_InsideTemperature = hs.deviceValueEx(2518)
    Dim  Dev_OutsideTemperature as Integer
    Dev_OutsideTemperature = hs.deviceValueEx(2519)
    Dim  Dev_Latitude as Double
    Dev_Latitude = hs.deviceValueEx(2547)
    Dim  Dev_Longitude as Double
    Dev_Longitude = hs.deviceValueEx(2548)
    Dim  Dev_Location as String
    Dev_Location = hs.deviceValueEx(2549)
    "hs.devicestringbyname(2536)" expect a name to be passed to it, but you are passing a reference number to it. You should be using "hs.devicestring(2536)" instead. Also, for the others, you may need to do explicit conversion, where you need to convert from the Double to a String. For those where you just need the integer, use hs.deviceValue(xxxx) instead, rather than declaring it as an integer and then expecting implicit conversion from the double that's returned by deviceValueEx. Unfortunately there's no way for someone else to test your script unless they have the same plugin (which I don't). Do you have a reference to the "Insert into" command that you are using? Can you provide a link to it, as I'll double check what's needed.
    HS 4.2.8.0: 2134 Devices 1252 Events
    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

    Comment


      #17
      Originally posted by alphatech View Post
      Please see attached. I believe on the string it needs this quote " as an example would be "home"
      But for numbers, does it just need to be the number?
      HS 4.2.8.0: 2134 Devices 1252 Events
      Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

      Comment


        #18
        PS What errors are you getting in the log when you run the script?
        HS 4.2.8.0: 2134 Devices 1252 Events
        Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

        Comment


          #19
          this is the error before I made other changes. Within MySQL, if I change it to "Home" it will insert into the table fine
          Insert into teslacharge (chargestatus, energyaddedlastcharge, energycostlastcharge, energycostkwh, odometer, batterylevel, batteryrangeestimated, batteryrangeideal, batteryrange, milesaddedlastchargeestimated, milesaddedlastchargeideal, insideTemperature, outsideTemperature, latitude, longitude, location ) VALUES ('','26.18','5.95','0.23','1257','88','202','278','278','79' ,'108','86','53','42.400527','-71.217835','Home')

          Comment


            #20
            Originally posted by alphatech View Post
            this is the error before I made other changes. Within MySQL, if I change it to "Home" it will insert into the table fine
            Insert into teslacharge (chargestatus, energyaddedlastcharge, energycostlastcharge, energycostkwh, odometer, batterylevel, batteryrangeestimated, batteryrangeideal, batteryrange, milesaddedlastchargeestimated, milesaddedlastchargeideal, insideTemperature, outsideTemperature, latitude, longitude, location ) VALUES ('','26.18','5.95','0.23','1257','88','202','278','278','79' ,'108','86','53','42.400527','-71.217835','Home')
            I don't see an error message?
            HS 4.2.8.0: 2134 Devices 1252 Events
            Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

            Comment


              #21
              Sorry,
              mySQL Error Connecting to Database: Fatal error encountered during command execution.

              Comment

              Working...
              X