zyonse / homebridge-dreo

Apple HomeKit integration for Dreo Smart Devices
https://www.npmjs.com/package/homebridge-dreo
Apache License 2.0
40 stars 20 forks source link

Dreo Ceiling Fan Support CLF521 & CLF521S #39

Open KadenThomp36 opened 6 months ago

KadenThomp36 commented 6 months ago

Is your feature request related to a problem? Please describe: Dreo Ceiling Fan Support CLF521 & CLF521S. Just installed 3 of these ceiling fans and attempted to add them with my homebridge server but it looks like they are not currently supported by the plugin.

Describe the solution you'd like: Officially support these celling fans so I could add them to my HomeKit

Additional context: I would attempt to update this plugin myself and perhaps I will but wanted to first request to see if this is still under active development, Thanks!

zyonse commented 6 months ago

What currently happens when you try to use them with the plugin? Do they appear in HomeKit at all?

zyonse commented 6 months ago

The best solution would probably to add each device's controls based on the "state" variable in platform.ts. Right now the plugin looks at device.productname and adds controls based on the device category.

Example of state variable contents from #37:

[30/04/2024, 20:37:57] [Dreo Platform] State: {
  wifi_rssi: { state: -39, timestamp: 1714502051 },
  poweron: { state: true, timestamp: 1714517054 },
  lifetime: { state: 2, timestamp: 1714523002 },
  scheid: { state: 0, timestamp: 1714502051 },
  hoscangle: { state: '-40,60', timestamp: 1714502051 },
  timeron: { state: { du: 0, ts: 1714415651 }, timestamp: null },
  scheon: { state: false, timestamp: 1714502051 },
  oscon: { state: true, timestamp: 1714502051 },
  mcuon: { state: true, timestamp: 1714502051 },
  mode: { state: 4, timestamp: 1714520163 },
  lightmode: { state: 2, timestamp: 1714502051 },
  network_latency: { state: 12, timestamp: 1714502051 },
  module_hardware_model: { state: 'HeFi', timestamp: 1714502051 },
  mcu_firmware_version: { state: '0.2.6', timestamp: 1714502051 },
  temperature: { state: 79, timestamp: 1714523821 },
  module_hardware_mac: { state: '001cc279c52a', timestamp: 1714502051 },
  hoscreset: { state: false, timestamp: 1714502051 },
  alignon: { state: false, timestamp: 1714502051 },
  purifylevel: { state: 255, timestamp: 1714502051 },
  muteon: { state: false, timestamp: 1714502051 },
  mcu_hardware_model: { state: 'midea', timestamp: 1714502051 },
  wifi_ssid: { state: 'Olympus', timestamp: 1714415652 },
  windlevel: { state: 7, timestamp: 1714502051 },
  tempunit: { state: 1, timestamp: 1714502051 },
  hangleadj: { state: 24, timestamp: 1714502051 },
  module_firmware_version: { state: '3.2.1', timestamp: 1714502051 },
  wrong: { state: 0, timestamp: 1714502051 },
  connected: { state: true, timestamp: 1714502051 },
  timeroff: { state: { du: 0, ts: 1714415651 }, timestamp: null },
  _ota: { state: 0, timestamp: 1714502051 },
  pm25: { state: 1, timestamp: 1714523686 },
  childlockon: { state: true, timestamp: 1714502051 },
  dispmode: { state: 1, timestamp: 1714502051 }
}
KadenThomp36 commented 5 months ago

Hey there @zyonse sorry for the late response and thank you for the quick response!

When adding the plugin in hombridge I get the following logs:

image

I am then able to go into the Home app and add each device but they all just say "Unsupported Device".

I noticed you have a switch statement that looks for the product name and am wondering if this is as simple as adding something like "Ceiling Fan" there or if it is more involved.

The functions of the fan are just it has a light with brightness levels (and warmth levels) and fan speeds.

Would love to hear your thoughts on this! Thanks!

KadenThomp36 commented 5 months ago

Hey just wanted to follow up and bump this @zyonse

zyonse commented 5 months ago

I’m working on fixing this in the dynamic-control-alloc branch. I just started an internship this week though so I haven’t had time to work on it more.

KadenThomp36 commented 5 months ago

Not a problem! Thanks for taking a look into it and I really appreciate it! Good luck with your internship!

zyonse commented 5 months ago

Can you see if this is working in v3.3.0?

KadenThomp36 commented 5 months ago

