make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.28k stars 505 forks source link

Request support for Projetor Tuya (Smart-Star-Projector ) #821

Closed SergioFuchs closed 1 year ago

SergioFuchs commented 1 year ago

This is the device, the basic version, this is the dpi.

I can add using tuyalocal today but is missing the extra features like laser state , laser speed, color state and others.

https://pt.aliexpress.com/item/1005002135993671.html?spm=a2g0o.order_list.order_list_main.12.21efcaa4LZtAps&gatewayAdapt=glo2bra

The dpis does not appear as I listed on https://github.com/make-all/tuya-local/issues/804 But the dpi exists and shows on other integration like Local Tuya.

But It, would be nice if can control 100% on Tuya Local, integration

Thanks ,

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

{ "result": { "active_time": 1682643773, "category": "dj", "category_name": "Light Source", "create_time": 1638997592, "gateway_id": "", "icon": "smart/icon/ay149682747096840kwW/56df5e11d53922816403db387309e9fc.png", "id": "ebfb24f700379d6945oqc9", "ip": "138.94.180.215", "lat": "-27.6543", "local_key": "057b6ae5cbbf5e01", "lon": "-54.2860", "model": "SK20", "name": "Projetor Tuya", "online": true, "owner_id": "41145990", "product_id": "cw7kinnselbesfp9", "product_name": "Smart-Star-Projector ", "sub": false, "time_zone": "-03:00", "update_time": 1686862147, "uuid": "1505865d062a4641" }, "success": true, "t": 1686874176870, "tid": "1467c8240bda11ee9d71220dd637f8d3" }

ignacio82 commented 1 year ago

I just installed tuya-local and added my galaxy projector. Right now I only see the following

image

Is there a way to control the laser and other features?

blakadder commented 1 year ago

What is the current configuration the device is using? Please add the dp list for your device! Instructions

ignacio82 commented 1 year ago

Is this what you need?

