bren1818 / TCPLightingWebInterface

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

Comments, Questions, open forum #1

Closed thatguy73 closed 7 years ago

thatguy73 commented 8 years ago

Hello,

I have a large amount of these bulbs and would like to be able to use them again. Thanks so much for the work you are doing on this. How can I execute these files and run them? I tried something called XAMPP without much luck.

TIA

bren1818 commented 8 years ago

No problem, I am happy my work is being used! I use XAMPP at home, so hopefully we can get it working for you too. The first question is though, do you have the TCP bridge or just the remotes? I have the bridge and originally used the app to configure and add my lights into appliances and "rooms".

Assuming you have the bridge, the next step is easy, make sure it is plugged in, and determine it's IP address. You can do this by logging into your router (192.168.1.1 or 192.168.0.1) and looking at the DHCP table to find the IP. For me, if you look into my include.php file, I have the LIGHTING_URL set to 192.168.1.114, you'll need to change this to your device. The next step is hit the sync button on the lighting bridge and open the files in a browser. XAMPP should by default open the index.php. Since you do not have a token set yet, the first time you run the script, you should get string printed on your screen like this: token

Copy the token string, and paste it in the include.php file in the TOKEN variable.

After that, assuming you've done it right, when you refresh the index page, you should get a GUI which looks like the attached. tcp lighting

Obviously rooms / lights may vary. Clicking the On or OFF buttons will turn the lights on and off, and the slider will control the brightness.

My plan is to deploy this on a local webserver like XAMPP and then password the site so I could in theory remotely control the lights. It works like a webpage.

I wont say my project is finished yet, I plan to improve on it, so you may see changes in the future. I haven't worked with adding 'new' bulbs or bulbs not assigned to a room yet, so I'll try that soon and see what we can do. Please let me know if that helps!

Cheers,

Bren

thatguy73 commented 8 years ago

I have the bridge and I think I can get it's ip just fine. I am on a mac and can't seem to get XAMPP to open your index file.

bren1818 commented 8 years ago

I'll go out on a limb and assume that my project is the only files in your ht docs directory? If you go to 127.0.0.1 in a browser what do you see? I run this on Windows and have set it up on a virtual house, but that shouldn't matter. I'll try this on a mac this evening and try it out. Is xampp running? You may need to make sure it is running on port 80, if it is running on a different port you may need to address it like 127.0.0.1/index.php:PORT# hope that helps!

thatguy73 commented 8 years ago

I got the XAMPP working and set my getaway ip up in the include.php file. My IP is 10.0.1.4 and I now get this:

Parse error: syntax error, unexpected '.0' (T_DNUMBER) in /Applications/XAMPP/xamppfiles/htdocs/include.php on line 8

This is what I have on line 8 of include.php:

define("LIGTHING_URL", “10.0.1.4”); //IP address of gateway

thatguy73 commented 8 years ago

wanted to add that I did a port scan of the gateway ip and 443 is the only one open

bren1818 commented 8 years ago

Ok so I set this up on my Mac (I typically dont use it) so, the first time I run the script, without the sync button I see this:

screen shot 2016-07-22 at 6 49 00 pm

when I press the sync button and refresh, I see this:

screen shot 2016-07-22 at 6 51 32 pm

I can see in this time my token is: fp67as0a9tidh2fdjxb01egp3y3dk8n64z34xh4b

I copy this token and am going to paste it into my include.php file - I'm using text wrangler FYI - (From the comment above, I wonder if your text editor is placing odd markup. So my file looks like this:

screen shot 2016-07-22 at 6 54 19 pm

now when I refresh the screen I see:

screen shot 2016-07-22 at 6 56 07 pm

I think your text editor may be making decorative quotes which are not running. Also your IP is odd. What kind of router are you using. To Test to make sure you can hit your bridge, throw it's address in a browser, like so: https://192.168.1.114/gwr/images/ or for you https://10.10.1.4/gwr/images/ you should get a response from the bridge like so:

screen shot 2016-07-22 at 6 59 38 pm

in the picture there, it doesnt matter that it says forbidden, its just showing that bridge is responding. I think you may need to check your network settings. It seemed to work ok on my Mac using XAMPP.

Best of luck,

Bren

thatguy73 commented 8 years ago

