Open kireque opened 3 years ago
Maybe the best way is to configure only one configuration light with global on/off and two lights to control independently laser and color as :
host: !secret smart_star_projector_host
device_id: !secret smart_star_projector_id
local_key: !secret smart_star_projector_key
friendly_name: bedroom_kid_smart_star_projector
protocol_version: "3.3"
entities:
- platform: light
friendly_name: settings
id: 20
color_mode: 21
color: 24
brightness: 22
brightness_lower: 10
brightness_upper: 1000
- platform: light
friendly_name: laser
id: 102
- platform: light
friendly_name: color
id: 103
For rotation speed, you can use an input_number with a range 1-1000 and an automation that set the DP using the set_dp service when the value changed:
input_number:
rotation_speed:
name: Rotation Speed
min: 10
max: 1000
step: 10
automation:
trigger:
platform: state
entity_id: input_number.rotation_speed
action:
- data:
service: localtuya.set_dp
device_id: !secret smart_star_projector_id
dp: 101
value: {{ states('input_number.rotation_speed') }}
Something like this.
This work, but now I am unable to dim the laser. Default value is way too bright, so I want to be able to the color and the laser.
DP brightness is used for both laser and color, depending on DP 21. If DP 21 equals white, brightness is applied to laser. If DP 21 equals color then the brightness is applied to the colors.
If it works like other tuya devices, the brightness is encoded in the color value. You device have color and white in the same device. So it means that to change the laser brightness, you will need to pick the white center in the color picker in HA, this will switch your device to white mode. Then, changing the brightness will do on the laser. If you want to change then the color, choose the color, then change the brightness.
I tried your method but that does nog seems to work. But I have a workable situation now. If I turn on the star projector, I first setup the laser, then the colors.
Works for me. Thanks for your support!
Ok no pb.
Thanks a lot for this thread! It has been tremendously helpful in setting up my star projector.
I found the purpose of the previously unknown DP 26
:
0
s - 86400
s [= 24 h]) to toggle the overall power state (DP 20
).26
is set to a value larger than 0
.26
, while counting down.26
to 0
, when the time elapsed and the the overall power state (DP 20
) was toggled.26
to 0
.I also discovered a hack that allows me to control the rotation speed "more directly", by treating its DP 101
as a pseudo-light with brightness.
localtuya
ConfigurationThis is the configuration I'm currently using:
# https://github.com/rospogrigio/localtuya/issues/297
host: nebula.<redacted>
device_id: <redacted>
local_key: <redacted>
friendly_name: Living Room Nebula
protocol_version: "3.3"
entities:
# Overall On / Off Switch & Rotation.
- platform: light
friendly_name: Rotation
id: 20 # Overall On / Off Switch
brightness: 101 # Hack: Expose rotation speed as brightness.
brightness_lower: 10
brightness_upper: 1000
# Overall On / Off Switch.
# - platform: light
# friendly_name: Power
# id: 20
# Rotation.
# - platform: sensor
# friendly_name: Rotation
# id: 101
# scaling: 0.1
# Stars: Green Laser.
- platform: light
friendly_name: Stars
id: 102 # on / off
brightness: 22
brightness_lower: 10
brightness_upper: 1000
# Nebula: RGB Projector.
- platform: light
friendly_name: Nebula
id: 103 # on / off
color_mode:
21
# white: if saturation == 0x0000
# colour: if saturation >= 0x0001 (British English `colour`!)
# scene: read scene config from DP `scene: 25`
# music: apparently not available on this device (no mic)
color:
24 # 12 byte HSV
# hue: 0x0000 - 0x0168 [360]
# saturation: 0x0000 - 0x03e8 [1000],
# all RGB combined (white) - selected hue only
# value: 0x0000 - 0x03e8 [1000]
scene:
25 # 2 bytes + n * 26 bytes
# First 2 bytes:
#
# scene_num: 0x00 - 0x08
# 0x00: ???
# 0x01: ???
# 0x02: ???
# 0x03: ???
# 0x04: Scene 1, default name "Sleeping"
# 0x05: Scene 2, default name "Romantic"
# 0x06: Scene 3, default name "Party"
# 0x07: Scene 4, default name "Relaxing"
#
# Followed by 1 - 8 groups of 26 bytes each:
# Each group encodes encodes a keyframe from `scene_units`.
#
# Group bytes 0 - 5: keyframe transition behavior
# +0, 2 | unit_switch_duration: x00 - 0x64 [100], seconds
# +2, 2 | unit_gradient_duration: x00 - 0x64 [100], seconds
# +4, 2 | unit_change_mode:
# | 0x00: static
# | 0x01: jump
# | 0x02: gradient
#
# Group bytes 6 - 17: nebula color & brightness, like DP `color: 24`
# +6, 4 | hue: 0x0000 - 0x0168 [360]
# +10, 4 | saturation: 0x0000 - 0x03e8 [1000]
# +14, 4 | value: 0x0000 - 0x03e8 [1000]
#
# Group bytes 18 - 25: unknown
# +18, 4 | brightness: 0x0000 - 0x03e8 [1000]
# | Functionality unknown. It's NOT `brightness: 22`.
# +22, 4 | temperature: 0x0000 - 0x03e8 [1000]
# | Functionality unknown.
#
# Example: Scene 1, "Sleeping", 2 frames
#
# SN SD GD CM H S V Brig Temp
# 04 46 46 02 0078 03e8 03e8 0000 0000
# 46 46 02 0078 03e8 000a 0000 0000
#
# Example: Scene 4, "Relaxing", 6 frames
#
# SN SD GD CM H S V Brig Temp
# 07 46 46 02 0000 03e8 03e8 0000 0000
# 46 46 02 0078 03e8 03e8 0000 0000
# 46 46 02 00f0 03e8 03e8 0000 0000
# 46 46 02 003d 03e8 03e8 0000 0000
# 46 46 02 00ae 03e8 03e8 0000 0000
# 46 46 02 0113 03e8 03e8 0000 0000
And I integrated the device into lovelace like so:
Standalone Card | |
---|---|
![]() | ```yaml type: entities title: Nebula show_header_toggle: true entities: - type: custom:slider-entity-row icon: mdi:rotate-right entity: light.living_room_nebula_rotation min: 1 hide_when_off: true toggle: false - entity: light.living_room_nebula_laser type: custom:slider-entity-row toggle: true hide_when_off: true - entity: light.living_room_nebula_projector type: custom:slider-entity-row toggle: true hide_when_off: true - type: custom:light-entity-card entity: light.living_room_nebula_projector effects_list: false hide_header: true shorten_cards: true child_card: true brightness: false ``` |
Embedded Expandable Group in Card | |
![]() | ```yaml type: entities title: Couch show_header_toggle: false entities: # ... - type: section - type: custom:fold-entity-row clickable: true head: entity: light.living_room_nebula_rotation icon: mdi:flare name: Nebula entities: - type: custom:slider-entity-row icon: mdi:rotate-right entity: light.living_room_nebula_rotation min: 1 hide_when_off: true toggle: false - entity: light.living_room_nebula_laser type: custom:slider-entity-row toggle: true hide_when_off: true - entity: light.living_room_nebula_projector type: custom:slider-entity-row toggle: true hide_when_off: true - type: custom:light-entity-card entity: light.living_room_nebula_projector effects_list: false hide_header: true shorten_cards: true child_card: true brightness: false ``` |
Hi, thnx for info, alsu purchased 2 projectors for my kids... I see you created a lovelace card, nice
But how is it possible to add all those 3 attributes in a normal light entity? So when you click on more info, they are all avainble? now they are 3 seperate lights
thnx
Hey @kireque , I do have same issues... I can't control the color sometimes, can't turn it on.. I need to turn it on with smart life app, then it works again...
I have the feeling after adjusting color in HA, it gets unresponsive.... Already using the config posted a few posts back... Do you have a working solution?
Hi @pergolafabio,
In the end I modified my smart star projector by replacing the chip with an esp. Created a tutorial how I did it: https://github.com/kireque/esphome_nebula_light
So I am not using this integration anymore.
Gzeat, ,thnx for tutorial, but I'm not a solder specialist, gonna skip this one and keep it safe :-)
hey @kireque , is it supported now?
Hey @pergolafabio I am not sure. Was closing old and stale issues that were on my name
ah ok , well dont think its integrated yet, maybe leave it open? :-)
Reopend the case. Hopefully for you it wil be implemented soon :)
yeah, i now do it manually, alltough its not perfect
Having some issues integrating the Tuya Smart Star Projector.
Following dps config
I have the following config in HA:
The entities are online in HA, but I notice the following:
I believe this has something to do with dps option 21. Using the cli I saw that when editing the color settings in the smar life app option 21 is set to color. When editing the laser setting option 21 is set to white.
How can I mimic this in localtuya config?