Phillip Horn
Published © Apache-2.0

Planting Calendar

Ask Alexa when to plant garden vegetables and you'll find out the dates to start and how to plant them.

BeginnerProtip2 hours590
Planting Calendar

Things used in this project

Hardware components

Amazon Echo
Amazon Alexa Amazon Echo
×1
Amazon Web Services
×1

Software apps and online services

AWS Lambda
Amazon Web Services AWS Lambda

Hand tools and fabrication machines

Garden Hoe

Story

Read more

Schematics

No schematic

It's just code.

Code

Plant list

JavaScript
This is the main list of data for planting. The template is from Amazon. I'm planning to turn it in to a DB that I can keep up to date, and which will allow you to choose your USDA planting zone to get more accurate information.
/**
    Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.

    Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at

        http://aws.amazon.com/apache2.0/

    or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

module.exports = {
"radish": "Plant Radish between March 25 and May 1 in the spring, or in the fall between August 1 and 20 . Plant them a half inch deep, 1 inch apart, with 1 and one half feet between rows. It will take 25 to 30 days to mature.",
"mustard": "Plant Mustard between March 25 and May 1 in the spring, or in the fall between August 1 and August 30 . Plant them a half inch deep, 1 inch apart, with 2 feet between rows. It will take 40 to 50 days to mature.",
"beet": "Plant Beets between April 1 and 15 in the spring, or in the fall between August 1 and September 25 . Plant them one inch deep, 2 inches apart, with 2 to 2 and one half feet between rows. It will take 55 to 65 days to mature.",
"spinach": "Plant Spinach between April 1 and 20 in the spring, or in the fall between August 10 and 20 . Plant them three quarters of an inch deep, 1 to 2 inches apart, with 1 and one half to 2 feet between rows. It will take 40 to 45 days to mature.",
"turnip": "Plant Turnip between March 25 and May 1 in the spring, or in the fall between August 5 and September 20 . Plant them a half inch deep, 1 to 2 inches apart, with 1 to 2 feet between rows. It will take 45 to 65 days to mature.",
"beans": "Plant Bean, bush between April 25 and May 30 in the spring, or in the fall between July 25 and August 5 . Plant them one to one and one half inches deep, 2 to 4 inches apart, with 3 feet between rows. It will take 50 to 60 days to mature.",
"lettuce": "Plant Lettuce between April 1 and May 15 in the spring, or in the fall between September 1 and 15 . Plant them a half inch deep, 10 to 12 inches apart, with 2 to 2 and one half feet between rows. It will take 60 to 85 days to mature.",
"kohlrabi ": "Plant Kohlrabi between April 1 and 15 in the spring, or in the fall between September 20 and 25 . Plant them a half inch deep, 10 inches apart, with 3 feet between rows. It will take 50 to 70 days to mature.",
"carrot": "Plant Carrots between March 25 and April 10 in the spring, or in the fall between September 20 and 30 . Plant them a half inch deep, 2 to 3 inches apart, with 2 feet between rows. It will take 70 to 80 days to mature.",
"onion": "Plant Onions between March 25 and April 15 in the spring, or in the fall between September 1 and December 31 . Plant them three quarters of an inch deep, 3 to 4 inches apart, with 1 to 2 feet between rows. It will take 100 to 120 days to mature.",
"cabbage": "Plant Cabbage between April 1 and 20 in the spring, or in the fall between September 20 and 30 . Plant them one inch deep, 12 inches apart, with 2 and one half feet between rows. It will take 65 to 80 days to mature.",
"cauliflower": "Plant Cauliflower between April 1 and 20 in the spring, or in the fall between September 20 and 30 . Plant them one inch deep, 12 to 18 inches apart, with 3 feet between rows. It will take 55 to 60 days to mature.",
"broccoli": "Plant Broccoli between March 25 and April 5 in the spring, or in the fall between September 25 and 30 . Plant them one inch deep, 14 to 18 inches apart, with 2 and one half feet between rows. It will take 60 to 80 days to mature.",
"asparagus": "Plant Asparagus between April 5 and 25 in the spring. Plant them 6 inches deep, one and one half to 2 feet apart, with 3 to 5 feet between rows. Youll have to wait till the second season to get a mature plant.",
"pole beans": "Plant Bean, pole between May 10 and 20 in the spring. Plant them one to one and one half inches deep, 6 to 12 inches apart, with 3 feet between rows. It will take 65 to 75 days to mature.",
"lima beans": "Plant Bean, lima between May 10 and 25 in the spring. Plant them one to one and one half inches deep, 3 to 4 inches apart, with 2 to 2 and one half feet between rows. It will take 65 to 75 days to mature.",
"cantaloupe": "Plant Cantaloupe between May 10 and 20 in the spring. Plant them one and one half inches deep, 3 and a half to 4 feet apart, with 4 to 6 feet between rows. It will take 80 to 90 days to mature.",
"collard": "Plant Collard between March 20 and April 10 in the spring. Plant them a half inch deep, 8 to 16 inches apart, with 2 and one half feet between rows. It will take 55 to 70 days to mature.",
"corn": "Plant Corn between May 1 and July 20 in the spring. Plant them two inches deep, 12 to 18 inches apart, with 3 to 3 and one half feet between rows. It will take 80 to 100 days to mature.",
"cucumber": "Plant Cucumbers between May 10 and 30 in the spring. Plant them one and one half inches deep, 3 to 4 feet apart, with 3 and one half to 5 feet between rows. It will take 60 to 65 days to mature.",
"eggplant": "Plant Eggplant between May 15 and 25 in the spring. Plant them one inch deep, 2 and one half to 3 feet apart, with 3 feet between rows. It will take 75 to 90 days to mature.",
"kale": "Plant Kale between March 25 and April 5 in the spring. Plant them a half inch deep, 10 inches apart, with 3 feet between rows. It will take 50 to 70 days to mature.",
"okra": "Plant Okra between May 10 and 25 in the spring. Plant them one inch deep, 6 inches apart, with 3 to 3 and one half feet between rows. It will take 55 to 60 days to mature.",
"garden peas": "Plant garden Peas between March 25 and April 10 in the spring. Plant them one and one half to 2 inches deep, 1 inches apart, with 2 and one half feet between rows. It will take 60 to 80 days to mature.",
"southern peas": "Plant southern Peas between May 1 and 15 in the spring. Plant them one and one half to 2 inches deep, 4 to 6 inches apart, with 3 feet between rows. It will take 60 to 70 days to mature.",
"pepper": "Plant Pepper between May 15 and 30 in the spring. Plant them one inch deep, one and one half inch to 2 feet apart, with 2 and one half feet between rows. It will take 65 to 80 days to mature.",
"potatoes": "Plant Potatoes between April 1 and 15 in the spring. Plant them five inches deep, 10 to 14 inches apart, with 2 and one half to 3 feet between rows. It will take 70 to 90 days to mature.",
"potato": "Plant Potatoes between April 1 and 15 in the spring. Plant them five inches deep, 10 to 14 inches apart, with 2 and one half to 3 feet between rows. It will take 70 to 90 days to mature.",
"sweet potatoes": "Plant Potato, sweet between May 15 and June 5 in the spring. Plant them five inches deep, 12 inches apart, with 3 and one half feet between rows. It will take 90 to 150 days to mature.",
"squash": "Plant Squash between May 15 and 30 in the spring. Plant them one and one half to 2 inches deep, 2 feet apart, with 3 to 4 feet between rows. It will take 50 to 55 days to mature.",
"winter squash": "Plant Winter Squash between May 15 and 30 in the spring. Plant them one and one half to 2 inches deep, 3 feet apart, with 5 feet between rows. It will take 85 to 90 days to mature.",
"tomato": "Plant Tomato between May 15 and 30 in the spring. Plant them one inch deep, 2 and a half to 3 feet apart, with 3 to 4 feet between rows. It will take 70 to 85 days to mature.",
"tomatoes": "Plant Tomatoes between May 15 and 30 in the spring. Plant them one inch deep, 2 and a half to 3 feet apart, with 3 to 4 feet between rows. It will take 70 to 85 days to mature.",
"watermelon": "Plant Watermelon between May 10 and 20 in the spring. Plant them one and one half inches deep, 8 to 10 feet apart, with 10 feet between rows. It will take 80 to 90 days to mature."
};

Index

JavaScript
The index file that calls the recipe.js file (planting calendar)
/**
    Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.

    Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at

        http://aws.amazon.com/apache2.0/

    or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

/**
 * This sample shows how to create a Lambda function for handling Alexa Skill requests that:
 *
 * - Custom slot type: demonstrates using custom slot types to handle a finite set of known values
 *
 * Examples:
 * One-shot model:
 *  User: "Alexa, ask Minecraft Helper how to make paper."
 *  Alexa: "(reads back recipe for paper)"
 */

