"""
This example writes data to a feed in a batch from a list.

You can install the Adafruit library using the following command.
sudo pip3 install Adafruit_IO

Before you run the program you must put in your username and key from
the Adafruit IO site. Copy from the website and replace my information.
My key will no longer work. It has been changed.

To run the program from the command line use:
python3 demo-upload.py

If you do not have Python you can install it from here:
https://www.python.org/

"""

import time


# import Adafruit IO REST client.
from Adafruit_IO import Client, Feed

# Set to your Adafruit IO key.
# Remember, your key is a secret,
# so make sure not to publish it when you publish this code!
#ADAFRUIT_IO_KEY = 'YOUR_AIO_KEY'

# Set to your Adafruit IO username.
# (go to https://accounts.adafruit.com to find your username).
#ADAFRUIT_IO_USERNAME = 'YOUR_AIO_USERNAME'

#################################### Replace these with your KEY. ##########################

# These are no longer valid. Replace these values with your own username and key.
ADAFRUIT_IO_USERNAME = "csetuser"
ADAFRUIT_IO_KEY = "aio_pXkk38kXLMDZ"

############################################################################################

# Create an instance of the REST client.
aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)

humidity_feed = aio.feeds('myhumidity')
temperature_feed = aio.feeds('mytemperature')

temperatureList = [78.5, 77.2, 79.5,81.0, 82.4,80.3,79 ]
humidityList = [57, 55, 55, 54, 57, 56.8,56,56,55.6]


print("Sending Temperature")
for fahrenheit in temperatureList:
    print(f"Sending {fahrenheit}")
    aio.send(temperature_feed.key, str(fahrenheit))



print("Sending Humidity")
for humidity in humidityList:
    print(f"Sending {humidity} ")
    aio.send(humidity_feed.key, str(humidity))