Hey, doesn't appear to be working.

image

I actually forked off your main and did some tinkering, its super messy but I found out the issue. they changed the property name for power state for ceiling fans.

image

Here is a super sloppy scratch pad where I got the fan working but not yet the light: https://github.com/zyonse/homebridge-dreo/compare/master...KadenThomp36:homebridge-dreo:master

zyonse commented 5 months ago

Thanks, should be a simple fix

zyonse commented 5 months ago

Can you test with the latest commits I just pushed? Also, can you run the plugin in debug mode and tell me what the output of the 'Control parameters: ' print statement is? (Need it to add support for the light)

Should look something like this:

[6/13/2024, 10:34:10 PM] [Dreo Platform] Control parameters:  [
  {
    id: '100',
    type: 'Mode',
    title: 'device_mode',
    items: [ [Object], [Object], [Object], [Object] ]
  },
  {
    id: '110',
    type: 'Speed',
    title: 'device_control_speed',
    items: [ [Object], [Object] ]
  },
  {
    id: '120',
    type: 'Oscillation',
    title: 'device_control_oscillation',
    items: [],
    cmd: 'shakehorizon'
  }
]
KadenThomp36 commented 5 months ago

@zyonse Hey sorry again about the delay, attached are the logs you requested. Not sure how to test with your latest commits, still on version 3.3 and redownloaded? Here are the logs after doing that. Homebridge A1E0 log (1).txt

Here is a snip of just the state

[15/06/2024, 21:48:08] [Dreo Platform] Accessory state: {
  wifi_rssi: { state: -46, timestamp: 1718476604 },
  scheid: { state: 0, timestamp: 1718476604 },
  timeron: { state: { du: 0, ts: 1717336437 }, timestamp: null },
  scheon: { state: false, timestamp: 1718476604 },
  mode: { state: 1, timestamp: 1718476604 },
  mcuon: { state: true, timestamp: 1718476604 },
  network_latency: { state: 149, timestamp: 1718476604 },
  module_hardware_model: { state: 'HeFi', timestamp: 1718476604 },
  mcu_firmware_version: { state: '2.1.8', timestamp: 1718476604 },
  colortemp: { state: 0, timestamp: 1718476604 },
  module_hardware_mac: { state: '001cc27df257', timestamp: 1718476604 },
  muteon: { state: true, timestamp: 1718476604 },
  lighton: { state: false, timestamp: 1718476604 },
  wifi_ssid: { state: 'ChungFi', timestamp: 1717336437 },
  mcu_hardware_model: { state: 'FP6063U/US', timestamp: 1718476604 },
  windlevel: { state: 12, timestamp: 1718476604 },
  wrong: { state: 0, timestamp: 1718476604 },
  module_firmware_version: { state: '3.2.3', timestamp: 1718476604 },
  connected: { state: true, timestamp: 1718476604 },
  timeroff: { state: { du: 0, ts: 1717336437 }, timestamp: null },
  predefine: { state: '0', timestamp: 1718476604 },
  _ota: { state: 0, timestamp: 1718476604 },
  brightness: { state: 8, timestamp: 1718476604 },
  scenes: {
    state: '{"mode":0,"du":600,"minbri":0,"maxbri":0}',
    timestamp: 1718476604
  },
  fanon: { state: false, timestamp: 1718476604 }
}
[15/06/2024, 21:48:08] [Dreo Platform] R
zyonse commented 5 months ago

My bad, thought you had the build system set up. I just pushed a beta version that you can install through the homebridge ui by clicking "manage version" under the plugin.

KadenThomp36 commented 5 months ago

@zyonse Since installing beta I am getting an infinite boot loop for the dreo bridge. Here is the non-debug output

[16/06/2024, 21:02:20] [Dreo Platform] Process Ended. Code: 1, Signal: null
[16/06/2024, 21:02:27] [Dreo Platform] Restarting Process...
[16/06/2024, 21:02:27] [Dreo Platform] Launched child bridge with PID 783823
[16/06/2024, 21:02:27] [Dreo Platform] Loaded homebridge-dreo v3.3.1-beta.0 child bridge successfully
[16/06/2024, 21:02:27] [Dreo Platform] Loading accessory from cache: Guest Bedroom
[16/06/2024, 21:02:27] [Dreo Platform] Loading accessory from cache: Loft
[16/06/2024, 21:02:27] [Dreo Platform] Loading accessory from cache: Office Fan
[16/06/2024, 21:02:27] [Dreo Platform] Country: US
[16/06/2024, 21:02:27] [Dreo Platform] Region: NA
[16/06/2024, 21:02:27] [Dreo Platform] Restoring existing accessory from cache: Guest Bedroom
[16/06/2024, 21:02:27] [Dreo Platform] Child bridge process ended
[16/06/2024, 21:02:27] [Dreo Platform] Process Ended. Code: 1, Signal: null

