Announcement

Collapse
No announcement yet.

Basic problem with SendToHS(x,x)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    I got all to work!

    I'm posting the code here if anyone is interested. It's nothing fancy....but for other code newbies it might be helpful.

    In summary the code runs once when triggered by the the API Input device "Convert", when it = 255.
    Once triggered the NodeMCU converts the A/D input, then writes the result to the API Output Device.

    With this code (along with a load cell strain gauge), I can now measure the weight of the propane tank on my gas grill. From that measured analog value, I'll create a gas gauge type display (Jon00 Dashboard add on) in HS touch to display the propane tank level. In addition, when the tank is near empty an email will be sent to remind me to fill the tank!

    Mike; thank you for all your help!!

    Rick


    ------------------------------------------------------------
    Convert = FromHS[0];

    if (Convert == 0){
    count=0;
    }

    if (Convert == 255){
    if (count == 0){
    for (i=0; i<1; i++){

    int reading = analogRead(0);
    float voltage = reading / 204.6;
    Serial.print ("Reading=");
    Serial.print (reading);
    Serial.print ("\t\tVolts=");
    Serial.println (voltage);

    SendToHS(1,voltage);


    count ++;
    }

    }
    }

    Comment


    • #17
      You’re welcome. Glad you got it working. Sounds like a cool project and a great use of HomeSeer!

      Mike

      Comment

      Working...
      X