Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up of Features from S Rutter #6

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open

Conversation

jonnywilliamson
Copy link
Owner

No description provided.

Changes to TPLinkManager to better handle discovered devices
Added a configurable timeout setting to device config
Exposed getConfig to public to allow easy querying of a devices config
Added powerOn, powerOff and powerStatus direct methods
…meout setting

Stopped stream_socket_client from generating warnings
Removed supression of stream_socker_client errors
…config

Renamed newTPLinkDevice to newDevice to simplify
Added various missing comment text
Fixed bug where IP where not resolving to string
…function to halt for a long period of time

- Fixed bug with the auto discovery function
…fferent commands based on device type E.G plug / bulb
shanerutter and others added 3 commits July 9, 2019 12:51
…his allows auto discovery and if you know you have x devices, no point in scanning the rest of the IP range if you have discovered all x devices already
@@ -10,7 +10,8 @@
}
],
"require": {
"tightenco/collect": "^5.3"
"tightenco/collect": "^5.3",
"s1lentium/iptools": "^1.1"
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest commit in this library has been tagged at 1.1.1 so using * previously here isn't necessary/a great practice

@jonnywilliamson
Copy link
Owner Author

@shanerutter

So I've finally gotten a new TPLink device, one with v2 hardware and and I can now test all these features.

I'm wondering if you can fill me in on a few things.

Can you give me a use case for the auto detect feature. I can test the code and see that it works to discover the devices on the network....but for what purpose? Unless I've missed it I can't see any persistence of this information BACK into the config file etc?

So are you saving this info else where to use at a later stage? Or do you always scan before sending a command to your devices? This seems a very slow way to do things.

Commit b348685 is a tweak at some of your code.

Thanks.

@shanerutter
Copy link

@shanerutter

So I've finally gotten a new TPLink device, one with v2 hardware and and I can now test all these features.

I'm wondering if you can fill me in on a few things.

Can you give me a use case for the auto detect feature. I can test the code and see that it works to discover the devices on the network....but for what purpose? Unless I've missed it I can't see any persistence of this information BACK into the config file etc?

So are you saving this info else where to use at a later stage? Or do you always scan before sending a command to your devices? This seems a very slow way to do things.

Commit b348685 is a tweak at some of your code.

Thanks.

The main reason for it was either during development to easily scan the network to find all your devices, I have 7 units across the house. I also dont use static IPs and was finding everynow and again the devices would lose there assigned IP and I would then need to edit the configs. This was my way to get around this, for example I setup a cronjob to run a artisan command every 24 hours to just check and update the configs / save the new IP address details to a database, I would then talk to the devices using the latest data in the database and/or populate the config variable so I can still hardcode values in the config if I wanted to.

I added the $maxDiscoveredDevices paramater, as it helps speed up the discovery side by looking for x number of devices, once we have all x found we know there is no more and stop discovering.

I didnt permentatly save the discovered device data into the config, as I never got around to it and wasnt 100% sure all users would want this. Maybe a new "->saveDeviceConfig()" option would be viable to allow the user the option to save the config after a discovery (im using a DB so wasnt 100% required for my usage at this point but would allow me to get rid of the DB in the future).

@jonnywilliamson
Copy link
Owner Author

The main reason for it was either during development to easily scan the network to find all your devices, I have 7 units across the house. I also dont use static IPs and was finding everynow and again the devices would lose there assigned IP and I would then need to edit the configs.

Ah I see. Yes I can see why you did this....although I think its funny that you spent so much time writing new code, scanning, sending to a database, making a cron job etc etc rather than just assign static IP addresses in your router!! Still the code is written now and it does work so that's fine.

I don't think I have any need/interest to expand on it at the moment though. I just thought I was missing something with regards how the results were persisted.

With regards to the code for all the lights and dimming etc are you happy that this all works as I have no plans of getting these devices and so cannot test that the code is working?

If it's all working then I'll merge this all.

Thanks for the PRs

@shanerutter
Copy link

The main reason for it was either during development to easily scan the network to find all your devices, I have 7 units across the house. I also dont use static IPs and was finding everynow and again the devices would lose there assigned IP and I would then need to edit the configs.

Ah I see. Yes I can see why you did this....although I think its funny that you spent so much time writing new code, scanning, sending to a database, making a cron job etc etc rather than just assign static IP addresses in your router!! Still the code is written now and it does work so that's fine.

I don't think I have any need/interest to expand on it at the moment though. I just thought I was missing something with regards how the results were persisted.

With regards to the code for all the lights and dimming etc are you happy that this all works as I have no plans of getting these devices and so cannot test that the code is working?

If it's all working then I'll merge this all.

Thanks for the PRs

Unfortunately certain people in my house hold think doing a hard reset on the route every couple weeks is a good thing to keep it healthy.... losing all the static range and then I would end up with DHCP allocating IPs causing massive conflicts.

@shanerutter
Copy link

With regards to the code for all the lights and dimming etc are you happy that this all works as I have no plans of getting these devices and so cannot test that the code is working?

I will upload a video this evening :)

@jonnywilliamson
Copy link
Owner Author

Oh - one more thing can you tell me what model number of smart bulbs can be controlled with your code?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants