New Windows Gadget

Community contributed apps
dmolton
Posts: 182
Joined: Tue Mar 22, 2011 11:08 am

New Windows Gadget

Post by dmolton »

Spent some free time working on a new Windows Gadget and wanted to share with the community.

It is designed to work over wifi and can be installed on any number of computers you want. Everybody's environment is a little bit different, but the idea is you enter the url and port for your wifi adapter in the settings screen. Every 15 seconds the gadget will poll your controller for the latest data.

Requirements:
- ReefAngel WiFi adapter
- Curt's dev libraries 0.8.5.14 or later
- #define wifi inside Features.h file.
- Windows Vista or 7

To Install:
Download the ReefAngelGadget.zip file to your desktop and extract the .gadget file. Double click it and allow the unsigned gadget to install and you should be good to go.

Make sure the url you are attempting to use in the settings screen is a valid url and successfully communicates with your controller from inside an internet browser. By that I mean, first type the full url into your browser of choice and make sure the response looks like:

"ReefAngel Controller Web Server".. Or something similar. If you append "/r99" on the end of it you should see a response similar to:

Image



In my case, at home I use the following url in the settings screen:

"http://192.168.1.110:2000"

Away at work, I need to use my dyndns hostname and some port forwarding, but it looks similar.

"http://MyTestDynDNs.org:2000" (Looks similar to this)


Screenshots:

Image

Image

Image

^^^^Older screenshot - before the addition of the Actinic/Daylight PWM %^^^^^^


With "#define RelayExp" enabled, the gadget will show you one additional relay box statuses:
Image

Settings screen:
Image

Windows Installed Gadgets screen. The ReefAngel one uses the same icon as the ClientSuite:
Image


It's only a read-only gadget for now and has only been tested on two different Win7 x64 machines. Not sure how it will behave on other setups, but let me know.
Attachments
ReefAngelGadget.zip
Zipped up .gadget file.
(22.49 KiB) Downloaded 1043 times
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: New Windows Gadget

Post by rimai »

Nice!!
Downloading :D
Roberto.
dmolton
Posts: 182
Joined: Tue Mar 22, 2011 11:08 am

Re: New Windows Gadget

Post by dmolton »

rimai wrote:Nice!!
Downloading :D
Cool, interested to see how well it works out for you. It might take a few seconds after saving from the settings screen for the ui to update. It's on a 15 second timer and doesn't update immediately like it probably should..

Also, I should mention what inspired me to finally put it together is I saw a post from Curt a little while ago where he linked the javascript you use to update the /wifi web page. I saw your Ajax code and thought I could probably use it in the gadget. I ended up using pretty much the whole thing :lol: . So, thank you for that!!
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: New Windows Gadget

Post by rimai »

Yeah :)
Nice job!!!
I'm reading parameters from my little nano at home, here at the office :)
Roberto.
dmolton
Posts: 182
Joined: Tue Mar 22, 2011 11:08 am

Re: New Windows Gadget

Post by dmolton »

Groovy!

Wondering if I should slow the timer down a bit. For some reason 15 seconds sounds excessive to me, but not sure.
chrome
Posts: 27
Joined: Thu May 26, 2011 6:28 am

Re: New Windows Gadget

Post by chrome »

Sweet nice, works like a charm.

I have the RelayExp enabled but it still only returns 8 ports back from an /r99

How do you get all 16 ports if you have an expansion relay to show in the xml? And yes, I have the dev libraries.

Code: Select all

#define RelayExp
#define InstalledRelayExpansionModules	1
dmolton
Posts: 182
Joined: Tue Mar 22, 2011 11:08 am

Re: New Windows Gadget

Post by dmolton »

chrome wrote:Sweet nice, works like a charm.

I have the RelayExp enabled but it still only returns 8 ports back from an /r99

How do you get all 16 ports if you have an expansion relay to show in the xml? And yes, I have the dev libraries.

Code: Select all

#define RelayExp
#define InstalledRelayExpansionModules	1
I think all you need is #define RelayExp to get everything back, thats all that I have in my Features file, although the #define InstalledRelayExpansionModules doesn't look familiar to me. I've never used that before so not sure if it effects what comes back.

In the returned xml, <R>,<RON> and <ROFF> represent the first relay box statuses. <R0>,<RON0> and <ROFF0> represent the second relay box worth of data. What are you seeing coming back in the xml?
chrome
Posts: 27
Joined: Thu May 26, 2011 6:28 am

Re: New Windows Gadget

Post by chrome »

dmolton wrote: I think all you need is #define RelayExp to get everything back, thats all that I have in my Features file, although the #define InstalledRelayExpansionModules doesn't look familiar to me. I've never used that before so not sure if it effects what comes back.

In the returned xml, <R>,<RON> and <ROFF> represent the first relay box statuses. <R0>,<RON0> and <ROFF0> represent the second relay box worth of data. What are you seeing coming back in the xml?
Ok, I see. So is there documentation on what a 254 bitflag is? Or is it up to us to figure out?
dmolton
Posts: 182
Joined: Tue Mar 22, 2011 11:08 am

Re: New Windows Gadget

Post by dmolton »