IP is correct all Apple network hardware. The 10.0 is an "apple thing" quotes were the problem. working on token now

thatguy73 commented 8 years ago

Thanks so much. It's working.

If it is acceptable, I will happily donate some cash as soon this gets the ability to do timers. I have about $250 worth of bulbs that now do nothing on all the timers they used to be on.

Already bought a phillips hue and 13 replacement bulbs, but I would love to use my old TCP's

bren1818 commented 8 years ago

That's fantastic! I'm glad to hear it is working :) I'm not looking for any cash, this is just a little pet project and I was actually going to look into programming some timers. My end goal is to run this on a Raspberry Pi and have a sensor trigger the lights.

Re: timers, there are a few ways to do this, I could setup a database, and then you'd have to setup a cron job on your computer to check the script to see if it is time to turn on / off the lights. However if you are looking to try something, the interface I wrote, actually calls a little API behind the scenes using Javascript when you click the on/off buttons or drag on the slider. I haven't looked into event programming on a Mac - however, if there is a way to script tasks, all you would need to do is send get requests to the API file on intervals with the Bulb IDs or Room Ids.

If you look at the top of my index file, I have some pretty simple little scripts eg: /api.php?fx=dim&type=room&uid=ROOMID&val=DIMVALUE which replaces the key variables in the request string .

As an example, try putting this in your browser: https://10.10.1.4/api.php?fx=toggle&type=all&uid=ALL&val=1

It should turn on all the lights connected to the bridge :) In theory, if you could setup computer scheduled events, you could tell the event to open that page, and it would act like a timer. and then you could turn all the lights off by doing so: https://10.10.1.4/api.php?fx=toggle&type=all&uid=ALL&val=0

I know how to do this in Windows, but I'd have to look into how to do it on a Mac.

Please if you could send me some screenshots of it working in your browser :+1:

Thanks for trying it out!

Brendon

ahhdem commented 8 years ago

Well, I can't say I'm stoked to see it in PHP but I also have about $250 in TCP doorstops and would be rad to see them functioning again.

I'd be happy to contribute code, I'd love to see these working via smartthings again!

gonna setup php and give this a shot.. thanks!

bren1818 commented 8 years ago

@ahhdem Fantastic, yes, please try it out. I am going to implement some scheduling code so people can setup schedules for the lights. Afterwards I will also working on reverse engineering some off the classes within the android app. (Easier to decompile an apk vs iPa) if you pm me, that will probably be the more difficult and time consuming part.

Telekinetic commented 8 years ago

Is this something that could be adapted into one of the hue bridge emulator projects such as https://github.com/bwssytems/ha-bridge to piggyback on all of the Hue integration all over the place? I was going to start from stockmopar's protocol teardown but this looks like it is much farther along.

ahhdem commented 8 years ago

I believe this builds on StockMopars work, so should be farther along, yes. As far as the Hue integration, it would be totally possible to make a single project that handles both, but in my guess not likely to share much code (outside of UI etc).

@bren1818 sorry I haven't had any time to contribute this week, my hub WAS in a state of never-updated for over a year but the dd-wrt access restrictions completely failed me [note to self: never trust anything other than hand written iptables rules. ugh.] and it upgraded/bricked itself -- the current update situation from greenwavereality appears to be broken unless my panicked unplugging upon seeng the green WAN light fubar'd the thing.

I've got some TTL/USB adapters so I'm going to try and get on it and see if there is anything obvious hanging up the system but my GUESS is that I have zero image/software now so without some sort of a dump or restore I may be more-or-less out of the TCP game unless I pickup another hub/disappointed persons hub etc.

nearly $300 in glowing paperweights. heh. updates next week, with luck.

bren1818 commented 8 years ago

