teodoradima / homebridge-samsung-air-conditioner-smart-things

Apache License 2.0
28 stars 16 forks source link

const AC_DEVICE_NAME #17

Open StoreEverything opened 2 years ago

StoreEverything commented 2 years ago

https://github.com/teodoradima/homebridge-samsung-air-conditioner-smart-things/blob/4c6405a9e0c31c89bf0b7dec0ebcab46c082e143/src/samsungApi.ts#L3

Looking at API response, should this change to

const AC_DEVICE_NAME = 'Samsung Room A/C';

StoreEverything commented 2 years ago

After making the above change to the file on my local machine, once I reloaded homebridge the AC units are all found as expected.

Either the AC_DEVICE_NAME needs to be updated to the suggest change, or the code needs adjusting so that more than one AC_DEVICE_NAME can be checked when looking at the api response for legacy AC units.

I believe a firmware update pushed to the AC units changed the reported device name in the api.

StoreEverything commented 1 year ago

I now have two types of Device Name

"name":"Air Conditioner" and "name":"Samsung Room A/C"

StoreEverything commented 1 year ago

Not nice, not clean, not best solution, but works.

const AC_DEVICE_NAME = 'Samsung Room A/C'; const AC_DEVICE_NAME_2 = 'Air Conditioner';

    return items.filter(item => item.name === AC_DEVICE_NAME || item.name === AC_DEVICE_NAME_2);
ftorres83 commented 1 year ago

Hi, i've installed this plugin in my hombebridge on raspberry pi. Where i can find the samsungApi.ts file to edit it so the plugin finds my ACs.

thnx.

manieridimambro commented 1 year ago

is on /homebridge/node_modules/homebridge-samsung-air-conditioner-smart-things/dist/samsungApi.js

Hi, i've installed this plugin in my hombebridge on raspberry pi. Where i can find the samsungApi.ts file to edit it so the plugin finds my ACs.

thnx.

FLgator86 commented 1 year ago

Just wanted to say thanks @StoreEverything! Total newbie here, just installed Homebridge on an Rpi yesterday and managed to get my Tapo Lights/Plugs, SwitchBot Locks, Ring Cameras/Security devices, Smart Blinds and LG TV up and running alongside all my native HomeKit devices. My Samsung WindFree ACs were the only thing I couldn’t manage to get into HomeKit until I found your advice in this thread.

Just to pay it forward, for those (like me) that don’t know what you’re doing, this fix works perfectly right within the HomeBridge UI with the following steps:

  1. Launch Terminal from the menu (three dots/hamburger) at the upper right corner of your HomeBridge UI.

  2. Type: cd node_modules/homebridge-samsung-air-conditioner-smart-things/dist this just opens the folder/directory where the js file you need to edit is saved. Thanks to @manieridimambro for pointing me in the right direction.

  3. Type: nano samsungApi.js noting that this is case-sensitive. This will open the text editor in terminal.

  4. Modify the highlighted code, replacing the outdated code as described by @StoreEverything at the start of this thread:
    9881118E-F5F9-45D2-BE62-B8A4B67058CC

  5. Once you’re done, use the keyboard shortcut ‘Ctrl+X’ to exit the text editor and ‘Y’ to save your edits.

  6. Type exit to finish up in Terminal and restart HomeBridge.

That’s it… You should now see your Samsung AC unit(s) appear in the Home app! This should do the trick, at least until one of the PRs for the plug-in is accepted/published. F90E0044-77F2-4BF1-9997-FFB7471E711E

unodavide commented 1 year ago

Thank you, @StoreEverything for this fix, and @manieridimambro and @FLgator86 for explaining how to implement it. This worked like a charm!

armandkamffer commented 1 year ago

Just wanted to say thanks @StoreEverything! Total newbie here, just installed Homebridge on an Rpi yesterday and managed to get my Tapo Lights/Plugs, SwitchBot Locks, Ring Cameras/Security devices, Smart Blinds and LG TV up and running alongside all my native HomeKit devices. My Samsung WindFree ACs were the only thing I couldn’t manage to get into HomeKit until I found your advice in this thread.

Just to pay it forward, for those (like me) that don’t know what you’re doing, this fix works perfectly right within the HomeBridge UI with the following steps:

  1. Launch Terminal from the menu (three dots/hamburger) at the upper right corner of your HomeBridge UI.
  2. Type: cd node_modules/homebridge-samsung-air-conditioner-smart-things/dist this just opens the folder/directory where the js file you need to edit is saved. Thanks to @manieridimambro for pointing me in the right direction.
  3. Type: nano samsungApi.js noting that this is case-sensitive. This will open the text editor in terminal.
  4. Modify the highlighted code, replacing the outdated code as described by @StoreEverything at the start of this thread: 9881118E-F5F9-45D2-BE62-B8A4B67058CC
  5. Once you’re done, use the keyboard shortcut ‘Ctrl+X’ to exit the text editor and ‘Y’ to save your edits.
  6. Type exit to finish up in Terminal and restart HomeBridge.

