Switch in simulator not switching

I am a noob, please treat me gently.

My ultimate goal is to integrate ST with a Raspberry Pi controlling a relay for my garage doors. I have the Pi working with some basic Python code and can control the relays and contact switches - so hardware I feel is sorted. I’ll use CherryPy to create a REST interface.

Trying to learn the SmartApp component so I can see how to create the mappings needed for my REST interface on the Pi, I’ve been playing with the virtual switch, using APIGEE to test the code, as recommended in the docs. All seems to work well - I can query the switch in APIGEE and it will return to me the state that the simulator shows the switch to be in. However, when I try to change the state of the switch from APIGEE, the code runs, but doesn’t actually change the state. You can see here from the logs that I’ve tried using the array state change (although using only 1 switch in this example) as well as iterating the array and switching each individually. The logging shows that even though the code is called, the state hasn’t changed, reflected too in the simulator. Is there some kind of ‘commit’ needed?

Where am I going wrong? I know this is 101 stuff.

I’m sure someone has already done this.
Did you search the forum?

Does this help you?

I did, but I am working through the docs to make sure I understand how this all hangs together. Of course, after an hour of trying to get this to work, I try again … and now it’s working. WTF?

The question was more around the simulator not seeming to work, the intro was just to set the overall context.

Thanks for the pointers.

The example looks good, but the install doesn’t work on my Pi Zero W, following the installation instructions.

sudo pip install tweepy twilio sleekxmpp dnspython pyasn1

arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c build/temp.linux-armv6l-2.7/_openssl.c -o build/temp.linux-armv6l-2.7/build/temp.linux-armv6l-2.7/_openssl.o

build/temp.linux-armv6l-2.7/_openssl.c:434:30: fatal error: openssl/opensslv.h: No such file or directory

 #include <openssl/opensslv.h>


compilation terminated.

error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1