@Telekinetic as @ahhdem indicated it likely could be integrated (I haven't looked at that particular project) however the code base for the TCP stuff is specific to TCP. All of the calls to the TCP bridge are prefaced with GWR (Green Wave Reality) and im pretty positive the way hue communicates with its bulbs is a different protocol than how TCP does. That said, in the future, I'll look into Hue support as I have a few Hue lights too. I'm fairly certain though that given the number of Hue Light Apps out there, their communication schema is probably better documented.

@ahhdem If you hit up Home Depot, they are clearing out the TCP stuff now, last weekend I picked up two bridges (which come with 2 bulbs each) for 20$ a pop. I figured at one point the bulbs were 20$ each so I'm coming out ahead and have two backup bridges to work with. There was a post on StockMoPar's page where someone indicated they had downloaded the update images. I reached out to them here: http://home.stockmopar.com/updated-connected-by-tcp-api/ but no reply yet.

I didnt get any work done on this at all this week either. I started working on the scheduling but got side tracked. I have decompiled the TCP Android App back to their JAVA classes, but will still require some time tracing through the code to re-create or determine the bridge calls.

Will try to get to this more next week 👍

Telekinetic commented 8 years ago

@bren1818 the Hue bridge emulator is a particularly good fit for development integration because there are so many things that work with it. It isn't meant to actually bride to Hue bulbs, but to let things that have easy built-in ways to control Hue bulbs (like Amazon Echo and Wink and Smartthings etc etc do) think they are talking to Hue bulbs through a Hue bridge, when they are really talking to something else--in this case, Tcp bulbs through the Tcp gateway. It is essentially half of a translator, and the one I linked already has built in ways to have the Hue "inputs" translated into Udp outputs, which, as I understand, gets us a decent amount of the way to having these things easy to reintegrate.

bren1818 commented 8 years ago

@Telekinetic - I see what you're saying, but what I was trying to get at is that the protocol used to communicate with the tcp bulbs is different than the hue bulbs. The tcp bulbs (and hub) do not support IFTTT (if this then that) that's why the commands to the tcp bulbs need to be custom and is why you don't see much integration.

I presume that the Web interface which GreenWave used to have - before taking it down and leaving everyone in the lurch - attempted to add some IFTTT support and that's why at the time apps like Wink could control the tcp bulbs if you gave it access to your account.

Hope that makes sense. Let me know if I got anything wrong though, I'm still learning.

Cheers

On Jul 30, 2016 1:45 AM, "Telekinetic" notifications@github.com wrote:

@bren1818 https://github.com/bren1818 the Hue bridge emulator is a particularly good fit for development integration because there are so many things that work with it. It isn't meant to actually bride to Hue bulbs, but to let things that have easy built-in ways to control Hue bulbs (like Amazon Echo and Wink and Smartthings etc etc do) think they are talking to Hue bulbs through a Hue bridge, when they are really talking to something else--in this case, Tcp bulbs through the Tcp gateway. It is essentially half of a translator, and the one I linked already has built in ways to have the Hue "inputs" translated into Udp outputs, which, as I understand, gets us a decent amount of the way to having these things easy to reintegrate.

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

bren1818 commented 8 years ago

@thatguy73 - I have implemented a scheduler feature - very very new (not vigorously tested). It can be run two ways, leaving the browser open after clicking poll continuously, or, after saving your schedule, setting up a system event to execute the runSchedule.php file. Give it a go - not 100% sure if this is what you meant by timers, but hopefully you like it and some of the other updates. You will also need to put in your local url in the include.php to point to where you're hosting the 'site'. I should write a readme...

Cheers! Bren

hypergolic commented 8 years ago

Awesome project Bren, I was the one who posted the instructions on how to downgrade the firmware on the hub so it was usable again on that blog.

I uploaded the files to a repo in the event you or anyone else needs them and clarified a few things in the instructions, and included the extracted root fs. sadly, haven't had the time to do much else than write a bash script to control my lights from ssh.

https://github.com/hypergolic/greeenwave_firmware

Hope it helps, sure was aggravated myself when mine got upgraded and I got locked out of everything and redirected to their stupid website.

bren1818 commented 8 years ago

@hypergolic Fantastic! Thanks for uploading/sharing those files. Fortunately, I am/was still able to control my lights using the APP and via the project here. I'm still dredging through their app code, but havent made much progress. I feel I should at the very least figure out light detection etc. This right now is kind of a home automation project for me. Again much appreciated!

ahhdem commented 8 years ago

thanks @hypergolic! I was about to buy a hub and light set for $20 bux online due to greenwave bricking my hub, but this should probably get me back up and running again! w00t

ahhdem commented 8 years ago

awwwyiss. was able to get my hub back online.. lights are working again! sweet sweet dimability!

I set a static dhcp record for the tcp hub, manually wrote some iptables rules to restrict it by MAC to talking to -just- my remote server, and used dnsmasq running on my gateway (which is my dhcp set dns server) to override *.greenwavereality.com/eu (it also talks regularly to tcp.greenwavereality.com -- using netcat to try and get more details on this) to my servers IP address.

From there a simple nginx ssl host block was fine with the following addition: error_page 405 =200 $uri; to the server block, to allow POST to a static page.

I guess the code in this repo wont be of much use to me, unless I find trouble integrating with smartthings and choose to upgrade the firmware intentionally -- especially now that I can go back! 👍

ahhdem commented 8 years ago

sent a pull request to @bren1818 that makes his code work on @hypergolic's posted firmware. I am back in action. Hoping to get some of the details from dev_sec on this thread: https://community.smartthings.com/t/any-interest-in-tcp-connected-hub-local-integration/51926

regarding his local device handler -- since I have no need to proxy ssl with the old firmware, a seamless integration -should- be possible!

UPDATE: Looks like I might be able to use Todds work here: https://github.com/twack/TCP-Connect to get some direct integration. Not sure if I can easily change the ApiURL Variable to do a local connection with my SmartThings v1 hub, but I'm gonna give it a go.

UPDATE2: I was able to make this work with some minor modifications. I used a proxy through a publically availablle web host into my private network to get to the tcp hub -- not sure if that was required or not. Once I have the code a little cleaned up and the modifications minimal I'll share it and link here.

hypergolic commented 8 years ago

Glad you got it working :).

