starslayer74 Posted August 1 Share Posted August 1 Does anyone have any experience or tips for controlling these types of bulbs? There is no bridge so the Hue system doesn't work with them. I have been searching high and low and can only find some IFTTT controls, but I'm not sure how to integrate IFTTT into this addon... Quote Link to comment Share on other sites More sharing options...
Johno Posted August 2 Share Posted August 2 What about Home Assistant with its LocalTuya integration. Quote Link to comment Share on other sites More sharing options...
PreShow Supporter DexDeadly Posted September 1 PreShow Supporter Share Posted September 1 @starslayer74what bulbs are they? Maybe we can check for an api on them and go from there. Quote Link to comment Share on other sites More sharing options...
starslayer74 Posted September 20 Author Share Posted September 20 On 9/1/2023 at 4:08 PM, DexDeadly said: @starslayer74what bulbs are they? Maybe we can check for an api on them and go from there. They are generic bulbs that use the Tuya/Smart Life app to control (works with Alexa and Google Home) Quote Link to comment Share on other sites More sharing options...
starslayer74 Posted September 27 Author Share Posted September 27 As a follow up, I found this: https://github.com/Octoober/tuya-bulb-control Also, maybe it would make sense to build in IFTTT functionality? It works with lots of different systems. I'm not sure if that would make things easier or not from a development standpoint. Quote Link to comment Share on other sites More sharing options...
Administrator Matt Posted October 1 Administrator Share Posted October 1 Can you set up access to the API, using the instructions from the link you shared? Step 1: CLIENT_ID and SECRET_KEY Register or Login on Tuya. Create a cloud development project Cloud -> Project. After successful creation, you will receive the Client ID and Secret Key. Step 2: DEVICE_ID Install Tuya Smart app or Smart Life app on your mobile phone. Go to Cloud -> Link Devices page. Selecting a tab Link Devices by App Account. Click Add App Account and scan the QR code with Tuya Smart app or Smart Life app. Now you can go to devices Cloud -> Device List and copy Device ID. Notes: Try to select a your region if devices are not displayed. Step 3: Request access to API calls Go to Cloud -> API Group and enable Authorization management, Device Management and Device Control. We can hopefully use the python script if you can get things set up. The challenge with anything with anything like this is that if I don't have it I can't test it to figure out how to make it work. The only Tuya thing I have is luckily Hue compatible. Let me know if you get this set up and I'll suggest your next steps. Quote Link to comment Share on other sites More sharing options...
starslayer74 Posted October 2 Author Share Posted October 2 (edited) 19 hours ago, Matt said: Can you set up access to the API, using the instructions from the link you shared? Step 1: CLIENT_ID and SECRET_KEY Register or Login on Tuya. Create a cloud development project Cloud -> Project. After successful creation, you will receive the Client ID and Secret Key. Step 2: DEVICE_ID Install Tuya Smart app or Smart Life app on your mobile phone. Go to Cloud -> Link Devices page. Selecting a tab Link Devices by App Account. Click Add App Account and scan the QR code with Tuya Smart app or Smart Life app. Now you can go to devices Cloud -> Device List and copy Device ID. Notes: Try to select a your region if devices are not displayed. Step 3: Request access to API calls Go to Cloud -> API Group and enable Authorization management, Device Management and Device Control. We can hopefully use the python script if you can get things set up. The challenge with anything with anything like this is that if I don't have it I can't test it to figure out how to make it work. The only Tuya thing I have is luckily Hue compatible. Let me know if you get this set up and I'll suggest your next steps. I actually did get that part set up, I was playing with Home Assistant like someone suggested, so I do have an API key and Client ID. I experienced some other Home Assistant issues so I don't think I'm going to be using that, but I would love to try out anything else you suggest. Edited October 2 by starslayer74 Quote Link to comment Share on other sites More sharing options...
Administrator Matt Posted October 2 Administrator Share Posted October 2 Here's my best guess on how to make this work: Download tuya-bulb-control-main.zip, PreShow.py, and Tuya.pseaction below. Unzip tuya-bulb-control-main.zip and place it somewhere that your system can access. Move PreShow.py to that folder. Edit PreShow.py and change the following to the correct details: CLIENT_ID = '' SECRET_KEY = '' DEVICE_ID = '' REGION_KEY = '' Move Tuya.pseaction to the Actions folder in your PreShow Content directory. Edit "python://path/to/script.py" to the location of PreShow.py. Test the action. I don't know if that will work and I can't do anything to test it. If it does work, it won't do what you want it to do, but that's right now we just want to see if it does anything. If it works, we can figure out how to make it do what you want afterwards. Let me know how it goes. And if there's anyone else with Tuya bulbs, please let us know so that we can get more people to help test. tuya-bulb-control-main.zip PreShow.py Tuya.pseaction Quote Link to comment Share on other sites More sharing options...
starslayer74 Posted October 4 Author Share Posted October 4 On 10/2/2023 at 4:19 PM, Matt said: Here's my best guess on how to make this work: Download tuya-bulb-control-main.zip, PreShow.py, and Tuya.pseaction below. Unzip tuya-bulb-control-main.zip and place it somewhere that your system can access. Move PreShow.py to that folder. Edit PreShow.py and change the following to the correct details: CLIENT_ID = '' SECRET_KEY = '' DEVICE_ID = '' REGION_KEY = '' Move Tuya.pseaction to the Actions folder in your PreShow Content directory. Edit "python://path/to/script.py" to the location of PreShow.py. Test the action. I don't know if that will work and I can't do anything to test it. If it does work, it won't do what you want it to do, but that's right now we just want to see if it does anything. If it works, we can figure out how to make it do what you want afterwards. Let me know how it goes. And if there's anyone else with Tuya bulbs, please let us know so that we can get more people to help test. tuya-bulb-control-main.zip 9.74 kB · 0 downloads PreShow.py 391 B · 0 downloads Tuya.pseaction 26 B · 0 downloads I just gave it a go, ran into a few issues: 1. I'm not sure what to put in for Region Key Here is a screenshot of the error I got: Quote Link to comment Share on other sites More sharing options...
Administrator Matt Posted October 4 Administrator Share Posted October 4 Can you send me a log file? Quote Link to comment Share on other sites More sharing options...
starslayer74 Posted October 4 Author Share Posted October 4 3 hours ago, Matt said: Can you send me a log file? https://paste.kodi.tv/xowipaboba Quote Link to comment Share on other sites More sharing options...
Administrator Matt Posted October 6 Administrator Share Posted October 6 @starslayer74The PreShow code to launch the python file didn't work and needed to be modified. I fixed that, but then I realized the Tuya code from the other site won't work as is. What do you normally use to control your Tuya bulbs? Quote Link to comment Share on other sites More sharing options...
starslayer74 Posted October 6 Author Share Posted October 6 1 hour ago, Matt said: @starslayer74The PreShow code to launch the python file didn't work and needed to be modified. I fixed that, but then I realized the Tuya code from the other site won't work as is. What do you normally use to control your Tuya bulbs? Mostly I use Alexa but it's connected through the Tuya Smart Life app. Quote Link to comment Share on other sites More sharing options...
starslayer74 Posted October 12 Author Share Posted October 12 @MattI just wanted to check back in on this to see if you had any other ideas? Quote Link to comment Share on other sites More sharing options...
Administrator Matt Posted October 13 Administrator Share Posted October 13 I don't have any easy ideas. I'll look into it further and see if I can come up with something. Quote Link to comment Share on other sites More sharing options...
starslayer74 Posted October 25 Author Share Posted October 25 On 10/13/2023 at 10:26 AM, Matt said: I don't have any easy ideas. I'll look into it further and see if I can come up with something. Assuming I could get the lights to talk to Home Assistant, is there a way to trigger it using HA commands in Preshow Experience? Quote Link to comment Share on other sites More sharing options...
Administrator Matt Posted October 26 Administrator Share Posted October 26 I know some people have used home assistant with it, but I haven't used it. Quote Link to comment Share on other sites More sharing options...
Johno Posted October 26 Share Posted October 26 (edited) 10 hours ago, starslayer74 said: Assuming I could get the lights to talk to Home Assistant, is there a way to trigger it using HA commands in Preshow Experience? Yes easy done. I run my lifx beam though HA triggered by Preshow. Get it working in HA and I can help with the rest. Edited October 26 by Johno Quote Link to comment Share on other sites More sharing options...
Administrator Matt Posted October 26 Administrator Share Posted October 26 @JohnoThank you for offering to help. Quote Link to comment Share on other sites More sharing options...
starslayer74 Posted October 26 Author Share Posted October 26 12 hours ago, Johno said: Yes easy done. I run my lifx beam though HA triggered by Preshow. Get it working in HA and I can help with the rest. I really appreciate that. I'm going to build a little HA server on an old Raspberry PI and I'll report back when I have it up and running. Thank you for the assistance! Quote Link to comment Share on other sites More sharing options...
Johno Posted October 28 Share Posted October 28 No problems. Quote Link to comment Share on other sites More sharing options...
starslayer74 Posted October 29 Author Share Posted October 29 18 hours ago, Johno said: No problems. Ok, I have it up and running. I can turn the bulbs on and off, and change colors/brightness in the Home Assistant dashboard.... I am clay in your hands Quote Link to comment Share on other sites More sharing options...
Johno Posted October 30 Share Posted October 30 (edited) On 10/29/2023 at 1:17 PM, starslayer74 said: Ok, I have it up and running. I can turn the bulbs on and off, and change colors/brightness in the Home Assistant dashboard.... I am clay in your hands STEP 1 You have to create a script first, I'll guide you though a simple script to turn on a light, to do this: Goto Settings - Automations & Scenes - Scripts (from the tabs menu on the page) 1. Press the "+ ADD SCRIPT" button on the bottom right of the page. 2. Select "Create new Script" 3. Name your script eg: "Turn_on_Cinema_Light" No spaces and give it a icon if you like. 4. Press "+ ADD ACTION" from the drop down select "Call a service" 5. From the Service drop down select "Light: Turn on" and select "Choose device" and select your light you want to turn on. you can also select brightness and color if you like. 6. Press Save 7. To test the script, from the Traces menu (right top side with 3 dots), select run script, the light should turn on. Edited October 30 by Johno Quote Link to comment Share on other sites More sharing options...
Johno Posted October 30 Share Posted October 30 (edited) STEP 2 - Create a Long-lived access tokens 1. Select "Profile" menu from the side menu, its the last one on the bottom under Notifications. 2. Scroll to the "Long-lived access tokens" section 3. Press "CREATE TOKEN" Give it a name eg: "Cinema" doesn't really matter what you call it. 4. Make sure to copy the code and save it, as you wont be able to see it again, the token will be about 180 chars long. Edited October 30 by Johno Quote Link to comment Share on other sites More sharing options...
Johno Posted October 30 Share Posted October 30 (edited) STEP 3 Create a action script to use with PreShow. Change the ** ** to suit. http://**YOUR HA IP ADDRESS**:8123/api/services/script/turn_on HEADERS: {"Authorization": "Bearer **PASTE YOUR LONG-LIVED ACCESS TOKEN HERE**", "Content-Type": "application/json"} POST: {"entity_id": "**YOU SCRIPT NAME eg script.Turn_on_Cinema_Light **"} Sample attached. Let me know if you run into any problems and I will create a pdf guide with screen shots etc. HA is fantastic to what you can do with it example: If someone presses my door bell camera and I am in my home cinema, I have a automation script that will pause the movie playing and display a popup message, saying someones at the front door and also shows the camera video feed. Once you start theirs no going back . Movie_Pause.cvaction Edited October 30 by Johno 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.