rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.85k stars 546 forks source link

Adding floodlight as what type of device? #480

Open TheGabeMan opened 3 years ago

TheGabeMan commented 3 years ago

Got a new Tuya Floodlight with motion detector (product ID p34tkhljhjgfr5vl). I figured out the DP IDs you see below. Now I just don't know how I should add this to localTuya. What type of entity should I add? I can use the light entity but then I don't have the motion part. Or is this not doable through the wizard and do I need to add this to the configuration.yaml file?

And if I add this to the configuration.yaml, do I need to move all my lights that are currently in use through LocalTuya, also to the configuration.yaml?

DP ID | App item | Tuya code | Tuya Type | Tuya Value -- | -- | -- | -- | -- 20 | on/off | switch_led | Boolean | {true,false} 21 | (not found) | work_mode | Enum | {"range":["white","colour"]} 22 | brightness | bright_value | Integer | {"min":10,"max":1000,"scale":0,"step":1} 23 | colorwarmth | temp_value | Integer | {"min":0,"max":1000,"scale":0,"step":1}   |   | control_data | String | {"maxlen":255} 51 | Manual / Sensor operated | device_mode | Enum | {"range":["auto","manual"]} 53 | Sensitivity Light sensor | cds | Enum | {"range":["2000lux","300lux","50lux","10lux","5lux","now"]} 54 | Motion detection range | pir_sensitivity | Enum | {"range":["low","middle","high"]} 55 | Duration light after detection | pir_delay | Integer | {"unit":"s","min":5,"max":3600,"scale":0,"step":1} 56 | PIR sensor on / off | switch_pir | Boolean | {true,false} 58 | Duration light dimmed | standby_time | Integer | {"unit":"min","min":1,"max":480,"scale":0,"step":1} 59 | Brightness dimmed | standby_bright | Integer | {"min":0,"max":1000,"scale":0,"step":1}
markusg1234 commented 3 years ago

Hi, I am wondering where you got the DP ID's from? I have a different model flood light but can't find the PIR sensor ID. Regards, Markus

TheGabeMan commented 3 years ago

I combined this page: https://pypi.org/project/tinytuya/

With the Tuya dev portal, that shows what properties a device has. Then using localTuya discovery, I added a new device and looked at the ID's that were offered and their value. Then cancelled this adding of a device. Went into the LSC Home app on my phone, changed one setting, then again tried to add the device in LocalTuya and see which ID changed its value.

Took my quite some time to match all the IDs ;-)

pieterdevriesch commented 3 years ago

That's awesome, I hadn't thought of that method. I have the same device (Action) and am also hoping to integrate the sensor component as well, then I can just use the sensor value to have HA trigger the light. Did you have any more progress in the meantime @TheGabeMan ?

TheGabeMan commented 3 years ago

Well, no more progress was needed since using the above table I could add the floodlight to HA :-)

pieterdevriesch commented 3 years ago

Yes I can add the floodlight to HA no problem, but I'd like to get the motion sensor event into HA which I couldn't get working so far. I don't see a DP ID there for that (unless it's 56? Do you see that entity change during motion events?)

TheGabeMan commented 3 years ago

Ah haven't tried that since there is so much movement where my lamp is, I disabled this in the app.

pieterdevriesch commented 3 years ago

Ah that's unfortunate. It was basically the whole reason I got this lamp, as I already had a "dumb" sensor operated floodlight before. Unfortunately it's not possible to open it without destroying the glass and it's got too new firmware for tuya convert, so not many options left.

FrankZZ commented 2 years ago

@pieterdevriesch somebody on the dutch Tweakers forum got the PIR working: https://gathering.tweakers.net/forum/list_message/69335358#69335358

however; he states that the PIR only changes state if the light is in auto mode. Which means you still cannot trigger the light from HA, since it triggers itself

pieterdevriesch commented 2 years ago

@FrankZZ still not very useful then. In fact I'm about ready to throw this light in the garbage because even using the official Tuya app it somehow always turns back to Manual mode after about a day so it's even useless as a normal motion activated light.