FYI, I believe they use this library: http://www.nxp.com/products/interface-and-connectivity/wireless-connectivity/2.4-ghz-wireless-solutions/jennet-ip:JENNET-IP The SDK is downloadable on their website. I had the toolchain and buildroot + sdk at one point and I cant find it now...

I pulled some interesting stuff off of it via the "holger" binary on it. https://gist.github.com/hypergolic/ab5f18587b58c6c7236f7e5bc5c42f59

If you are looking to sniff the mesh network without much work, it has tcpdump built into the firmware among another annoying things..it has more logging than I can ever imagine was needed, some urls i found: http://gobbler.greenwavereality.com/coredump.php logger.greenwavereality.com:514 dev.greenwavereality.com:888

I updated my repo with some quick instructions on modifying, unpacking and repacking the firmware, as well as a updated image with ssh re-enabled & updates disabled via deleting the default dhcp route, until i get time to look over it and nail the door shut on updates forever, but since I dont plan on ever allowing it to talk outside of my network, having no default route was a fast way for me.

https://busybox.net/downloads/binaries/1.21.1/busybox-powerpc If its of any use this version of busybox works for me and has a lot of the functions that are missing in the stock version. I believe they use a a unix socket for talking from the cgi interface to the actual bridge, check netstat -l / /tmp/cs

Lightning fried my smart things hub recently, so I' cant really be of much assistance on integrating with that until I pickup a new one..

bren1818 commented 8 years ago

@thatguy73 @ahhdem @hypergolic I've been trying to get some info from support at TCP, although they don't say much. One thing they did note was, this is the "replacement" for TCP: http://consumer.nimbus9.co/ but it looks like all it offers is what my project is attempting to emulate.

I'm still working on reverse engineering the code but not having much luck. I'm trying to work without downgrading my tcp bridge, but I may have to go that route. I cant capture the commands being issued as its over ssl, and the code isn't the easiest to trace.

hypergolic commented 8 years ago

The modified firmware I posted uses a bit newer rootfs I believe, but with ssh enabled, so it may be useful to you in that fact. The original unmodified firmware is the version with SSH enabled from the factory that has the local http webserver instead of the https only webserver.

hax0rmort commented 8 years ago

i love this work, i had no idea you guys were keeping it going. I checked out that "Unifi Passport" they want for $150 for whomever bought out TCP Connected rights I'm assuming.