That’s it… You should now see your Samsung AC unit(s) appear in the Home app! This should do the trick, at least until one of the PRs for the plug-in is accepted/published. F90E0044-77F2-4BF1-9997-FFB7471E711E

It seems on my side the device name on the API for my aircon is "Samsung-Room-Air-Conditioner". The best approach might be to use the steps above to identify your aircon name and potentially override the constant value using a config value if presented.

vMoff commented 1 year ago

It seems on my side the device name on the API for my aircon is "Samsung-Room-Air-Conditioner". The best approach might be to use the steps above to identify your aircon name and potentially override the constant value using a config value if presented.

thank you!

i visited the API devices page (https://api.smartthings.com/v1/devices) and found mine was also "Samsung-Room-Air-Conditioner"

all working now.

Alanko5 commented 1 year ago

simply and clever solution:

const AC_DEVICE_NAMES = ['Samsung Room A/C','Air Conditione'];
...
...
...
return items.filter(item => AC_DEVICE_NAMES.includes(item.name));
thomasbouhier commented 1 year ago

@FLgator86 @StoreEverything @armandkamffer Where can I find and edit the file mentioned in you step 2 ? When I tap the command cd node_modules/homebridge-samsung-air-conditioner-smart-things/dist in my terminal, it doesn’t open the file, instead I get the message "cd: no such file or directory: node_modules/homebridge-samsung-air-conditioner-smart-things/dist"

thomasbouhier commented 1 year ago

I found my answer : if you installed Homebridge on MacOS, the file you need to edit (samsungApi.js) is in : /usr/local/lib/node_modules/homebridge-samsung-air-conditioner-smart-things/dist

To find it, you first need to show hidden files in you Finder. To do so you can use (when you are in you Finder) the shortcut : Command + Shift + .

vytautas532 commented 1 year ago

I installed Homebridge on Linux, where can I find and edit the file?

Alanko5 commented 1 year ago

I installed Homebridge on Linux, where can I find and edit the file?

https://github.com/teodoradima/homebridge-samsung-air-conditioner-smart-things/issues/17#issuecomment-1439506006

vytautas532 commented 1 year ago

when I paste the command: cd node_modules/homebridge-samsung-air-conditioner-smart-things/dist i get the messege: bash: cd: node_modules/homebridge-samsung-air-conditioner-smart-things/dist: No such file or directory

Norbi99-dev commented 1 year ago

I have 3 AC units. All of them used to work fine before. Doing this recommended fix gets one of them working. Any idea how to get the other 2? thanks

Norbi99-dev commented 1 year ago

simply and clever solution:

const AC_DEVICE_NAMES = ['Samsung Room A/C','Air Conditione'];
...
...
...
return items.filter(item => AC_DEVICE_NAMES.includes(item.name));

How would I use this to loop through different device names? I have 3 units, called: "name":"Samsung Room A/C" "name":"Samsung-Room-Air-Conditioner" "name":"Samsung-Room-Air-Conditioner"

Thanks

Norbi99-dev commented 1 year ago

simply and clever solution:

const AC_DEVICE_NAMES = ['Samsung Room A/C','Air Conditione'];
...
...
...
return items.filter(item => AC_DEVICE_NAMES.includes(item.name));

How would I use this to loop through different device names? I have 3 units, called: "name":"Samsung Room A/C" "name":"Samsung-Room-Air-Conditioner" "name":"Samsung-Room-Air-Conditioner"

Thanks

Got it working. The return items.filter line needs to replace the line in the getDevices block.

djtucci commented 1 year ago

when I paste the command: cd node_modules/homebridge-samsung-air-conditioner-smart-things/dist i get the messege: bash: cd: node_modules/homebridge-samsung-air-conditioner-smart-things/dist: No such file or directory

Type: cd /usr/lib/node_modules/homebridge-samsung-air-conditioner-smart-things/dist this just opens the folder/directory where the js file you need to edit is saved. Thanks to @manieridimambro for pointing me in the right direction.

Type: nano samsungApi.js noting that this is case-sensitive. This will open the text editor in terminal.

patrickyan commented 4 months ago

For me, the change was

const AC_DEVICE_NAME = '[system a/c] Samsung';