bren1818 / TCPLightingWebInterface

Web App interface to control the "Connected by TCP" bulbs
MIT License
30 stars 15 forks source link

Comments, Questions, open forum (2) #6

Open bren1818 opened 7 years ago

bren1818 commented 7 years ago

Closed the last topic as it had gotten really lengthy. Opening this one for more questions

merrickw commented 7 years ago

Thanks Bren for your previous responses; looking forward to any IFTTT or SmartThings development to keep these bulbs alive into the future ...

merrickw commented 7 years ago

Hi Bren,

Happy New Year!

Just curious if you have any thing in the works for IFTTT or SmartThings? Ultimately I'd love to get Google Home to control these bulbs.

Regards, Merrick

bren1818 commented 7 years ago

Hey @merrickw - nothing yet. Smart things requires me to have the Samsung Bridge which I dont have. I did look into the IFTTT. They have an applet for 'Connect Greenwave Systems' which of course doesnt work since it's tied to the Greenwave servers they took down... So I have 'applied' to be a maker: image Which is still labelled as 'coming soon'. I mean all we really need is an applet which allows http requests, so it shouldn't be hard, but its likely harder than what IFTTT wants for the average user...

I have been re-writing some of the code, so I can support more than one bridge at a time and control HUE lights too (inc colour). It's not really ready for prime time... Needs some polish, but if you want to experiment it is in the non master branch.

Cheers

merrickw commented 7 years ago

Thanks for the update. The IFTTT sounds the most interesting, but I guess it can only work if you have your local web server running... which makes sense, you wouldn't want the cloud turning off your lights, with all the hacking going on .... I haven't bought any Hue lights yet ... my TCP's got me covered ...

k8gg commented 7 years ago

Now that the Greenwave link got sacked, the clock resides in my TCP gateway is drifting away every single day. So over last 6 months or so, mine is now like 20-30 minutes ahead. Sunrise/sunset schedule would be way off also.

So, quick questions: Is there a way to correct the clock in gateway via some UI on local web server? Or better yet, get the clock to sync with local web server automatically/periodically?

Count this as a feature request. :)

Oh BTW, I was talking about the clock inside the gateway. I understand that the scheduler on local web server would trigger just fine.

And, great work Bren! I'm excited!!

bren1818 commented 7 years ago

@k8gg Hey there - I'm guessing you're looking at the regular branch versus dev? I'll look into time setting. I'm fairly certain it will be possible. Stay tuned...

k8gg commented 7 years ago

Yes, branch. Great work you've got so far! Also the IFTTT idea sounds awesome. :)

bren1818 commented 7 years ago

@k8gg - Done - pull master, should have 3 updates, index.php, setDateTime.php and a JS file. I have made the new screen to set date and time. I kinda whipped it together... so hope it works. Pretty simple. There appears to be functions to set time zone too, but this should do the trick... I don't use the built in Bridge functions so please let me know. Thanks!

image

sktaylortrash commented 7 years ago

This date tweak worked awesome for me thanks so much

bren1818 commented 7 years ago

@sktaylortrash - Awesome glad to hear it. I just need to find some time to finish the build I have in progress in Dev which has Hue integration and hooks for multiple bridges. Not enough hours in a day :)

k8gg commented 7 years ago

Yup. The date/time update interface worked. Thanks a lot @bren1818 !

sktaylortrash commented 7 years ago

@bren1818 forgive my asking but what would the use case for multiple bridges be?

k8gg commented 7 years ago

My guess: to have one single web UI that would control not only TCP bulbs but also Hue or wemo or even zwave bulbs... Yes?

On Jan 31, 2017 8:21 PM, "sktaylortrash" notifications@github.com wrote:

@bren1818 https://github.com/bren1818 forgive my asking but what would the use case for multiple bridges be?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bren1818/TCPLightingWebInterface/issues/6#issuecomment-276546536, or mute the thread https://github.com/notifications/unsubscribe-auth/AYOM2_N5MOeC6QtoLMjkULpEwk4rtE2Nks5rX94ZgaJpZM4LEhw5 .

sktaylortrash commented 7 years ago

Oh I get multiple brands I meant multiple TCP bridges

bren1818 commented 7 years ago