If anyone has a home automation system, z-wave/zigbee/btle/wifi/insteon,etc check out Vera Plus, the new (April '16) home automation hub, it does all that but the magic is the apps from MiOS store, which, just so happens.....

http://code.mios.com/trac/mios_tcplighting/wiki

I actually thought I saw the dev lurking here, or on another TCP github project similar to this. This is a flawless integrated way to add all our tcp bulbs (I have.....42 now, since eBay auctions ended last week) Dirt cheap, crushed box return/pallet sales from Home Depot.

Glad to see you guys figuring this out for more applications..... I signed up to comment on this. Thanks for getting me on Git.

bren1818 commented 8 years ago

@hax0rmort, Glad you like it and thank you for the links. I actually just pushed an update to add some functionality. Wish I had more time to work on this, but it is a fun hobby.

StuartRothrock commented 8 years ago

I am glad to see the efforts a few of you are giving here. I was about to pitch my hub and lights in the donation box. I tried the web interface and can't seem to get a token. I also have a serial connection to the hub but can't get anything other than garbage. It is a 3.3v FTDI serial. I am thinking about downgrading the firmware. Any suggestions for my first fix? TIA EDIT: I got brave and downloaded the firmware without a glitch - thanks! - I am a happy camper now - off to scripting :)

bren1818 commented 8 years ago

Hmm, what do you mean you have a serial connection to the hub? Why not use standard network connection?

Otherwise just make sure you have the right ip address in the include file of your bridge. I did just add a change to store the token to a file, and made the default. Perhaps try disabling that option. Depending on webserver it may not be writing the file.

Also make sure you hit the sync button on your hub first.

Other people have had success downgrading the firmware, I haven't done that in mine yet though.

On Aug 28, 2016 3:35 PM, "Stuart Rothrock" notifications@github.com wrote:

I am glad to see the efforts a few of you are giving here. I was about to pitch my hub and lights in the donation box. I tried the web interface and can't seem to get a token. I also have a serial connection to the hub but can't get anything other than garbage. It is a 3.3v FTDI serial. I am thinking about downgrading the firmware. Any suggestions for my first fix? TIA

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

ryanhindinger commented 8 years ago

It's 1:58am and I've been banging my headed against the proverbial wall for hours trying to find a way to make all of these TCP lamps I own less than worthless again. This project is like finding a life preserver in shark-infested waters--there's hope at least. I know next to nothing about php or anything beyond your basic networking really, but I'm going to try to learn so I can get these lights running again.

Thank you!

StuartRothrock commented 8 years ago

@bren1818 asks about the serial connection - I attached a 3.3v serial cable to the 3 connections with the legs I soldered to the hub. That gives access to the boot prompt that can be interrupted. It has U-Boot as the bootloader. You can google that to learn more.

20160915_120712

SteelBattalion commented 8 years ago

First off. Thank you so much for making this happen. I've got mine working with the HA-Bridge project from BWSSystems. I set up your project on a virtual linux server and used the generated url requests from the button presses to give basic on off functionality and dim functionality. I can now use these with Alexa similar to the hue bulbs I purchased. To create a proper dim setting I took the URL request that was generated and replaced the value to the BWSSystems variable for value ${intensity.percent}

bren1818 commented 8 years ago

@SteelBattalion glad to hear it helped. I actually just added some new functionality to create, edit and delete virtual devices. I didn't add these to the api, not sure if I will since it is kind of standalone functionality, but thought I'd let you know.

Cheers :)

merrickw commented 8 years ago

Hi Brendon - thanks for writing this app, I'd like to start using it but I have a couple of questions; First of all, I didn't even realize TCP stopped supporting these bulbs; My scheduled events which I set years ago work perfectly everyday and haven't stopped. And I never cared about remote internet access, as long as the android app worked. But now the android app doesn't find the hub. I'm afraid to re-sync because I don't know if that would reset my scheduled events. That's my first question, do you know if that would happen? My second question is, how can I tell which firmware I have? And the third question is, if I start using your web app, will I see my existing events or be starting fresh?

Thanks for putting time into this to keep these bulbs alive!

Regards, Merrick

bren1818 commented 8 years ago

@merrickw - Hey Merrick, thanks for reaching out, hopefully this project works well for you.

Yep, TCP killed this project I think in May/June of 2016 - I only found out because I had signed up for Wink Notifications... Great customer service TCP provided. Like you I hadn't really used the web interface side of things (built into the bridge) but I did use their web interface to connect from say work etc. That's sort of why I built this, to emulate that functionality in a sense.