{
  "result": {
    "model": "{\"modelId\":\"000002cxuz\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[
{\"abilityId\":20,\"accessMode\":\"rw\",\"code\":\"switch_led\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_power\",\"attribute\":\"515\"},\"name\":\"开关\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":21,\"accessMode\":\"rw\",\"code\":\"work_mode\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_mode\",\"attribute\":\"512\"},\"name\":\"模式\",\"typeSpec\":{\"range\":[\"white\",\"colour\",\"scene\",\"music\"],\"type\":\"enum\",\"typeDefaultValue\":\"white\"}},
{\"abilityId\":22,\"accessMode\":\"rw\",\"code\":\"bright_value\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-liangdu1\",\"attribute\":\"514\"},\"name\":\"亮度值\",\"typeSpec\":{\"max\":1000,\"min\":10,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":10}},
{\"abilityId\":24,\"accessMode\":\"rw\",\"code\":\"colour_data\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-yanse\",\"attribute\":\"512\"},\"name\":\"彩光\",\"typeSpec\":{\"maxlen\":255,\"type\":\"string\",\"typeDefaultValue\":\"\"}},
{\"abilityId\":25,\"accessMode\":\"rw\",\"code\":\"scene_data\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-shoucang\",\"attribute\":\"512\"},\"name\":\"场景\",\"typeSpec\":{\"maxlen\":255,\"type\":\"string\",\"typeDefaultValue\":\"\"}},
{\"abilityId\":26,\"accessMode\":\"rw\",\"code\":\"countdown\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-a_nav_timer\",\"attribute\":\"514\"},\"name\":\"倒计时\",\"typeSpec\":{\"max\":86400,\"min\":0,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":0,\"unit\":\"s\"}},
{\"abilityId\":101,\"accessMode\":\"rw\",\"code\":\"motor_speed\",\"description\":\"\",\"name\":\"马达转速\",\"typeSpec\":{\"max\":1000,\"min\":10,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":10,\"unit\":\"\"}},
{\"abilityId\":102,\"accessMode\":\"rw\",\"code\":\"laser_switch\",\"description\":\"用于控制激光灯的开、关\",\"name\":\"激光灯开关\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":103,\"accessMode\":\"rw\",\"code\":\"rgb_switch\",\"description\":\"用于单独控制RGB的开、关\",\"name\":\"RGB开关\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}}]}]}"
  },
  "success": true,
  "t": 1690576801294,
  "tid": "ec73f0602d8611ee9fecaa50f188a4b0"
}
make-all commented 1 year ago

That is part of it, but the question asked by @blakadder would be answered by downloading the Device Diagnostics from the device page of Settings / Devices, as well as giving a snapshot of the local protocol values that are sent by the device - for more complex lighting devices they often do not match what comes from iot.tuya.com, as the manufacturer just includes standard light documentation in their cloud definition, even though their device has been modified for its special purpose. Specifically, we have seen a lot of these sorts of lights that document the standard work_mode values ["white", "colour", "scene", "music"] but don't actually have a work_mode dp and only work in "colour" mode all the time.

ignacio82 commented 1 year ago

This stuff?

switch_led  Boolean 
"{true,false}"
work_mode   Enum    
{
  "range": [
    "white",
    "colour",
    "scene",
    "music"
  ]
}
bright_value_v2 Integer 
{
  "min": 10,
  "max": 1000,
  "scale": 0,
  "step": 1
}
colour_data_v2  Json    
{
  "h": {
    "min": 0,
    "scale": 0,
    "unit": "",
    "max": 360,
    "step": 1
  },
  "s": {
    "min": 0,
    "scale": 0,
    "unit": "",
    "max": 1000,
    "step": 1
  },
  "v": {
    "min": 0,
    "scale": 0,
    "unit": "",
    "max": 1000,
    "step": 1
  }
}
scene_data_v2   Json    
{
  "scene_num": {
    "min": 1,
    "scale": 0,
    "max": 8,
    "step": 1
  },
  "scene_units": {
    "unit_change_mode": {
      "range": [
        "static",
        "jump",
        "gradient"
      ]
    },
    "unit_switch_duration": {
      "min": 0,
      "scale": 0,
      "max": 100,
      "step": 1
    },
    "unit_gradient_duration": {
      "min": 0,
      "scale": 0,
      "max": 100,
      "step": 1
    },
    "bright": {
      "min": 0,
      "scale": 0,
      "max": 1000,
      "step": 1
    },
    "temperature": {
      "min": 0,
      "scale": 0,
      "max": 1000,
      "step": 1
    },
    "h": {
      "min": 0,
      "scale": 0,
      "unit": "",
      "max": 360,
      "step": 1
    },
    "s": {
      "min": 0,
      "scale": 0,
      "unit": "",
      "max": 1000,
      "step": 1
    },
    "v": {
      "min": 0,
      "scale": 0,
      "unit": "",
      "max": 1000,
      "step": 1
    }
  }
}
countdown_1 Integer 
{
  "unit": "s",
  "min": 0,
  "max": 86400,
  "scale": 0,
  "step": 1
}

image

make-all commented 1 year ago

This is still in the cloud. The information needed is from within Home Assistant itself - the view of what Home Assistant sees from the device. Since you have already added the device, I suggest using the Device Diagnostics from Settings / Devices (find the device from the devices or integrations page, and click on it, the "Download Diagnostics" button should be at the top left). If you are adding the device and unable to add it (or don't want to due to the offered devices not being a good match), then the Settings / System / Log should also have some information about the dps received from the device.

ignacio82 commented 1 year ago

This stuff?

{
  "home_assistant": {
    "installation_type": "Home Assistant Container",
    "version": "2023.7.3",
    "dev": false,
    "hassio": false,
    "virtualenv": false,
    "python_version": "3.11.4",
    "docker": true,
    "arch": "x86_64",
    "timezone": "America/Los_Angeles",
    "os_name": "Linux",
    "os_version": "3.10.105",
    "run_as_root": true
  },
  "custom_components": {
    "ytube_music_player": {
      "version": "20220205.01",
      "requirements": [
        "ytmusicapi==0.19.5",
        "pytube==10.5.1",
        "integrationhelper==0.2.2"
      ]
    },
    "jellyfin": {
      "version": "1.1.1",
      "requirements": [
        "jellyfin-apiclient-python==1.7.2"
      ]
    },
    "dyson_local": {
      "version": "0.16.4-4",
      "requirements": [
        "libdyson==0.8.11"
      ]
    },
    "dyson_cloud": {
      "version": "0.15.0",
      "requirements": [
        "libdyson==0.8.7"
      ]
    },
    "keymaster": {
      "version": "v0.0.85",
      "requirements": []
    },
    "wyzeapi": {
      "version": "0.1.19",
      "requirements": [
        "wyzeapy==0.5.19"
      ]
    },
    "dwains_dashboard": {
      "version": "3.4.3",
      "requirements": []
    },
    "hacs": {
      "version": "1.32.1",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "tryfi": {
      "version": "0.0.20",
      "requirements": [
        "pytryfi>=0.0.20"
      ]
    },
    "redfin": {
      "version": "1.1.4",
      "requirements": [
        "redfin==0.1.1"
      ]
    },
    "presence_simulation": {
      "version": "3.1",
      "requirements": []
    },
    "resmed_myair": {
      "version": "0.1.11",
      "requirements": [
        "beautifulsoup4",
        "PyJWT"
      ]
    },
    "blueair": {
      "version": "1.0.0",
      "requirements": []
    },
    "ha_blueair": {
      "version": "1.7.4",
      "requirements": [
        "blueair-api==1.8.7"
      ]
    },
    "simpleicons": {
      "version": "v2.2.0",
      "requirements": [
        "simpleicons==7.14.0"
      ]
    },
    "govee_lan": {
      "version": "1.0.0",
      "requirements": [
        "govee-led-wez>=0.0.15"
      ]
    },
    "google_photos": {
      "version": "v0.6.0",
      "requirements": [
        "google-api-python-client>=2.71.0",
        "pillow>=9.1.1,<10.0.0"
      ]
    },
    "alarmo": {
      "version": "v1.9.10",
      "requirements": []
    },
    "flair": {
      "version": "0.1.9.1",
      "requirements": [
        "flairaio==0.1.3"
      ]
    },
    "deebot": {
      "version": "1.6.1",
      "requirements": [
        "deebot-client==2.0.0",
        "numpy>=1.21.2"
      ]
    },
    "webrtc": {
      "version": "v3.2.1",
      "requirements": []
    },
    "browser_mod": {
      "version": "2.3.0",
      "requirements": []
    },
    "tuya_local": {
      "version": "2023.6.1",
      "requirements": [
        "pycryptodome~=3.18",
        "tinytuya==1.12.8"
      ]
    },
    "mass": {
      "version": "2023.6.0b3",
      "requirements": [
        "music-assistant==2.0.0b59"
      ]
    },
    "tesla_custom": {
      "version": "3.15.1",
      "requirements": [
        "teslajsonpy==3.9.2"
      ]
    },
    "adaptive_lighting": {
      "version": "1.18.0",
      "requirements": [
        "ulid-transform"
      ]
    }
  },
  "integration_manifest": {
    "domain": "tuya_local",
    "name": "Tuya Local",
    "codeowners": [
      "@make-all"
    ],
    "config_flow": true,
    "dependencies": [],
    "documentation": "https://github.com/make-all/tuya-local",
    "integration_type": "device",
    "iot_class": "local_push",
    "issue_tracker": "https://github.com/make-all/tuya-local/issues",
    "requirements": [
      "pycryptodome~=3.18",
      "tinytuya==1.12.8"
    ],
    "version": "2023.6.1",
    "is_built_in": false
  },
  "data": {
    "name": "Galaxy projector",
    "type": "rgbcw_lightbulb",
    "device_id": "**REDACTED**",
    "device_cid": "",
    "local_key": "**REDACTED**",
    "host": "**REDACTED**",
    "protocol_version": 3.3,
    "tinytuya_version": "1.12.8",
    "api_version_set": 3.3,
    "api_version_used": 3.3,
    "api_working": true,
    "status": {},
    "cached_state": {
      "updated_at": 1690645899.101996,
      "20": false,
      "21": "white",
      "22": 800,
      "24": "00f003e80384",
      "25": "010e0d0000840000000003e801f4",
      "26": 0,
      "101": 1000,
      "102": false,
      "103": false
    },
    "pending_state": {},
    "connected": true,
    "force_dps": [],
    "home_assistant": {
      "name": "Galaxy projector",
      "name_by_user": null,
      "disabled": false,
      "disabled_by": null,
      "entities": [
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": "min",
          "state": {
            "entity_id": "number.galaxy_projector_timer",
            "state": "0.0",
            "attributes": {
              "min": 0.0,
              "max": 1440.0,
              "step": 1.0,
              "mode": "auto",
              "unit_of_measurement": "min",
              "icon": "mdi:timer",
              "friendly_name": "Galaxy projector Timer"
            },
            "last_changed": "2023-07-29T10:01:31.430954+00:00",
            "last_updated": "2023-07-29T10:01:31.430954+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": null,
          "device_class": null,
          "original_device_class": null,
          "icon": "mdi:star-four-points",
          "unit_of_measurement": null,
          "state": {
            "entity_id": "light.galaxy_projector",
            "state": "off",
            "attributes": {
              "min_color_temp_kelvin": 2000,
              "max_color_temp_kelvin": 6535,
              "min_mireds": 153,
              "max_mireds": 500,
              "effect_list": [
                "Scene",
                "Music"
              ],
              "supported_color_modes": [
                "color_temp",
                "hs"
              ],
              "scene_data": "010e0d0000840000000003e801f4",
              "icon": "mdi:star-four-points",
              "friendly_name": "Galaxy projector",
              "supported_features": 4
            },
            "last_changed": "2023-07-29T10:01:31.432816+00:00",
            "last_updated": "2023-07-29T10:01:31.432816+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "select.galaxy_projector_scene",
            "state": "Read",
            "attributes": {
              "options": [
                "Night",
                "Read",
                "Working",
                "Leisure",
                "Soft",
                "Colorful",
                "Dazzling",
                "Gorgeous"
              ],
              "icon": "mdi:palette",
              "friendly_name": "Galaxy projector Scene"
            },
            "last_changed": "2023-07-29T10:01:31.431674+00:00",
            "last_updated": "2023-07-29T10:01:31.431674+00:00"
          }
        }
      ]
    }
  }
}
ignacio82 commented 1 year ago

Do i have to remove and add the device again to tuya local to get all the options? For example, I still do not see an option to turn the laser on or off, or to change the brightness of the laser:

image

Thanks!

make-all commented 1 year ago

If you previously added it as a different device, it will need to be removed and re-added to use the new config.

SergioFuchs commented 1 year ago

Here it's working after deleting and configured again

Thanks star

Avsynthe commented 9 months ago

Hey guys. I have managed to add this just fine, though there is an issue with the "Background" control.

This entry should control ONLY the nebula portion's on/off switch, colour, and brightness.

Instead, it turns out this is actually just an on/off switch for the entire unit and thus, the colour and brightness options don't function. How do we fix this?

make-all commented 9 months ago

Do you mean to swap the switch currently named "Color" with the switch for the light marked as "Background" (and rename the separate switch to something like "Master")?

Avsynthe commented 9 months ago

Potentially! Though having a master switch could sort of be redundant as dashboard entries have a master (screenshot 1). But that may be good redundancy depending in where it's accessed from. Though having both off would be a master switch for off I guess, almost like having two separate devices.

Though because the background switch is set to master, when clicking into background, the brightness and colour settings in the next page (screenshot 2) don't function.

I did notice that the colour switch is enabled as an on/off switch for the nebula portion though!

Ideally it would be in the order I suppose: 1) Master switch 2) Background (aka colour) switch with brightness and colour control 3) Laser switch with brightness control

Also, would it be possible to translate rotation speed to a slider?

Screenshot_20240105-085112_Home_Assistant Screenshot_20240105-085207_Home_Assistant

make-all commented 9 months ago

You can change the representation of number entities in the UI from the card settings (in Edit Dashboard). The default makes smaller ranges sliders, and larger ranges input boxes (since you cannot get any accuracy with a slider on a range of 0-1000), but you can override it as the user. I don't think it is a good idea to override this in the config, as this is a user preference, and the default makes sensible choices for a good reason.

helgek commented 7 months ago

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):

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

ignacio82 commented 7 months ago

How do you do this? Could you please share a link to a tutorial?

On Thu, Mar 7, 2024, 3:40 PM helgek @.***> wrote:

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.png (view on web) https://github.com/make-all/tuya-local/assets/6280991/7453ef87-63d1-47a4-80fa-415dcc30db10

— Reply to this email directly, view it on GitHub https://github.com/make-all/tuya-local/issues/821#issuecomment-1984786190, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN7SXPSIEBO5QBFSR6E63LYXD3FVAVCNFSM6AAAAAAZNXVH4SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBUG44DMMJZGA . You are receiving this because you commented.Message ID: @.***>

helgek commented 7 months ago

Please check the link in my previous post below the screenshot.

GTunney commented 2 months ago

Sorry to resurrect an old ticket but when using Tuyalocal I can't turn on the master switch by using the switch.turn on service.

Any suggestions why this won't work?

make-all commented 2 months ago

Is it a switch or a light you are trying to turn on?

GTunney commented 2 months ago

Is it a switch or a light you are trying to turn on?

It's the master switch. It won't work when I use service switch.turnon

make-all commented 2 months ago

How are you doing this? Using the UI, or yaml config? If yaml, are you spelling switch.turn_on properly and giving all the required parameters with correct spelling etc? If the UI, have you selected the target entity?

GTunney commented 2 months ago

How are you doing this? Using the UI, or yaml config? If yaml, are you spelling switch.turn_on properly and giving all the required parameters with correct spelling etc? If the UI, have you selected the target entity?

I was just doing it via dev tools for testing and selected the "Master Switch" as the entity.

make-all commented 2 months ago

There is no reason why that should not work, if your device is correctly configured and otherwise working.