@sktaylortrash - reason for multiple TCP bridges is two fold. I bought up some of the bridge packs when they were clearing them out. At one point I accidentally messed up my bridge, which required me to re-flash it and downgrade the firmware. Before I got it to work again, I got kind of frustrated and started setting up a second bridge so I could continue development on this project and so I could control my bulbs via a web interface. This meant re-setting up all my existing bulbs on the new bridge. Its a lengthy thing to do, so I was tackling it room by room, every few days. When I eventually got my initial bridge working again, I had half my bulbs on one bridge and the other half on the other bridge. I was going to migrate all the bulbs back to one bridge, however - by having two bridges it offered one advantage, since I use remotes, having one bridge meant I only had 4 buttons to control all the lights in my house, both upstairs and downstairs. By having a second bridge, I could pair half my remotes with the downstairs, and half the remotes with the upstairs, meaning I had 8 buttons to control the house. Not a huge deal, but comes in handy when you're fumbling around in the dark, so you dont turn on the whole house but half of it :)

@k8gg is also right. I wanted to extend my project to work with at least Hue since I have some Hue lights, and by having two TCP bridges, it allows me to test code compatibility with multiple hubs.

Hope that answers your question 👍

sktaylortrash commented 7 years ago

@bren1818 so I totally should have thought of the remote thing. I have 3 in a drawer I'll never use for that reason. May need to pickup another bridge or two. It's not like I now have 24 bulbs running or anything :)

merrickw commented 7 years ago

Another way to use 2 remotes and have 8 zones is to keep 4 bulbs off the gateway, and connect to a remote directly. I did this so one remote controls 4 bulbs in my upstairs bedroom, off the gateway. The main floor is on the gateway. This works perfectly since I don't need scheduling or remote access for my bedroom lights, just the handy remote. The support guys at TCP walked me through how to set that up.

bren1818 commented 7 years ago

@sktaylortrash haha, I can't say I have that many either... but in the bedroom, we have two lamps on either side of the bed and 3 bulbs acting as one appliance in the ceiling fan, so it's nice to have the remote to turn on/off and dim the lights that way. I stuck some Velcro on the back of the remotes (I have 5 of them) and stuck them to the wall to use as a switch too. They're handy but at the same time, remotes... remotes everywhere haha

@merrickw makes a very good point too. You don't necessarily need to bridges to accomplish this. It just sorta worked out that way for me.

vijimaini commented 7 years ago

Hi Bren, I read about this project and am excited that I can possibly now remotely connect to my bulbs from outside the house. I have setup IIS on windows machine with web application addons for php. My problem is I cannot get token from tcp box. I press the Sync button on the TCP box with green leds blinking around and then on the windows machine browser I type http://localhost/index.php. The browser connects to tcp box and says waiting for local host. Finally it says with error "Firefox has detected that server is redirecting the request for this address in a way that will never complete" I have added ip adresss in the include.php. The version of firmware on the tcp box is 3.0.80. Could this version be causing issues.
Please advise how I can get token. My tcp app on iPad and iPhone work fine when I am at home on local LAN

Thanks Viji

bren1818 commented 7 years ago

Hi @vijimaini - shouldn't be an issue, I'm pretty sure my bridges have the latest firmware. The more likely issue is you're using IIS. - I cant say I have tested with IIS.

In your IIS folder, could you create a simple php file like: <?php echo "Hello World"; ?> and see if you can load that? It could also be that with IIS you do not have the curl library being loaded.

I recommend you download XAMPP and try the project in there first. Let me know if that helps.

Cheers!

vijimaini commented 7 years ago

Bren, I installed XAMPP and it works perfectly. Thanks for your help.

bren1818 commented 7 years ago

@vijimaini Glad to hear that. When you use IIS, you'd likely have needed to enable some php extensions which come pre-enabled on xampp. Fortunately you can use Apache and IIS simultaneously.

Cheers,

Bren

shrms commented 7 years ago

Hi Bren, I am newbie to development, could you please me setting this up. I am NAS storage. Is there any documentation that can help me seeting up from scratch, as i ddon't have development background. Regards

bren1818 commented 7 years ago