'use strict';

var AlexaSkill = require('./AlexaSkill'),
    recipes = require('./recipes');

var APP_ID = undefined; //replace with 'amzn1.echo-sdk-ams.app.[your-unique-value-here]';

/**
 * PlantingHelper is a child of AlexaSkill.
 * To read more about inheritance in JavaScript, see the link below.
 *
 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Introduction_to_Object-Oriented_JavaScript#Inheritance
 */
var PlantingHelper = function () {
    AlexaSkill.call(this, APP_ID);
};

// Extend AlexaSkill
PlantingHelper.prototype = Object.create(AlexaSkill.prototype);
PlantingHelper.prototype.constructor = PlantingHelper;

PlantingHelper.prototype.eventHandlers.onLaunch = function (launchRequest, session, response) {
    var speechText = "Welcome to the Planting Time Helper ... Now, what can I help you with.";
    // If the user either does not reply to the welcome message or says something that is not
    // understood, they will be prompted again with this text.
    var repromptText = "For instructions on what you can say, please say help me.";
    response.ask(speechText, repromptText);
};

PlantingHelper.prototype.intentHandlers = {
    "RecipeIntent": function (intent, session, response) {
        var itemSlot = intent.slots.Item,
            itemName;
        if (itemSlot && itemSlot.value){
            itemName = itemSlot.value.toLowerCase();
        }

        var cardTitle = "Planting time for " + itemName,
            recipe = recipes[itemName],
            speechOutput,
            repromptOutput;
        if (recipe) {
            speechOutput = {
                speech: recipe,
                type: AlexaSkill.speechOutputType.PLAIN_TEXT
            };
            response.tellWithCard(speechOutput, cardTitle, recipe);
        } else {
            var speech;
            if (itemName) {
                speech = "I'm sorry, I currently do not know when to plant " + itemName + ". What else can I help with?";
            } else {
                speech = "I'm sorry, I currently do not know that planting time. What else can I help with?";
            }
            speechOutput = {
                speech: speech,
                type: AlexaSkill.speechOutputType.PLAIN_TEXT
            };
            repromptOutput = {
                speech: "What else can I help with?",
                type: AlexaSkill.speechOutputType.PLAIN_TEXT
            };
            response.ask(speechOutput, repromptOutput);
        }
    },

    "AMAZON.StopIntent": function (intent, session, response) {
        var speechOutput = "Goodbye";
        response.tell(speechOutput);
    },

    "AMAZON.CancelIntent": function (intent, session, response) {
        var speechOutput = "Goodbye";
        response.tell(speechOutput);
    },

    "AMAZON.HelpIntent": function (intent, session, response) {
        var speechText = "You can ask questions about when to plant things, or, you can say exit... Now, what can I help you with?";
        var repromptText = "You can say things like, what's the planting time for tomatoes, or you can say exit... Now, what can I help you with?";
        var speechOutput = {
            speech: speechText,
            type: AlexaSkill.speechOutputType.PLAIN_TEXT
        };
        var repromptOutput = {
            speech: repromptText,
            type: AlexaSkill.speechOutputType.PLAIN_TEXT
        };
        response.ask(speechOutput, repromptOutput);
    }
};

exports.handler = function (event, context) {
    var plantingHelper = new PlantingHelper();
    plantingHelper.execute(event, context);
};

Credits

Phillip Horn

Phillip Horn

3 projects • 14 followers
Technology enthusiast ready to create awesome things!

Comments