Announcement

Collapse
No announcement yet.

ZWave Device Status String on MQTT

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

  • ZWave Device Status String on MQTT

    Hi,
    I am new to Homeseer scripting and I am trying to publish my ZWave devices on MQTT.

    Click image for larger version

Name:	doorlockdevice.PNG
Views:	138
Size:	88.6 KB
ID:	1308132
    Click image for larger version

Name:	sensor.PNG
Views:	80
Size:	131.7 KB
ID:	1308133
    Click image for larger version

Name:	bathroom_light.PNG
Views:	71
Size:	67.0 KB
ID:	1308134

    I am successful in publishing in values but the status values are published as integers.

    mosquitto_sub output:

    zwave/bathroom/light/security 8
    zwave/bathroom/light/security 0
    zwave/bathroom/light/security 8
    zwave/bathroom/light/security 0
    zwave/bathroom/sensor/security 0
    zwave/bathroom/light/security 8
    zwave/bathroom/sensor/security 8
    zwave/bathroom/light/security 0
    zwave/bathroom/light/security 8
    zwave/bathroom/light/security 0
    zwave/door_lock/door_lock_status 128
    zwave/door_lock/door_lock_status 64
    zwave/bathroom/sensor/security 0
    zwave/bathroom/light/level 0
    zwave/bathroom/sensor/temperature 68.9
    zwave/bathroom/sensor/humidity 71
    zwave/bathroom/sensor/luminance 2
    zwave/door_lock/door_lock_status 128
    zwave/door_lock/door_lock_status 64
    zwave/door_lock/door_lock_status 128
    zwave/door_lock/door_lock_status 64
    I assume there is some database entry somewhere for those strings but there isn't a lot of documentation. I tried writing a script trying to set a virtual device value with the string but I have an error using the hs.setdevicevaluebyref function.

    Code:
    &dim d
    dim str
    dim dvref
    
    dvref = hs.GetDeviceRefByName("ACN")
    hs.writelog "device ref", dvref
    
    d = hs.devicevaluebyname("Access Control Notification")
    
    hs.writelog "device string", hs.DeviceStringByName("Access Control Notification")
    hs.writelog "device value", d
    
    Select Case d
        Case 1
           str = "Manual Lock"
        Case 2
           str = "Manual Unlock"
        Case 3
           str = "RF Lock"
        Case 4
           str = "RF Unlock"
        Case 5
           str = "Keypad Lock"
        Case 6
           str = "Keypad Unlock"
        Case 9
           str = "Auto Lock Locked"
        Case 11
           str = "Lock Jammed"
        Case Else
           str = "Unassigned"
    End Select
    
    hs.writelog "operation string", str
    
    hs.setdevicevaluebyref(dvref, str, True))
    What would be the best way to get that string into a device value that the MQTT plugin could use?

  • #2
    You will likely find it easier to accomplish with mcsMQTT as it is tightly integrated with HS. It is just point and click.

    If you want to do it with scripting then look into methods associated with Value Status Pairs

    Comment


    • #3
      Thanks Michael,
      I installed your plugin and I'm trying to get up to speed with it.

      Comment


      • #4
        Originally posted by pmendiuk View Post



        I assume there is some database entry somewhere for those strings but there isn't a lot of documentation. I tried writing a script trying to set a virtual device value with the string but I have an error using the hs.setdevicevaluebyref function.
        hs.setdevicevaluebyref requires an integer to be passed to it, not a string. Also your script seems to use a combo of vb.net and vbscript. A lot of the examples in the help file still use vbscript, but most recent scripts found on the board are in vb.net. Are you saving the script file with a .vb extension or .txt? .vb is what HS expects for vb.net and .txt for vbscript.
        HS 3.0.0.548: 1990 Devices 1172 Events
        Z-Wave 3.0.1.262: 126 Nodes on one Z-Net

        Comment


        • #5
          I was just running it in the control panel.

          Comment


          • #6
            I loaded up tenScripting, tenScriptAid and tenHsEvents. Those utilities are fantastic. That level of functionality should be integrated into Homeseer.

            Comment

            Working...
            X