Rasperry Pi capture data from arduino

import serial
import time
import MySQLdb as mdb

arduino = serial.Serial('/dev/ttyACM1', baudrate=9600)

data = arduino.readline()
time.sleep(1)
data = arduino.readline()#read data from arduino
pieces = data.split("\t")  #spl2t the data by the tab

temperature = pieces[0]
humidity = pieces[1]
flames = pieces[2]

if temperature > 0.00 and temperature <= 30.00 : temp =  "Normal"
elif temperature  > 30.00 and temperature <= 35.00 : temp =  "Hot"
elif temperature  > 35.00 : temp = "Dangerous"
if flames == 0 : flame =  "Close fire"
elif flames == 1 : flame = "Distance fire"
elif flames == 2 : flame =  "No fire"

con = mdb.connect("localhost", "root", "test", "FYPtest")or die ("could not connect to database")

with con:
    cursor =con.cursor()
    cursor.execute("INSERT INTO fyp (TEMP,HUM,T_STAT, F_STAT) VALUES (%s, %s,%s, %s)", (temperature,humidity,temp,flame ))
    
con.commit()

cursor.close()

Ok so basically this is the python code to let me get data from arduino and display in Raspberry Pi. Although i able to get the temperature value which is 30. However, the temp status is Dangerous, by right i should be “Normal” value is under 30. Can anyone help me to solve this issue? TQ

Can anyone help me to solve this issue?

I'll bet someone could, if you asked your Python question on a Python forum.

Your post has NOTHING to do with the Arduino.

lukason96:
Ok so basically this is the python code to let me get data from arduino and display in Raspberry Pi.

I don't see anything in your Python code to let you know what it actually receives from the Arduino.

This Python - Arduino demo my be of interest.

...R

pieces = data.split("\t") 
temperature = pieces[0]

if temperature > 0.00 and temperature <= 30.00 : temp =  "Normal"

temperature is a string and you are comparing it to a float. This raises a TypeError in Python 3.x, but is allowed in 2.x. However, the result is not what you expect.

Make sure you are using the right types:

temperature = float(pieces[0])
humidity = float(pieces[1])
flames = int(pieces[2])  # assuming this is indeed integer