chrome wrote: Ok, I see. So is there documentation on what a 254 bitflag is? Or is it up to us to figure out?
I'm not sure if there is any documentation out there, though it was brought up awhile ago on the google group and it is up to us to convert it.. 254 is the byte representation of the binary octet string indicating the statuses and masks applied to a relay box..

When converted to binary form, the byte 255 looks like "11111111". If this were the status of the <R> element, it would mean each of the 8 relays are on. The binary string 11101110 shows the 4th and 8th relays are off and the rest on, but I'm not sure off hand what that would look like represented as a byte. Similarly, you need to do some bitwise operations against both masks and the R value to find out which relays are truly on and off.
chrome
Posts: 27
Joined: Thu May 26, 2011 6:28 am

Re: New Windows Gadget

Post by chrome »

Ahh Ok I follow you. Thanks so much.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: New Windows Gadget

Post by rimai »

I think what you are looking for can be answered in here:
http://groups.google.com/group/reefange ... e23835652e
Roberto.
astralmind
Posts: 98
Joined: Fri Apr 01, 2011 10:53 am

Re: New Windows Gadget

Post by astralmind »

Very nice will add it at home. Too bad we are on XP at work (yup, scary I know... and using IE 6.0 ... )

Making an android Widget similar to this would be incredibly awesome !
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: New Windows Gadget

Post by binder »

dmolton wrote:
chrome wrote:Sweet nice, works like a charm.

I have the RelayExp enabled but it still only returns 8 ports back from an /r99

How do you get all 16 ports if you have an expansion relay to show in the xml? And yes, I have the dev libraries.

Code: Select all

#define RelayExp
#define InstalledRelayExpansionModules	1
I think all you need is #define RelayExp to get everything back, thats all that I have in my Features file, although the #define InstalledRelayExpansionModules doesn't look familiar to me. I've never used that before so not sure if it effects what comes back.

In the returned xml, <R>,<RON> and <ROFF> represent the first relay box statuses. <R0>,<RON0> and <ROFF0> represent the second relay box worth of data. What are you seeing coming back in the xml?
The #define InstalledRelayExpansionModules 1 line is in there for good measures. It's primarily useful when you have more than one relay expansion installed. If it's not defined, I do additional checks and set it to be 1 by default if you have RelayExp enabled. Having it there is the proper way.

C'mon Dave, you've been reading all my OTHER comments and changelogs yet you missed that one. haha ;-)
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: New Windows Gadget

Post by binder »

PS. You get to make all the "cool" apps and I'm stuck just coding on the controller. hahaha :ugeek:
dmolton
Posts: 182
Joined: Tue Mar 22, 2011 11:08 am

Re: New Windows Gadget

Post by dmolton »

binder wrote: The #define InstalledRelayExpansionModules 1 line is in there for good measures. It's primarily useful when you have more than one relay expansion installed. If it's not defined, I do additional checks and set it to be 1 by default if you have RelayExp enabled. Having it there is the proper way.

C'mon Dave, you've been reading all my OTHER comments and changelogs yet you missed that one. haha ;-)
Whoops, um must have missed that one.. Guess I got too preoccupied putting together all kinds of cool apps :lol:
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: New Windows Gadget

Post by alexwbush »

dave, what about a gadget that gets its info from the client? I don't have mine hooked up to wifi right now and would rather not since it's been working so well plugged in directly since switching.
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

Re: New Windows Gadget

Post by lukeluke »

great work.

i was trying by my work (with proxy) but don't appears nothing... what can i do ?
dmolton
Posts: 182
Joined: Tue Mar 22, 2011 11:08 am

Re: New Windows Gadget

Post by dmolton »

lukeluke wrote:great work.

i was trying by my work (with proxy) but don't appears nothing... what can i do ?
Not sure exactly. Like I said, you need to be sure you can access the controller through a web browser first. You also might need to do some port forwarding on your router at home. Once you can browse the controllers web server page, copy/paste the url you used into the settings screen.

The URL you want to use will show a web page with just the bold text:
Reef Angel Controller Web Server
The gadget will add the extra bits to the end of the url in order to get the temps.
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

Re: New Windows Gadget

Post by acabano »

nice work! i just installed it and wow! some.. i would also like to setup my router for port forwarding, just in case if someone would shade some light. i have a uverse router.. anyone? ;)
Image
chase
Posts: 101
Joined: Fri Sep 16, 2011 8:26 am

Re: New Windows Gadget

Post by chase »

This would be cool to post under the Downloads section. Just upgraded my computer and was restoring all my apps and figured I'd throw the suggestion out there since it wasn't listed!
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: New Windows Gadget

Post by rimai »

Thanks :)
Added that one too.
Roberto.
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

Re: New Windows Gadget

Post by lukeluke »

Can you improve the proxy support ?

Thanks
dedvalson
Posts: 140
Joined: Tue Oct 04, 2011 5:49 am

Re: New Windows Gadget

Post by dedvalson »

Hi,

On my system there appears to be a problem calculating how big to make the widget.

Here is a screen shot.
Widget.jpg
Widget.jpg (13.78 KiB) Viewed 12715 times
As you can see the arrow to show the relays and the bottom line of display is not visible.