Re #1 - resyncing is only supposed to grant tokens , or allow your devices to connect. It should not modify your schedules. Apt word is should. If you're worried, you could try syncing another device and see if your pre-programmed events show up on your other device. They should. While I cannot 100% confirm that the bridge stores all the information, I am pretty darn sure it keeps the configurations stored on it. So nothing should happen if you re-sync. Again should. I'll comment more on that later.

Re #2 For simplicity sake and to not get firmware numbers involved, lets look at this as two firmwares. Old and new. The easiest way to tell them apart is the OLD firmware will allow you to connect to the bridge on port 80, (http) while the new firmware will only connect over https. They killed off the web interface in the new firmware, so if you dont have a device to run the tcp app, your SOL. Thats another factor why I built this web version.

Re #3 You should not have to start fresh, all your room configs and bulbs will show up in my project. I have not built in native scheduling support (yet) but built my own scheduler based on cron events which works as a substitute. This means so long as your events are still in the device, my code shouldn't touch your stuff.

Now, one thing I should ask is, if you click the sync button on your bridge, does it show the spinning sync lights? My one bridge seems to have nuked itself, (fortunately I have another) so I am in attempting to restore it using the firmware @hypergolic posted here: https://github.com/hypergolic/greeenwave_firmware although I was able to downgrade it, my device seems to boot loop, and I am unable to connect my devices to it. This is something I'm working on, and if I am able to 'repair' or re-flash the hub, I'll post detailed instructions on how to do so.

Hope that helps,

Cheers, Bren

merrickw commented 8 years ago

Hi Bren,

Thanks for the response. Yes, when I press sync the lights spin and come back to normal. My WAN light is red and my LAN light is amber.

I got concerned because I wasn't getting the TCP app to connect. But after I rebooted the gateway, and pressed sync, the app started in 'search' mode and found my gateway, and the app shows all my lights/rooms/events. For a while I thought the app wouldn't work again.

So what brought me to your web app is I just started using Google Home, and wanted to see if I could integrate the two. And now knowing TCP killed the internet access, I'd like to use your app as backup anyway.

Which leads me to my setup questions. I'm not really clear on setting up the token or token file; What I've done so far is put your app under my wwwroot folder; edited the include.php with the ip address and port. I go to my browser and load: http://localhost/TCPLightingWebInterface-master/ I get: PHP Fatal error: Call to undefined function curl_init() in C:\inetpub\wwwroot\TCPLightingWebInterface-master\include.php on line 54

Could my PHP be out of date? I haven't done PHP work for a couple of years, and only scratched the surface.

Regards, Merrick

bren1818 commented 8 years ago

Hey there, not at home at the moment, but that error leads me to think you do not have curl enabled in your php.ini it isn't always enabled by default.

Try xampp, I believe the defaults with it should be A-OK, or Google how to enable curl.

Cheers

Bren

On Nov 13, 2016 11:46 AM, "merrickw" notifications@github.com wrote:

Hi Bren,

Thanks for the response. Yes, when I press sync the lights spin and come back to normal. My WAN light is red and my LAN light is amber.

I got concerned because I was getting the TCP app to connect. But after I rebooted the gateway, and pressed sync, the app started in 'search' mode and found my gateway, and the app shows all my lights/rooms/events. For a while I thought the app wouldn't work again.

So what brought me to your web app is I just started using Google Home, and wanted to see if I could integrate the two. And know TCP killing the internet access, I'd like to use your app as backup anyway.

Which leads me to my setup questions. I'm not really clear on setting up the token or token file; What I've done so far is put your app under my wwwroot folder; edited the include.php with the ip address and port. I go to my browser and load: http://localhost/TCPLightingWebInterface-master/ I get: _PHP Fatal error: Call to undefined function curlinit() in C:\inetpub\wwwroot\TCPLightingWebInterface-master\include.php on line 54

Could my PHP be out of date? I haven't done PHP work for a couple of years, and only scratched the surface.

Regards, Merrick

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

merrickw commented 8 years ago

Hi Bren,

That did it. Installed XAMPP and your app works like a charm. Nice work! One thing I needed to do was move the /images folder up a level for the references to work, not sure if that is my own configuration issue. But the token set itself up perfectly, as you stated, the app walks you through the setup.

