Vera HTTP Post to Home Assistant HTTP Sensor

Hey, so I set up an restful get sensor to get the last code used on my Z-Wave lock, using this uri: http://local.IP:3480/data_request?id=variableget&DeviceNum=5&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=sl_UserCode
I know it polls frequently since, whenever I look at my vera devices, it shows the lock is busy.

Does anyone know LUA or LUUP well enough to help Vera post the variable’s state to home assistant whenever the door is unlocked? I noticed my lock’s battery dropped like 5% in the last day.

I set up a temporary pin code on home assistant, and I use that variable to auto clear the code after it’s been used.

Hi!
Is´nt all that covered with the Vera component?

Hey, not really, it doesn’t show attributes like the lock code or anything. I’m trying to get Vera to POST the variable value to home assistant, and I do not know LUA/LUUP at all…

Nevermind, I set up a variable container in Vera, and every time the lock is unlocked by a pin code, it updates the container with the usercode and battery level. That way it doesn’t poll my lock too often and I pointed my rest sensor to the container

how did you get this to work? i can’t for the life of me get vera to update the variable string (i’m using multistring since variable container apparently no longer exists)…

it seems i can’t even get the scene or PLEG to trigger when the door is unlocked…

Hey, I used multistring too, then just created a scene to execute the following code:

local locklastusercode = luup.variable_get("urn:micasaverde-com:serviceId:DoorLock1", "sl_UserCode", 5)
local lockbatterylevel = luup.variable_get("urn:micasaverde-com:serviceId:HaDevice1", "BatteryLevel", 5)

luup.variable_set("urn:upnp-org:serviceId:VContainer1", "Variable1",locklastusercode, 24)
luup.variable_set("urn:upnp-org:serviceId:VContainer1", "Variable2",lockbatterylevel, 24)

rest_commands

  clear_lock_code:
    url: !secret clear_lock_code
    method: post
  set_lock_code:
    url: !secret set_temp_lock_code
    method: post
  remove_temp_lock_code_history:
    url: !secret remove_lock_code_history
    method: post

Then for the automations, I used

- id: set_temp_lock_code
  alias: 'Temporary Lock Code'
  initial_state: False
  trigger:
    - platform: state
      entity_id: input_text.lock_code_temp
  condition:
    - condition: template
      value_template: "{{ not is_state('input_text.lock_code_temp', 'Code') }}"
  action:
    - service: rest_command.set_lock_code
      data_template:
        templockcode: "{{ states.input_text.lock_code_temp.state }}"
    - delay:
        seconds: 5
    - service: input_text.set_value
      data:
        entity_id: input_text.lock_code_temp
        value: 'Code'
    - service: input_boolean.turn_on
      data:
        entity_id: input_boolean.temp_lock_code_set
    
- id: temp_lock_code_used
  alias: 'Temporary Lock Code Used'
  initial_state: False
  trigger:
    - platform: state
      entity_id: sensor.last_lock_code_name
      to: 'Temp'
  condition:
    - condition: state
      entity_id: input_boolean.temp_lock_code_set
      state: 'on'
  action:
    - service: script.turn_on
      entity_id: script.clear_lock_code

and script:

clear_lock_code:
  alias: Clear Lock Code
  sequence:
    - service: rest_command.clear_lock_code
    - service: rest_command.remove_temp_lock_code_history
    - service: input_boolean.turn_off
      data:
        entity_id: input_boolean.temp_lock_code_set
1 Like

I have tried to get this working, I do get the scene to update the MultiString value with the status of the unlocked door in Vera.

But I think I don’t follow how to get the data from the MultiString container into HASS? How do you pull the stored data from the MultiString plugin?

Any Help is appreciated! :slight_smile: Thanks!

Hey, sorry for the delay, I might have to be a bit vague here to no give out my lock info to the internet, but I created a rest command (post) using the following URL type:
Clear lock code:
http://[Local IP]:3480/data_request?id=action&DeviceNum=[Lock Device Number]&serviceId=urn:micasaverde-com:serviceId:DoorLock1&action=ClearPin&UserCode=[Slot Number on the Lock to Clear]
Set Lock Code:
http://[Local IP]:3480/data_request?id=action&DeviceNum=[Lock Device Number]&serviceId=urn:micasaverde-com:serviceId:DoorLock1&action=SetPin&UserCodeName=[Code User Name]&user=[Pin Code Slot]&newPin={{ templockcode }}

To See the Last one Used:
http://[Local IP]:3480/data_request?id=variableget&DeviceNum=[Container Number - In my case, 24]&serviceId=urn:upnp-org:serviceId:VContainer1&Variable=Variable1

quote:
“Set Lock Code:
http://[Local IP]:3480/data_request?id=action&DeviceNum=[Lock Device Number]&serviceId=urn:micasaverde-com:serviceId:DoorLock1&action=SetPin&UserCodeName=[Code User Name]&user=[Pin Code Slot]&newPin={{ templockcode }}”
unquote

From the above quote it would suggest you have been able to pass on an HA entity state value to VERA. I’m trying to accomplis the same using the following example:

http://localIP:3480/data_request?id=variableset&DeviceNum=[devive nr]&serviceId=urn:micasaverde-com:serviceId:HumiditySensor1&Variable=CurrentLevel&Value={{states(“sensor.br_humidity”)}}

The only result I get in vera is {{states(“sensor.br_humidity”)}} as value and not its true value. To confirm the http works, I put in a dummy value for humidity which is getting across. Hence I can only suspect it may be a syntex error. If so where? Any help would be appreciated.