sinricpro / python-sdk

python3 sdk for sinric pro.
https://sinric.pro
23 stars 9 forks source link

Question: Smart home control panel #19

Open ChopsKingsland opened 4 years ago

ChopsKingsland commented 4 years ago

I want to make a smart home control panel after I got my python program with the SinricPro library working. I want to do this with either a web server or PyGame. There is just 1 issue. Telling the Alexa service the current state of the device. When I push a button to turn on my lights using SinricPro, is there anyway to feed back to Alexa to show up on the app saying the current state? E.g. If I turned on my light from the control panel, I want the Alexa app to show that state change.

thegoliathgeek commented 4 years ago

@ChopsKingsland

There is an option for this also. You can use events that are in the example codes. You can try this simple example

ChopsKingsland commented 4 years ago

i've just tried using this, but I can't seem to integrate it into pygame. I put the python for pygame into the app.py, but it either runs pygame, and then when I close it, it runs SinricPro, or it runs none at all.

thegoliathgeek commented 4 years ago

It's because sinricpro lib uses asyncio. Which runs on the single-event loop. So running pygame and sinricpro on main thread is not a good idea. You need to run them on separate threads.