So my next question is, and I don't know anything about SmartThings, but I do know Google Home can control SmartThings, so do you think your app will somehow simulate SmartThings for Google Home to control?

Regards, Merrick

bren1818 commented 8 years ago

Hi @merrickw, I wrote this so there is an underlying api which the various views call, which is translated to the TCP API. I don't know really anything about smart things, but in theory, extending a "Smart Things" view to translate "Smart Things" calls to either my API or directly to the TCP API shouldnt be out of the question. I'll do some reading on Smart things and see what I find. I don't have a Google home, but its not to say I wont get one in the future.

Cheers,

Bren

Quick note, I looked up the Smart things hub and it doesn't natively support the JenNet IP protocol, so you'd still definitely need the TCP Bridge to do the bulb communication. Looking at their forums, they removed the hub option when TCP discontinued support: https://blog.smartthings.com/news/support-for-tcp-light-bulbs-to-be-discontinued/ that said, if there is a device type we can register which responds with a web request, we could likely make this work. I do not have a smart things hub, I do have a hue hub, so I'll see what/if anything I can whip up...

merrickw commented 8 years ago

Bren - I'm glad your looking at this!

By the way, I picked up a Google Home last week, and liked it so much I bought a second for another room. The speaker sounds great and it plays tons of music from Google Play at no charge. Plus since I uploaded gigs of my music to it years ago, and then forget about it, now I can actually make use of it. And it's very conversational and pretty cool to use. My daughter loves it to play her own playlist whenever she wants.

bren1818 commented 8 years ago

@merrickw I'll have to look into the Google Home when they make it to Canada, looks like they'll be coming here in 2017. Sounds pretty slick, I use the 'ok Google' often enough, so perhaps I'll treat myself. Can it detect smb shares or iTunes Playlists?

So I actually went as far as reaching out to SmartThings support to ask them specifically if you can program http requests with the Smar things App. I tried to install the app on my device, however you need to have their hub in order to try the app. I asked their support if there was a dummy hub code, and they suggested I just buy the hub. I dont think I'll be buying yet another hub for the time being, but it should be possible to make an intermediate app to control the bulbs using the api in my app, it would just require some more work.

The guy on tech support gave me this link: http://docs.smartthings.com/en/latest/cloud-and-lan-connected-device-types-developers-guide/index.html it outlines the steps, but without having the hub itself, it would be pretty tricky.

Hope that helps! Cheers, Bren

sktaylortrash commented 8 years ago

First off thanks for this.

I am having an issue getting it going. If I don't push the sync button I get the page telling me to so that a token can be created. If I do pushing the button the page never loads just eventually times out saying too many redirect attempts.

Any ideas?

Thanks

bren1818 commented 8 years ago

Hi @sktaylortrash - Im AFK for the next few days so I'll try to answer you now. That seems odd to me. Have you tried changing the LIGHTING_PORT on line 9? If you're on the old firmware you may need to set this to port 80, or if on the newer firmware 443. So Long has you have the LIGTHING_URL set to your bridge IP, it should be a go.

If this is not the root of the problem, in the index.php file towards the bottom, look for the following code: $result = getCurlReturn($CMD); $tokenArray = xmlToArray($result);

add this below:

echo '

'.print_r($result,true).'
';

this will echo some information about the curl and help isolate if the issue is coming from curl or an issue with the web configuration.

What webserver are you using? I recommend XAMPP personally. Will try to reach out to you again if you can't resolve.

sktaylortrash commented 8 years ago

Okay I got it sorted. I had to manually create the tcp.token file and make it globally writeable. Once done the key generated properly.

The webserver I am using is an instance of the bitnami virtual appliance. it was setup fresh just for this application

hax0rmort commented 8 years ago

im about to get my hands dirty tonight with 17 tcp lamps. assorted daylight a19, softwhite a19 and br30s, using vera plus plugin

On Sat, Nov 19, 2016 at 5:15 PM, sktaylortrash notifications@github.com wrote:

Okay I got it sorted. I had to manually create the tcp.token file and make it globally writeable. Once done the key generated properly.

The webserver I am using is an instance of the bitnami virtual appliance. it was setup fresh just for this application

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

-Sent from NSA_VAN6

Jofrah commented 8 years ago