@shrms - Sure, its pretty straightforward and you wont need any development experience. You will however need to have a bit of knowledge about home networking.

So first things first, download yourself XAMPP: https://www.apachefriends.org/index.html its free. I suggest getting the version with PHP 5.6.3 image

Install the application, if you use the defaults, it will set you up an htdocs folder in: C:\xampp\htdocs

this is the folder you want to download this project into. So download the zip image

and extract its contents into the folder, the htdocs folder should look something like this:

image

now the tricky part, using a text editor of your choice, (I suggest Notepad++) and edit the include.php file.

You can leave pretty much everything as is, with one exception - edit LINE 8, and replace the IP address with the local IP address of your lighting bridge.

image

You can usually find this in your routers DHCP/client listing. Once you have the IP in there, save the file,.

Press the Sync button on your bridge, and then open up localhost. (go to a browser and type: http://localhost)

In theory, that's it, it should display your pre-setup bulbs and allow you to control them. Let me know if you have any problems. There should also be some documentation here: https://github.com/bren1818/TCPLightingWebInterface/issues/3 and https://github.com/bren1818/TCPLightingWebInterface/issues/1 which may be of use.

Best of luck!

shrms commented 7 years ago

Hi Bren, Thanks for sending the instructions, i follwed the same and updated the IP address aswell. I got below message

'If you are seeing this, you haven't generated your token yet. Could not fetch token. Ensure you have the correct IP for your bridge and that you have hit the sync button before running this. Since you ae not using the token file option, ensure you paste your token in the include.php.

Regards

bren1818 commented 7 years ago

@shrms - are you sure you pressed the sync button and have the correct IP of your bridge? As for the token file, did a "tcp.token" file get generated in the htdocs folder?

If you have the right IP for you bridge, in theory you can navigate to: https://{BRIDGE-IP}/gwr/

If you get a "privacy error" (this is from the Bridge, not my code) just allow it and see if the page resolves. If the request times out, you likely have the wrong IP.

You can also try changing the LIGHTING_PORT (line 9) to 80 instead of 443, but most bridges will be on 443.

vijimaini commented 7 years ago

Hi @bren1818 - is there a way to setup sunset and sunrise time. This feature using IOS app does not work. The tcp device must have been getting this information from the Gwr server, before it shutdown. The feature to adjust time is great. The time on my device was out by 35 minutes. Thanks

bren1818 commented 7 years ago

@vijimaini I haven't developed code yet to work with the sunrise/sunset natively, but I did develop a scheduler which triggers the lights at programmed times using the underlying API for this app. I'll have a look to see if I can emulate or develop that function, but I never used it.

Cheers

vijimaini commented 7 years ago

@bren1818 Ok, I was wondering if the sunset / sunrise values were stored on device that was updated daily from cloud. The API test script shows value to be sunset, which means it may be stored somewhere on device. Thanks

bren1818 commented 7 years ago

@vijimaini Im fairly certain the cloud stuff has been disabled altogether. The bridge used to have a nice web interface, but it was removed during one of the bridge updates. I have the older firmware files for the bridges, however the cloud update is still on, so even if you go through the tricky downgrade process, when the bridges phone home, they re-update unless you block the domain on your network.

Which API showed you the desired value? (sunset?) I'm guessing the sunrise/sunset you're referring to was one of the 'smart controls'. I can probably look into whipping something up to edit that. I thought I had, but perhaps not. I've been working on a newer build of this, which handles multiple bridges and is quicker, but haven't had the time lately to hunker down and get to it haha, maybe in the near future :)

vijimaini commented 7 years ago

