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

OneWire Server code #1

Open
ka5zci opened this issue Oct 21, 2020 · 3 comments
Open

OneWire Server code #1

ka5zci opened this issue Oct 21, 2020 · 3 comments

Comments

@ka5zci
Copy link

ka5zci commented Oct 21, 2020

Hi,

I have been playing with your code, and with limited skills was able to add additional 1wire sensors...However, have NOT been able to get them to output as xml as original code...only the first 1wire is outputted. My goal was to have ability to monitor 4 sensors ideally via the simple xml or JSON to monitor a Brewing process more easily.

Am I flailing at something that just wont't work?

Thanks!

@GordonTurner-ICFNext
Copy link

Hey, so I am clear, you added three more devices and addresses like:

DeviceAddress outsideThermometer = { 0x28, 0x85, 0x95, 0x3A, 0x04, 0x00, 0x00, 0xB7 };
DeviceAddress outsideThermometer1 = { 0x28, 0x85, 0x95, 0x3A, 0x04, 0x00, 0x00, 0xB7 }; //Second
DeviceAddress outsideThermometer2 = { 0x28, 0x85, 0x95, 0x3A, 0x04, 0x00, 0x00, 0xB7 }; //Third
DeviceAddress outsideThermometer3 = { 0x28, 0x85, 0x95, 0x3A, 0x04, 0x00, 0x00, 0xB7 }; //Forth

Plus all the void setup() for the extra sensors?

Did you update the sendXmlResponse() to include the additional sensors values?

ie sendXmlResponse(client, celsius, fahrenheit, error); is for a response with one sensor, you could, in theory, add the others in the one call:

sendXmlResponse(client, celsius1, fahrenheit1, celsius2, fahrenheit2, celsius3, fahrenheit3, celsius4, fahrenheit4, error);

Gord.

@ka5zci
Copy link
Author

ka5zci commented Oct 22, 2020

Thanks Gord,

I had this as you described with one exception.....the code would not compile when endXmlResponse was populated as in your example. I forget the exact error, but was a failure to convert FLOAT to String...and sending them as individual endXmlResponse statements were accepted without error.

I am still plugging away at this and will eventually figure it out. Really just wanted some confidence that it was at least "Possible" in your estimation to get 4 onewires to output same as the single device does in your original code.

Thanks!
Bob

@gordonturner
Copy link
Owner

Hey Bob,

Sure it should be, the code is pretty procedural, maybe start with 2 wires and build up from there?

There should be no float conversion, as the print statements are independent (sort of avoiding the whole conversion thing).

E.g.

    client.print("<celcius>");
    client.print(celsius);
    client.print("</celcius>");

Unless there is a change in the library or something?

Gord.

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

No branches or pull requests

3 participants