Hi all, Firstly, a BIG THANK-YOU to Bren for this code! I've been looking for a way to get my TCP lights "smartened-up" again and this works fine. Installed XAMPP and got it all running, even tho I'm a newbie. I have a slight problem with the scheduler actually, and I think it's related to my bridge not having the proper time. When i check the Test section, the time that comes up is 6 hours and 21 minutes ahead. The time zone says -5 (which is OK for Quebec City here). I tried power cycling the bridge to get the clock to reset--but nothing changed. Any ideas on how the bridge clock can be set? Thanks!

bren1818 commented 8 years ago

Hey @Jofrah I'm glad you find this useful! I'm working on re-writing some of this stuff and going to try to make it somewhat plugin friendly. Just so I'm understanding, you're using the scheduler I built for this app? If you're using the one in this app, the bridge's clock shouldn't matter since it's just this app sending commands based on when they're fired. The UI I built just allows you to store the trigger times, and then when the 'event manager' is hit, it checks (based on your system time) if there is an event it should send to the bridge or not.

If you're using the original one by the app creator - I'm not sure. My theory would have been the same as yours reboot the bridge which should make it talk to the network and fetch the current time. I should probably hook this app into the bridge scheduler, if that's still possible...

hax0rmort commented 8 years ago

I'll be breaking this out here real soon guys

On Sat, Nov 26, 2016 at 21:39 Bren notifications@github.com wrote:

Hey @Jofrah https://github.com/Jofrah I'm glad you find this useful! I'm working on re-writing some of this stuff and going to try to make it somewhat plugin friendly. Just so I'm understanding, you're using the scheduler I built for this app? If you're using the one in this app, the bridge's clock shouldn't matter since it's just this app sending commands based on when they're fired. The UI I built just allows you to store the trigger times, and then when the 'event manager' is hit, it checks (based on your system time) if there is an event it should send to the bridge or not.

If you're using the original one by the app creator - I'm not sure. My theory would have been the same as yours reboot the bridge which should make it talk to the network and fetch the current time. I should probably hook this app into the bridge scheduler, if that's still possible...

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

-- -Sent from Gmail Mobile on iPhone

hax0rmort commented 8 years ago

Oh, Happy Thanksgiving if it applied. I have been reading this chain all month and have been jealous I've been preoccupied with my OSRAM bulbs, got some new Lightify fixtures for the kitchen and living Room, beautiful things! Tunable white also! But here comes the TCPs I stocked up on from eBay and My local big box store clearance all year! Thanks Bren, I'm not sure if you handle the Vera MiCasaVerde plugin or not, or whether I'll need that AND your code to make it work, but either way, glad to see activity!!!

On Sun, Nov 27, 2016 at 00:26 Timothy T. Hasko timothy.hasko@gmail.com wrote:

I'll be breaking this out here real soon guys

On Sat, Nov 26, 2016 at 21:39 Bren notifications@github.com wrote:

Hey @Jofrah https://github.com/Jofrah I'm glad you find this useful! I'm working on re-writing some of this stuff and going to try to make it somewhat plugin friendly. Just so I'm understanding, you're using the scheduler I built for this app? If you're using the one in this app, the bridge's clock shouldn't matter since it's just this app sending commands based on when they're fired. The UI I built just allows you to store the trigger times, and then when the 'event manager' is hit, it checks (based on your system time) if there is an event it should send to the bridge or not.

If you're using the original one by the app creator - I'm not sure. My theory would have been the same as yours reboot the bridge which should make it talk to the network and fetch the current time. I should probably hook this app into the bridge scheduler, if that's still possible...

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

-- -Sent from Gmail Mobile on iPhone

-- -Sent from Gmail Mobile on iPhone

bren1818 commented 8 years ago

@hax0rmort Happy Thanksgiving to you too. I'm Canadian, but I have no problem celebrating twice, and of course taking part in the Black Friday specials 👍 I cant say I have anything to do with the MiCasa Verde, but I am (behind the scenes) re-writing some of the components for this app to make the code nicer... I am also hoping to make this a bit more extendable so it can be used as a plugin or with plugins. I only really have Hue bulbs, but I'm going to take a stab at writing some of the IFTT commands which should be more cross-device compatible. Likely wont be ready for a while, but will let you know when it is :)