Control the status of a virtual contact switch

devices
integration

(Carter) #1

I am trying to set the status of a contact sensor using my raspberry pi + sensor and using this framework to send message to a smartapp: https://github.com/dpjanes/iotdb-smartthings. I can get the status of the sensor but I am unsure on how to change it so it would appear open/closed.

This is what I am currently doing:

python smartthings.py --type contact --id “myid” --request contact=true

and get this back:

{‘device’: {u’id’: u’myid’,
u’label’: u’Garage Door’,
u’mqtt’: u’tcp://mqtt.iotdb.org/u//st/contact/mqttID’,
u’type’: u’contact’,
‘url’: u’https://graph.api.smartthings.com/api/smartapps/installations/id’,
u’value’: {u’contact’: False, u’timestamp’: None}},
‘request’: {‘contact’: ‘true’}}

Any advice because the status never changes?
Also if there is a easier way or alternative for using an already setup switch connected to a raspberry pi im eager to learn something :smile:

Thank you!


(Tim Slagle) #2

Hey @RetraC

I would recommend setting up and endpoint if you haven’t already. You can see the details on how to do that here:

http://docs.smartthings.com/en/latest/smartapp-web-services-developers-guide/tutorial-part1.html?highlight=endpoint


(Carter) #3

@slagle

I believe I have the endpoint set up. (It works for reading the status’s of all the devices and can even set a switch value to 1 or 0. I just cant figure out how to set a contact switch to open or closed (1 or 0).
Here is what my endpoint looks like: