GithubHelp home page GithubHelp logo

homebridge-star-projector's Introduction

homebridge-star-projector

npm npm GitHub last commit verified-by-homebridge Discord Donate

Creating and maintaining Homebridge plugins consume a lot of time and effort, if you would like to share your appreciation, feel free to "Star" or donate.

Click here to review more of my plugins.

Info

HomeKit Demo

This is a dynamic platform plugin for Homebridge to control Tuya / Smart Life based star projectors.

This Plugin creates a grouped Accessory (Switch, Lightbulbs and Fan) and it allows to customize the state, color, laser and star rotation of the star projector. You can also create scenes which expose Switches to HomeKit to enable your own configured scenes.

Tested Projectors

This plugin is verified to work with following Star Projectors:

https://www.amazon.de/dp/B08VGK1V82

Installation instructions

After Homebridge has been installed:

  • sudo npm i -g homebridge-star-projector@latest

Basic configuration

{
 "bridge": {
   ...
 },
 "accessories": [
   ...
 ],
 "platforms": [
   {
     "platform": "StarProjector",
     "name": "StarProjector",
     "debug": false,
     "projectors": [
         {
             "name": "Star Projector",
             "tuyaId": "asdsadsafasvasfsfs",
             "tuyaKey": "12w31231ascasdqasd"
         }
       }
     ]
   }
 ]
}

See Example Config for more details.

Credentials

In order to use the plugin, you need to find out your "Tuya ID / API Key" and your "Tuya Key / API Secret". Here is a great tutorial how you can generate your credentials.

Once you have your credentials, you just have to add it to your config.json, thats it.

Endpoints / DPS

This plugin uses the great TuyApi module. If you have problems switching the state, changing color, changing rotation etc., you can change the "endpoints" manually via config.json.

These "endpoints" are also called dps. The plugin uses the following (default) endpoints/dps:

  • 20 = Power State (true/false)
  • 21 = Mode ('white', 'colour', 'scene')
  • 22 = Laser Brightness (10 - 1000)
  • 24 = Color (HSB/V)
  • 25 = Scene
  • 26 = Countdown (Seconds) (currently not implemented)
  • 101 = Star Rotation Speed (10 - 1000)
  • 102 = Laser State (true/false)
  • 103 = Color State (true/false)

Supported clients

This plugin has been verified to work with the following apps on iOS 14:

  • iOS 14+
  • Apple Home
  • All 3rd party apps like Elgato Eve etc.
  • Homebridge v1.1.6+

Contributing

You can contribute to this homebridge plugin in following ways:

  • Report issues and help verify fixes as they are checked in.
  • Review the source code changes.
  • Contribute bug fixes.
  • Contribute changes to extend the capabilities

Pull requests are accepted.

Troubleshooting

If you have any issues with the plugin then you can run this plugin in debug mode, which will provide some additional information. This might be useful for debugging issues. Just enable debug in your config and restart homebridge.

Disclaimer

All product and company names are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.

homebridge-star-projector's People

Contributors

adlerre avatar seydx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

homebridge-star-projector's Issues

Plugin forces homebridge to terminate

A few weeks ago my home bridge wouldn't respond and I discovered this in the logs. I miss asking my projector to turn on. Please help!

Error: Error from socket: connect EHOSTUNREACH 192.168.7.243:6668 - Local (192.168.7.46:59685)
at Socket. (/usr/local/lib/node_modules/homebridge-star-projector/node_modules/tuyapi/index.js:528:30)
at Socket.emit (node:events:527:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)

Tuya Key missing or incorrect

