homebridge-tplink-smarthome icon indicating copy to clipboard operation
homebridge-tplink-smarthome copied to clipboard

Move HS-300 to surge protector outlet icon

Open roberkane212 opened this issue 1 year ago • 39 comments

Current Situation

Currently all plugs show separately as individual outlets not all as one

Proposed Change

That it will show as it is a power strip instead of individual outlets

roberkane212 avatar Mar 07 '23 03:03 roberkane212

I currently have homebridge-tuya installed and have no issue with that plugin showing it IMG_1660

roberkane212 avatar Mar 07 '23 03:03 roberkane212

@plasticrake I am looking to get some of the Kasa HS-300 power strips, but I would like for this functionality. I don't know much in the way of coding, but I did find the following information out about this: It seems that Tuya adds multiple outlet services to the same accessory. I am not sure how to do this but would be willing to test anything that comes up.

https://github.com/iRayanKhan/homebridge-tuya/blob/main/lib/MultiOutletAccessory.js https://github.com/iRayanKhan/homebridge-tuya/wiki/Supported-Device-Types#smart-power-strips

ZeliardM avatar Feb 21 '24 14:02 ZeliardM

@plasticrake what can I do to help?

roberkane212 avatar Feb 21 '24 15:02 roberkane212

I was able to create this with the homebridge-meross plugin, I will take a stab at this one and see if I can create a PR.

ZeliardM avatar Mar 06 '24 04:03 ZeliardM

@ZeliardM let me know if I can help in anyway

roberkane212 avatar Mar 06 '24 15:03 roberkane212

I’m going to have to see, I just ordered an HS300 and will see what happens when I get it. Will start working on the code now.

ZeliardM avatar Mar 06 '24 18:03 ZeliardM

I was able to get the basic premise done for this. Had to make api calls in the plugin because the built api doesn't support passing the childId as an argument, but right now I have basic functionality up and working, just need to clean it up and fix some of the status updates in HomeKit. Once I'm finished, I'll push a PR to let them merge it if they're good with it and maybe can get them to update the API to support passing the childId and that may clean it up even more.

ZeliardM avatar Mar 12 '24 03:03 ZeliardM

@ZeliardM thats awesome. Again let me know if there’s anything I can do

roberkane212 avatar Mar 12 '24 03:03 roberkane212

The code has been cleaned up and the PR has been submitted. We will see what the dev says and go from there. Until then, I'm going to keep running my local copy, lol

ZeliardM avatar Mar 12 '24 23:03 ZeliardM

@ZeliardM awesome, hopefully he responds to this asap

roberkane212 avatar Mar 12 '24 23:03 roberkane212

@ZeliardM I wish I knew more coding. I’d get run a local copy myself lol

roberkane212 avatar Mar 12 '24 23:03 roberkane212

@ZeliardM i see you have a forked version of the plugin. Is there anyway for me to install it by chance?

roberkane212 avatar Mar 15 '24 00:03 roberkane212

I would not as the dev hasn't tested everything and I may have made mistakes. I cannot support it like they did.

ZeliardM avatar Mar 15 '24 00:03 ZeliardM

@ZeliardM I have against you saying so installed your fork, however when I changed plug to power strip. It says it’s not supported. I know you can not support your version that’s much. But the power strip this the only item I use with this plugin and would really appreciate your help. If it doesn’t work as well. I will go back to original version

roberkane212 avatar Mar 20 '24 15:03 roberkane212

What did you change from plug to power strip? The process for my change is to check a box under the HomeKit (Optional) configuration to enable creating a power strip. Leave all the rest of your stuff alone and put it back to plug. That is a reference to his api that I did not change.

ZeliardM avatar Mar 20 '24 15:03 ZeliardM

@ZeliardM ok I must have not install yours right. Because I don’t have the option.

roberkane212 avatar Mar 20 '24 15:03 roberkane212

@ZeliardM did you have to remove the original plugin, to make your changes?

roberkane212 avatar Mar 20 '24 16:03 roberkane212

No, just need to run the following command from the terminal in the homebridge web console: npm install ZeliardM/homebridge-tplink-smarthome

Again, I'm not responsible for anything that happens when and if you choose to do this nor will I support any problems you have.

I have told you I don't support this as it is the plugin creators invention and I'm trying to help out but I'm not taking over.

ZeliardM avatar Mar 20 '24 16:03 ZeliardM

@ZeliardM Yes thank you I appreciate it, and again if there is an issue I will go back to original. How I have ran what you told me in terminal and still don’t have the option. Thank you again for your help. I know your don’t plan to support

roberkane212 avatar Mar 20 '24 16:03 roberkane212

Did you restart Homebridge or child bridge after you ran the command?

ZeliardM avatar Mar 20 '24 16:03 ZeliardM

@ZeliardM yes but when I ran the command I got a few error messages back. So I’m guessing it did not install

roberkane212 avatar Mar 20 '24 16:03 roberkane212

Most likely, what were the error messages?

ZeliardM avatar Mar 20 '24 16:03 ZeliardM

@ZeliardM npm ERR! code 127 npm ERR! git dep preparation failed npm ERR! command /opt/homebridge/bin/node /opt/homebridge/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/home/pi/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run npm ERR! > [email protected] prepare npm ERR! > npm run build npm ERR! npm ERR! npm ERR! > [email protected] prebuild npm ERR! > npm run clean npm ERR! npm ERR! npm ERR! > [email protected] clean npm ERR! > rimraf lib/ build/ npm ERR! sh: 1: rimraf: not found npm ERR! npm ERR! code 127 npm ERR! npm ERR! path /home/pi/.npm/_cacache/tmp/git-cloneUsurQf npm ERR! npm ERR! command failed npm ERR! npm ERR! command sh -c npm run build npm ERR! npm ERR! npm ERR! A complete log of this run can be found in: /home/pi/.npm/_logs/2024-03-20T16_47_49_792Z-debug-0.log

npm ERR! A complete log of this run can be found in: /home/pi/.npm/_logs/2024-03-20T16_47_37_291Z-debug-0.log

roberkane212 avatar Mar 20 '24 16:03 roberkane212

Ah, I remember. Had to run npm install -g rimraf first. Something in the deployment missing for manually installing.

ZeliardM avatar Mar 20 '24 16:03 ZeliardM

@ZeliardM ok so run npm install-g rimraf. Then run your npm install ZeliardM/homebridge-tplink-smarthome. Right?

roberkane212 avatar Mar 20 '24 16:03 roberkane212

Yes

ZeliardM avatar Mar 20 '24 16:03 ZeliardM

@roberkane212 any luck?

ZeliardM avatar Mar 20 '24 18:03 ZeliardM

@ZeliardM yes it worked thank you!!!!!

roberkane212 avatar Mar 20 '24 19:03 roberkane212

@ZeliardM had to use tcp communication to get it to work though

roberkane212 avatar Mar 20 '24 19:03 roberkane212

Ok, udp worked for me, so it could be a difference in models or something else. But glad to help.

ZeliardM avatar Mar 20 '24 19:03 ZeliardM