This is where I saw sunset from get scene list GWSceneGetList Array ( [version] => 1 [rc] => 200 [enable] => 1 [scene] => Array ( [0] => Array ( [sid] => 1 [active] => 0 [name] => Home [desc] => Home [order] => 0 [type] => schedulecustom [icon] => images/scene/home.png [islocal] => 1 [every] => 0,1,2,3,4,5,6 [starttime] => sunset [stoptime] => 23:15

Thanks Viji

shrms commented 7 years ago

Hi Bren,

Yes, i pressed the sync button, but no file got generated in htdocs folder.

Yes, Ip is correct, even i tried with https://{BRIDGE-IP}/gwr/ but in am getting 403 forbidden. I checked in both ports but no luck.

MSG that i am getting now is.:

GWR Command not returned, this likely indicates your token is expired, or invalid.

Remove token and try regenerating a new one.

If you are continuously seeing this message, ensure the folder is writeable or that tcp.token is writeable

bren1818 commented 7 years ago

@shrms hmm that is odd. What operating system and web server are you using? On your router are your ips set as static or do they expire?

shrms commented 7 years ago

Bren ..i am on windows 7 and i installed XAMPP. On router its static ip on router.

Attached is picture of my tcp device 20170316_233017_hdr

bren1818 commented 7 years ago

@shrms - Any luck getting it to work? If you are getting 403 forbidden, technically the bridge is communicating. I'm thinking either you do not have curl enabled (it should be by default with XAMPP so thats a head scratcher) or perhaps you have an over-active firewall. Did you allow XAMPP to communicate with local networks when you installed it?

You can also try the build in my DEV Branch if you like, please let me know!

shrms commented 7 years ago

Hi Bren, I was travelling, today again i checked but its same message 'GWR Command not returned'

How can i try the build in your dev branch, you might need to guide me a bit there.

bren1818 commented 7 years ago

@shrms hope the travelling was good, my thought is if you're getting the Command not returned, it means either CURL is not working (make sure it is enabled in PHP - it should be since you said you're using XAMPP and it is enabled by default) or you perhaps have a firewall rule which is blocking the traffic (most likely), OR you have the wrong IP of the bridge, which I'm pretty sure you dont.

Try disabling your firewall for starters, and then go to a wired connection. Beyond that...

quick question - are you Windows and if so are you on Wifi?

The link to the dev branch is here:

https://github.com/bren1818/TCPLightingWebInterface/tree/Dev very simiar setup to the standard branch, im just testing some other things out...

ghost commented 7 years ago

Random question does anyone remember how to pair a remote to a bulb without a gateway. Was gonna give my parents some bulbs and a remote but can't remember how

merrickw commented 7 years ago

I saved these instructions from TCP support:

II. No Gateway, remote only

3) Resetting the remote (remove from gateway and bulbs)

(Remote Factory Reset):

If you are sure you want to reset the remote control, use the following steps:

  1. Remove the battery cover from the back of the remote control.
  2. Remove the batteries from the remote control.
  3. Press and hold the Program button.
  4. While still pressing the Program button, reinsert the batteries into the remote control.
  5. Release the Program button.

4) Resetting the bulbs:

1.) Take the lamps from the gateway you are NOT using and insert them into a socket (preferably one that is controlled by a switch).
2.) You will begin with the lights turned OFF
3.) Power cycle the lights 3 times by turning them on/off, on/off, on/off - after three, turn them on for a fourth time and leave them on - after several seconds, the bulbs should start pulsing, which means they are ready to be paired.

5) Pair the bulbs with your factory reset remote:

1. With the bulb dimming and brightening, take your factory reset remote and press and hold the first lighting group button.
2. The indicator light for that particular lighting group should begin to flash steadily, this means that the lighting group is active and ready to accept new bulbs.
3. The indicator light should begin to flash rapidly shortly thereafter, this means that the remote control has found a new lightbulb within range.  After the lightbulb is successfully added to the remote, the indicator light will stop flashing
4. Once the group indicator light turns a solid color (green) a lightbulb has been successfully added to the remote (the bulb should also stop pulsing at this time)

You should only need to factory reset the remote 1 time, that will allow you to add bulbs to the remote directly.

sktaylortrash commented 7 years ago

Oh that's good info to have.

merrickw commented 7 years ago

Hi Bren,

Just checking if you have anything in works for IFTTT or Smarthings integration? I'd love to figure out how to integrate this gateway/bulbs into home automation ... like Google Home ....

Thanks, Merrick

bren1818 commented 7 years ago

Hi Merrick, I haven't done any integration yet, that being said, I just checked the IFTTT platform and looks like they're finally allowing development integration.

https://platform.ifttt.com/docs/hello_world#give-ifttt-your-api-url

I'll have to read up on it because I could likely make an Applet, but you would also need your own copy to point to your local network endpoint.

