Arduino with python

i have written the program to send message through telegram and its working fine the only problem is there is a the values recived from bolt cloud and the value recived by python is different.
in python it takes the maximum value 1024 whereas in cloud its 113.
this is the python code i used

import requests                 
import json                    
import time                    
from boltiot import Bolt        
import conf                     

mybolt = Bolt(conf.bolt_api_key, conf.device_id)

def get_sensor_value_from_pin(CSV0):
    """Returns the sensor value. Returns -999 if request fails"""
    try:
        response = mybolt.analogRead(CSV0)
        data = json.loads(response)
        if data["success"] != 1:
            print("Request not successfull")
            print("This is the response->", data)
            return -999
        sensor_value = int(data["value"])
        return sensor_value
    except Exception as e:
        print("Something went wrong when returning the sensor value")
        print(e)
        return -999


def send_telegram_message(message):
    """Sends message via Telegram"""
    url = "https://api.telegram.org/" + conf.telegram_bot_id + "/sendMessage"
    data = {
        "chat_id": conf.telegram_chat_id,
        "text": message
    }
    try:
        response = requests.request(
            "GET",
            url,
            params=data
        )
        print("This is the Telegram response")
        print(response.text)
        telegram_data = json.loads(response.text)
        return telegram_data["ok"]
    except Exception as e:
        print("An error occurred in sending the alert message via Telegram")
        print(e)
        return False


while True:
    # Step 1
    sensor_value = get_sensor_value_from_pin("CSV0")    
    print("The current sensor value is:", sensor_value)
    
    # Step 2
    if sensor_value == -999:
        print("Request was unsuccessfull. Skipping.")
        time.sleep(10)
        continue
    
    # Step 3
    if sensor_value >= conf.threshold:
        print("Sensor value has exceeded threshold")
        message = "Alert! Sensor value has exceeded " + str(conf.threshold) + \
                  ". The current value is " + str(sensor_value)
        telegram_status = send_telegram_message(message)
        print("This is the Telegram status:", telegram_status)

    # Step 4
    time.sleep(10)

I have tried analog.read(10),serial.read(10),serial.read(CVS0) but all of them gave error -999
except analog read which took 1024 value which is the maximum analog value

Hi @saipavan4,

You can only use pin A0 for analog read. You are passing CSV0 that is incorrect.

response = mybolt.analogRead('A0')

If you are trying to read data from serial input. Then first.

  1. Do serial begin.
response = mybolt.serialBegin('9600')
  1. Then serial read
response = mybolt.serialRead('10')

Check this link for more detail https://github.com/Inventrom/bolt-api-python