This is on Windows 7. I have my text size set to Medium (125%). I think you might need to take that into account when you calculate how big to make the widget. Another option would be to specify the font size more specifically.


Don

PS: If you want me to I can probably fix this if the source code is available somewhere.
Junior Dabul
Posts: 17
Joined: Mon Mar 26, 2012 5:32 am

Re: New Windows Gadget

Post by Junior Dabul »

hi,

i am having a problem with my windows gadget. it was working then it closed and showed no IP address. now when i put the address doesnt conect anymore.

any ideas why? my client Suit is working fine apart from the relay expansion with is incompatible with the lib. 0.9.3 .

if guys can give a help would be great.

thanks Junior
dedvalson
Posts: 140
Joined: Tue Oct 04, 2011 5:49 am

Re: New Windows Gadget

Post by dedvalson »

dedvalson wrote: PS: If you want me to I can probably fix this if the source code is available somewhere.
Is the source for this available? I would like to fix the display issue

Don
dmolton
Posts: 182
Joined: Tue Mar 22, 2011 11:08 am

Re: New Windows Gadget

Post by dmolton »

dedvalson wrote:
dedvalson wrote: PS: If you want me to I can probably fix this if the source code is available somewhere.
Is the source for this available? I would like to fix the display issue

Don
All the source code is embedded within the .gadget. It works similar to JAR files.

Rename the .gadget extension to .zip

Inside the zip you should see all the source files. It's mostly all javascript, css and html. The Win framework provides a System.Gadget namespace you can use in the Javascript. Here's some resources you can refer to on msdn:

http://msdn.microsoft.com/en-us/library ... 85%29.aspx
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Sebyte

Re: New Windows Gadget

Post by Sebyte »

i am having a problem with my windows gadget. it was working then it closed and showed no IP address. now when i put the address doesnt conect anymore.
I have recently had this as well. I fixed it by doing this:

Goto controle pannel and open up add remove program's.

In the lefthand side pane there is an option to add or remove Windows features.

(please excuse me if I have the wording wrong but I am not at home and doing this from memory on my iPad)

Then look for Windows gadgets, and unclick the box. Save and reboot.

When PC is back repeat the above and put a tick in the box. Sorry but a reboot is needed.

Then right click on desktop and select add gadgets.

This worked for me. I could not find any other way of restarting the services that relate to gadgets. There may be a better way, if so I would like to know, and please let me know if this worked for you.

Good luck. ;)
dmolton
Posts: 182
Joined: Tue Mar 22, 2011 11:08 am

Re: New Windows Gadget

Post by dmolton »

The host process for the gadgets is called "sidebar.exe". You should be able to just kill the process in task manager. When you add a new gadget to the desktop it will automatically restart the sidebar.exe host process for you. Quicker than restarting :)
dedvalson
Posts: 140
Joined: Tue Oct 04, 2011 5:49 am

Re: New Windows Gadget

Post by dedvalson »

Hi,

There seems to be something wrong with the XML coming from my ReefAngel. I have the latest dev libraries installed and I have one expansion box. I looked at the Gadgets Javascript, and it is looking for an <R0> tag for the expansion port. But my box doesn't provide an R0. The first expansion box is shown as <R1> as shown below. So I'm trying to figure out who is wrong, the gadget or my box.

Should there be an R0? If so, why would my RA produce R1 instead of R0? Or should the gadget look for R1 instead?

Don

Code: Select all

<?xml version="1.0"?>
-<RA>
<T1>809</T1>
<T2>923</T2>
<T3>802</T3>
<PH>801</PH>
<R>140</R>
<RON>0</RON>
<ROFF>255</ROFF>
<R1>143</R1>
<RON1>0</RON1>
<ROFF1>255</ROFF1>
<R2>0</R2>
<RON2>0</RON2>
<ROFF2>255</ROFF2>
<R3>0</R3>
<RON3>0</RON3>
<ROFF3>255</ROFF3>
<R4>0</R4>
<RON4>0</RON4>
<ROFF4>255</ROFF4>
<R5>0</R5>
<RON5>0</RON5>
<ROFF5>255</ROFF5>
<R6>0</R6>
<RON6>0</RON6>
<ROFF6>255</ROFF6>
<R7>0</R7>
<RON7>0</RON7>
<ROFF7>255</ROFF7>
<R8>0</R8>
<RON8>0</RON8>
<ROFF8>255</ROFF8>
<ATOLOW>1</ATOLOW>
<ATOHIGH>1</ATOHIGH>
<EM>0</EM>
<REM>1</REM>
<PWMA>100</PWMA>
<PWMD>60</PWMD>
</RA>
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: New Windows Gadget

Post by binder »

It's supposed to be R1 for first expansion box. This way it will make more sense with the displaying and it will match with the retrieval of the labels. It also makes it compatible with the Portal as well.
It was originally R0 in the 0.8.5.x code, but it was switched to R1 in the 0.9.X code. I just looked it up.
Last edited by binder on Mon May 07, 2012 3:07 pm, edited 2 times in total.
Reason: Updated when switch was made.
Post Reply