Basically I get this whenever I start the homebridge (which is run on a raspberry pi. I already tried troubleshooting with other bugs I found here but it didn’t work. I tried with 2 different projects on tuya’s site but the plugin always complains that my api secret is wrong. I don’t really know how to resolve this so I’d be happy if you could explain why this is happening. Should I try with another tuya account?

find() timed out during startup

I receive the following error during homebridge startup:
StarProjector: An error occured during connecting to Tuya API: find() timed out. Is the device powered on and the ID or IP correct? - Retry in 60s

Credentials from tuya-cli:

[
  {
    name: 'Panamalar-Smart Star Projector',
    id: '***',
    key: '***'
  }
]

I configured the plugin as following:

{
            "name": "StarProjector",
            "projectors": [
                {
                    "name": "StarProjector",
                    "tuyaId": "ID_FROM_ABOVE",
                    "tuyaKey": "KEY_FROM_ABOVE",
                    "color": true,
                    "laser": true,
                    "starRotation": true,
                    "scenes": [
                        {
                            "active": false
                        },
                        {
                            "active": false
                        }
                    ]
                }
            ],
            "platform": "StarProjector"
        }

Is there any way to debug this? Looking at the source code it seems my homebridge instance can't access the tuya server at all..?!

The projector can now be jailbreaked from Tuya purely using software -> turning it into an ESPHome device

Big news: There's now a solution available to flash ESPHome on the original microcontroller that comes with the Star Projector which even doesn't require to open the device (!). Everything works via direct WiFi connection between your computer and the Star Projector (the projector provides a WiFi access point). So no more replacement of the original microcontroller requiring soldering, this is the most convenient jailbreak one can think of.

I found only two minor issues at the moment (minor because they can both be addressed via Home Assistant automations for instance):

  • With unchanged settings after turning on the projector it turns off itself automatically after about one hour. I just started to investigate this by e.g. testing if it makes a difference if I leave the motor off.
  • When you turn the device on using the main switch it doesn't remember the last state of lights/laser/motor when it was on before.

I immediately bought a second device after I had successfully flashed the first one. Both devices show the same behaviour described above.

This is how this jailbreak miracle looks like in HA:

Screenshot 2024-03-08 at 00 37 39

And you'll find all the magic here: https://github.com/M4GNV5/esphome-SK20-Nebula-Light

[StarProjector] test: An error occured during connecting to Tuya API: find() timed out

Hello
So first sorry for my english, french here ^^
So I started recently to build my homebridge server and want to add more and more accessories to my homekit.
I got this tuya/smartlife star projector for christmas and wanted to connect it with my homebridge/homekit
I followed all the step correctly but after rebooting homebridge because of plugin configuration to apply, the logs say the following error :
[StarProjector] test: An error occured during connecting to Tuya API: find() timed out. Is the device powered on and the ID or IP correct? - Retry in 60s

image

I have a new button in my homebridge and homekit and can toggle it on or off but nothing happen
image

  • The ID and Key are correct,
  • The config didn't ask me to enter the ip,
  • Star projector is powered on via smartlife app and registered in my tuya IoT account

so what's next please ?

Error 'Key is missing or incorrect.' for a confirmed working api/key combo

Describe the bug
Plugin configured per instructions:

    {
       "name": "StarProjector",
       "debug": true,
       "projectors": [
           {
               "name": "GalaxyProjector_Tuya",
               "tuyaId": "aaaaaaaaaaaaaaa",
               "tuyaKey": "kkkkkkkkkkkkkkkkkkk"
           }
       ],
       "platform": "StarProjector"
   },

The api id and key used are working fine for the HomeAssistant Tuya v2 integration. I have also tried my email address for the value of tuyaID with the api key but getting the same error.

I've checked through the api authorisation steps you've linked here on github and it's identical for the homeassistant integration. I am using an approved 'Individual Developer' API account w/ country/region of United Kingdom.

All related lines from HomeBridge log:

[8/27/2021, 2:49:42 PM] [StarProjector] Initializing StarProjector platform...
[8/27/2021, 2:49:42 PM] [StarProjector] GalaxyProjector_Tuya: An error occured during setting up the device!
[8/27/2021, 2:49:42 PM] [StarProjector] Key is missing or incorrect.

Additional context
Debugging is enabled and was hoping I could work this one out myself. Is there any way for me to get more info on this error?

### Update: Looked at your code. Seems it's failing in the tuyapi part before your plugin really starts. Would this be better logged over there?

Please add a music switch for new projectors that support this feature

color does not change with scenes

ive had my projector setup using this plugin for a few months now, and theres been a problem with when i try to change scenes, the color the projection is set to in the scene will change and immediately go back to the color previously set. for a while my apple tv was the exception for this, but now after having to set everything up again it will not change without me going into home and changing the color myself! here are the logs in debug mode.

[17/04/2023, 02:23:10] [StarProjector] Data received: {"dps":{"103":true},"type":"query","t":1681716189}
[17/04/2023, 02:23:10] [StarProjector] Incoming color state event: true
[17/04/2023, 02:23:10] [StarProjector] Smart-Star-Projector: Color State: true
[17/04/2023, 02:23:10] [StarProjector] Data received: {"dps":{"24":"010b03de0208"},"t":1681716190}
[17/04/2023, 02:23:10] [StarProjector] Incoming color event: 010b03de0208
[17/04/2023, 02:23:10] [StarProjector] Smart-Star-Projector: Color: {"hue":267,"saturation":99,"brightness":52}
[17/04/2023, 02:23:10] [StarProjector] Data received: {"dps":{"102":false},"t":1681716190}
[17/04/2023, 02:23:10] [StarProjector] Incoming laser state event: false
[17/04/2023, 02:23:10] [StarProjector] Smart-Star-Projector: Laser State: false
[17/04/2023, 02:23:10] [StarProjector] Data received: {"dps":{"24":"000003de02c6"},"t":1681716190}
[17/04/2023, 02:23:10] [StarProjector] Incoming color event: 000003de02c6
[17/04/2023, 02:23:10] [StarProjector] Smart-Star-Projector: Color: {"hue":0,"saturation":99,"brightness":71}
[17/04/2023, 02:23:10] [StarProjector] Data received: {"dps":{"21":"white","101":10},"t":1681716190}
[17/04/2023, 02:23:10] [StarProjector] Incoming mode event: white
[17/04/2023, 02:23:10] [StarProjector] Incoming rotation event: 10
[17/04/2023, 02:23:10] [StarProjector] Smart-Star-Projector: Rotation Speed: 1
[17/04/2023, 02:23:14] [StarProjector] Data received: {"dps":{"102":true},"t":1681716194}
[17/04/2023, 02:23:14] [StarProjector] Incoming laser state event: true
[17/04/2023, 02:23:14] [StarProjector] Smart-Star-Projector: Laser State: true
[17/04/2023, 02:23:14] [StarProjector] Data received: {"dps":{"22":220},"type":"query","t":1681716194}
[17/04/2023, 02:23:14] [StarProjector] Incoming laser brightness event: 220
[17/04/2023, 02:23:14] [StarProjector] Smart-Star-Projector: Laser Brightness: 22
[17/04/2023, 02:23:14] [StarProjector] Data received: {"dps":{"101":80},"t":1681716194}
[17/04/2023, 02:23:14] [StarProjector] Incoming rotation event: 80
[17/04/2023, 02:23:14] [StarProjector] Smart-Star-Projector: Rotation Speed: 8
[17/04/2023, 02:23:14] [StarProjector] Data received: {"dps":{"103":true},"type":"query","t":1681716194}
[17/04/2023, 02:23:14] [StarProjector] Incoming color state event: true
[17/04/2023, 02:23:14] [StarProjector] Smart-Star-Projector: Color State: true
[17/04/2023, 02:23:15] [StarProjector] Data received: {"dps":{"20":true},"type":"query","t":1681716194}
[17/04/2023, 02:23:15] [StarProjector] Incoming power state event: true
[17/04/2023, 02:23:15] [StarProjector] Smart-Star-Projector: Power State: true
[17/04/2023, 02:23:15] [StarProjector] Data received: {"dps":{"21":"colour"},"t":1681716194}
[17/04/2023, 02:23:15] [StarProjector] Incoming mode event: colour
[17/04/2023, 02:23:15] [StarProjector] Data received: {"dps":{"24":"010b03de02c6"},"t":1681716194}
[17/04/2023, 02:23:15] [StarProjector] Incoming color event: 010b03de02c6
[17/04/2023, 02:23:15] [StarProjector] Smart-Star-Projector: Color: {"hue":267,"saturation":99,"brightness":71}
[17/04/2023, 02:23:15] [StarProjector] Data received: {"dps":{"24":"000003de02c6"},"t":1681716195}
[17/04/2023, 02:23:15] [StarProjector] Incoming color event: 000003de02c6
[17/04/2023, 02:23:15] [StarProjector] Smart-Star-Projector: Color: {"hue":0,"saturation":99,"brightness":71}

bit of a newbie to this so idk if its something simple.

Rotation can not be turned off via switch

Hello @seydx,

i have tested the plugin and it works really well. Great work! I noticed that the rotation can not be stopped via the switch. If I reduce the slider from 100 to 0 it works.

Would be nice if you could check?

Thanks!

Star Projector-List

Hi,
deine Amazon-Liste für die Sternenprojektoren ist nicht mehr abrufbar.

Liebe Grüße
Karim

Hey there,
your Amazon-Wishlist for the star projectors doesn't work anymore.

Kind regards,
Karim

API Key is missing or incorrect

So basically I used the SUPPOU projector you suggested and when I try to setup the plugin it says my API key is missing or incorrect. On Tula, I’m in the Central Europe data enter if that matters. Homebridge runs on a Raspi4.

Plugin causes homebridge to crash while startup

Describe the bug
In case the internet connection is interrupted, the Homebridge cannot be restarted because the plugin cannot connect to the Tuya API.

To Reproduce

  1. Disconnect the internet connection
  2. Restart homebridge
  3. Watch the homebridge log

Expected behavior
I expected the plugin not to crash

Log

[30/05/2021, 08:45:43] [StarProjector] Sterne: An error occured during connecting to Tuya API
[30/05/2021, 08:45:43] [StarProjector] Error: find() timed out. Is the device powered on and the ID or IP correct?
    at /usr/local/lib/node_modules/homebridge-star-projector/node_modules/tuyapi/index.js:824:13
    at Timeout._onTimeout (/usr/local/lib/node_modules/homebridge-star-projector/node_modules/p-timeout/index.js:25:13)
    at listOnTimeout (internal/timers.js:555:17)
    at processTimers (internal/timers.js:498:7)
[30/05/2021, 08:45:43] [StarProjector] Sterne: Error from socket: connect ECONNREFUSED 127.0.0.1:6668
[30/05/2021, 08:45:53] [StarProjector] Sterne: Error from socket: connect ECONNREFUSED 127.0.0.1:6668
[30/05/2021, 08:45:57] [StarProjector] Sterne: Error from socket: connect ECONNREFUSED 127.0.0.1:6668
[30/05/2021, 08:46:05] [StarProjector] Sterne: Error from socket: connect ECONNREFUSED 127.0.0.1:6668
[30/05/2021, 08:46:21] [StarProjector] Sterne: Error from socket: connect ECONNREFUSED 127.0.0.1:6668
Error: connect ECONNREFUSED 127.0.0.1:6668
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 6668,
  attemptNumber: 6,
  retriesLeft: 0
}
Error: connect ECONNREFUSED 127.0.0.1:6668
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 6668,
  attemptNumber: 6,
  retriesLeft: 0
}
[30/05/2021, 08:46:21] Got SIGTERM, shutting down Homebridge...

Impact:
Parts of the home automation are no longer available, automations no longer work, and I can't even turn off the light in the dining room, which can be quite annoying ;-). As a result, the Homebridge becomes dependent on an existing internet connection, which contradicts the HomeKit idea.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.