Monday, November 24, 2014

Uno32 serving web pages

I'm rather pleased with myself, probably more than I should be - "pride cometh before a fall" and all. Especially when I really didn't write the original code (I'll give credit to the original code author(s) on the git page). I did make some effort to port it and now I'm going to make an additional effort to correct what doesn't already work. I used it mainly because I couldn't find running code (what can I say, I'm lazy and as a programmer, well, that's a good thing ;-) ). So far, I see that the static IP address is working fine. I haven't tried the DNS functionality, I see the DHCP requests with Wireshark and the DHCP info but the Uno32 never returns from the call. The server is working fine and as you can see below, the Uno32 responds to the HTTP request. I did try the Ethernet client also and it never connected. Still, some working code is a great morale booster.

njc@Mozart:~$ telnet 192.168.1.4 80
Trying 192.168.1.4...
Connected to 192.168.21.4.
Escape character is '^]'.

HTTP/1.1 200 OK
Content-Type: text/html
Connection: close
Refresh: 5

<!DOCTYPE HTML>
<html><body>
analog input 0 is 735<br/>
analog input 1 is 772<br/>
analog input 2 is 768<br/>
analog input 3 is 766<br/>
analog input 4 is 791<br/>
analog input 5 is 794<br/>
Humidity: 44.10 % Temperature: 25.50 *C 77.90 *F
Heat index: 78.88 *F</br></body></html>
Connection closed by foreign host.
njc@Mozart:~$

What I'll work on next is the DHCP part of the code. I think this will the next important step, then the DNS and then the Ethernet client. After that I hope to port over an Arduino MQTT client. I need both the publish and subscribe parts of MQTT. My thinking is that the publish part will publish device updates at regular intervals. The Humidity and temperature in the case of the DHT22. Then the Subscribe part will allow for configuration, such that I can rename a light switch, configure the update times and other details of a device's operations. I think this will go a long way toward making easy to install, HA ready, devices in the home. The end user can then know a lot less about the devices and only need to configure a minimum number of parameters to make device operational. More on that to come as it does require a great deal of thought. At the moment I'm not sure how the HA software will deal with these publish/subscription issues. As I said, more thought is needed.

0 Comments:

Post a Comment

<< Home