I've been pretty swamped lately but I'll see if there's an easy way to do so.

On Fri, May 5, 2017 at 11:36 AM, merrickw notifications@github.com wrote:

Hi Bren,

Just checking if you have anything in works for IFTTT or Smarthings integration? I'd love to figure out how to integrate this gateway/bulbs into home automation ... like Google Home ....

Thanks, Merrick

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bren1818/TCPLightingWebInterface/issues/6#issuecomment-299498329, or mute the thread https://github.com/notifications/unsubscribe-auth/ACDCH97h3crtq-itVJnw4W_R7pqeIgKMks5r20IAgaJpZM4LEhw5 .

inahas commented 7 years ago

Hi Bren. I am too unable to get the token file generated either.

If you ssh into the hub there is a file under /media/config/tokens that appears to contain the tokens known to the hub. Maybe we can just copy one of these tokens (or create a random new one??) and use it instead?

bren1818 commented 7 years ago

I've never tried that, it could work, but I'd doubt it.

You pressed the sync button and hit the index page? You have curl enabled?

On May 18, 2017 10:41 PM, "inahas" notifications@github.com wrote:

Hi Bren. I am too unable to get the token file generated either.

If you ssh into the hub there is a file under /media/config/tokens that appears to contain the tokens known to the hub. Maybe we can just copy one of these tokens (or create a random new one??) and use it instead?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bren1818/TCPLightingWebInterface/issues/6#issuecomment-302593718, or mute the thread https://github.com/notifications/unsubscribe-auth/ACDCH72FxXgEnPaHoPQLHUzbdXDt7u-Vks5r7QFNgaJpZM4LEhw5 .

inahas commented 7 years ago

Switching the LIGHTNING_PORT to 80 fixed it. It works now, but I still don't see a token file under htdocs!

inahas commented 7 years ago

And yes I pressed the Sync page and kept refreshing the http://localhost page. I got the little graphic instructing me to get the token. How do I enable curl?

bren1818 commented 7 years ago

I guess depending on how the bridge is running, you may have to set it to :80.

Are you using Xampp? It gives people the least grief. If you're feeling adventurous you can check out my Dev branch and try the new build. It isn't perfect but has most of the function.

I'm afk currently but I'll check it after work tomorrow if you don't figure it out by then :)

On May 18, 2017 10:50 PM, "inahas" notifications@github.com wrote:

Switching the LIGHTNING_PORT to 80 fixed it. It works now, but I still don't see a token file under htdocs!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bren1818/TCPLightingWebInterface/issues/6#issuecomment-302594908, or mute the thread https://github.com/notifications/unsubscribe-auth/ACDCH4w9YXsEIlC1LGCQdoHUBuWgiqsAks5r7QN3gaJpZM4LEhw5 .

inahas commented 7 years ago

Yes I followed the instructions above precisely. Maybe firmware 3.0.39 didn't use tokens? If I type this in the browser:

http://192.168.1.122/gwr/gop.php?cmd=GWRLogin&data=
<gip><version>1</version><email>hello</email><password>SomeUID</password></gip>&fmt=xml

I get the following response:

<gip>
<version>1</version>
<rc>200</rc>
<token>1234567890</token>
</gip>
bren1818 commented 7 years ago

Hmm, I just checked out the project. I have two bridges, one at 1.108, and one at 1.109, I've loaded my project on :86, so I modify the include.php accordingly.

image

press the sync button and refresh the page...

image

Interface loads up. I didn't change anything else,

Hope that helps, I'm off to bed for the night - will have another look tomorrow. rc 200 is a good sign though. You may be right about the 3.0.39 - I haven't used that firmware for a while, I've allowed mine to update to the latest.

bren1818 commented 7 years ago

@inahas - Any luck with the code ? What happens if you try this:

http://192.168.1.122/gwr/gop.php?cmd=GWRBatch&data=<gwrcmds><gwrcmd><gcmd>RoomGetCarousel</gcmd><gdata><gip><version>1</version><token>1234567890</token><fields>name,image,imageurl,control,power,product,class,realtype,status</fields></gip></gdata></gwrcmd></gwrcmds>&fmt=xml

?