Here is the debug output

[16/06/2024, 21:04:45] [Dreo Platform] Restarting Process...
[16/06/2024, 21:04:45] [Dreo Platform] Launched child bridge with PID 784159
[16/06/2024, 21:04:45] [Dreo Platform] Loaded homebridge-dreo v3.3.1-beta.0 child bridge successfully
[16/06/2024, 21:04:45] [Dreo Platform] Finished initializing platform: Dreo Platform
[16/06/2024, 21:04:45] [Dreo Platform] Loading accessory from cache: Guest Bedroom
[16/06/2024, 21:04:45] [Dreo Platform] Loading accessory from cache: Loft
[16/06/2024, 21:04:45] [Dreo Platform] Loading accessory from cache: Office Fan
[16/06/2024, 21:04:46] [Dreo Platform] Executed didFinishLaunching callback
[16/06/2024, 21:04:46] [Dreo Platform] 
[16/06/2024, 21:04:46] [Dreo Platform] Country: US
[16/06/2024, 21:04:46] [Dreo Platform] Region: NA
[16/06/2024, 21:04:46] [Dreo Platform] 
[16/06/2024, 21:04:46] [Dreo Platform] wss://wsb-us.dreo-cloud.com/websocket?accessToken=1bdd2eef-fc36-4040-addf-fd6e227c4d10&timestamp=1718586286411
[16/06/2024, 21:04:46] [Dreo Platform] Accessory state: {
[16/06/2024, 21:04:46] [Dreo Platform] Restoring existing accessory from cache: Guest Bedroom
[16/06/2024, 21:04:46] [Dreo Platform] Control parameters:  [
[16/06/2024, 21:04:46] [Dreo Platform] Child bridge process ended
[16/06/2024, 21:04:46] [Dreo Platform] Process Ended. Code: 1, Signal: null
[16/06/2024, 21:04:53] [Dreo Platform] Restarting Process...

Let me know if there is anything else I can help with!

brentmw commented 4 months ago

I also would love this enhancement.

zyonse commented 4 months ago

@KadenThomp36 Does the debug output have any additional info?

josecarlosc commented 4 months ago

I’m having the same problem with CLF513S, but it should be the same solution as the other models. I’m getting “ unhandled rejection: TypeError: Cannot read properties of undefined (reading 'state') “

zyonse commented 4 months ago

@josecarlosc Can you send me an email? Need some additional info, you should be able to find my email on my GitHub account.

zyonse commented 4 months ago

Just published a new beta version that should fix the crashing. Still working on light support.

martincalvert commented 4 months ago

Can confirm the beta works for CLF521 fans

zyonse commented 4 months ago

Is the light control just on/off or is it dimmable/RGB?

martincalvert commented 4 months ago

on the CLF-521S & CLF-513S are dimmable and white temperature adjustable. The 712S has a white dimmable with temp adjustable as well a dimmable RGB light.

The fan has 12 speeds in the app.

The lights are all 0-100% dimmable

martincalvert commented 3 months ago

Anything I can do to assist with this?

KadenThomp36 commented 3 months ago

Since all I have are the ceiling fans I cleaned up my fork of your repo and made it work just for ceiling fans. Not sure where this stands currently but if you want to see what works here is the repo https://github.com/KadenThomp36/homebridge-dreo let me know if there is anything I can help with @zyonse

martincalvert commented 3 months ago

Any update? If you wanted to push up what you have to a branch I could finish it off.

zyonse commented 1 month ago

Can you update to the 4.0.0 beta version and pull logs in debug mode again? (you can find it by going to manage version in the homebridge gui) I added some print statements for the control schema that should help us get this sorted out.

martincalvert commented 1 month ago

Debug logs emailed to you.

zyonse commented 1 month ago

From the logs you sent, it looks like color temp is a value of 0-100 in the Dreo app. Does 0 represent the coolest value or the warmest value?

martincalvert commented 1 month ago

0 is the warmest value.

martincalvert commented 2 weeks ago

Any update? Anything else needed?