Wer kann mir helfen

Ich habe einen Raspberry Pi 3 model b und möchte einen Lüfter und eine Heizung steuern.
die app zeigt auch die werte an aber nur wenn die pull zeiten verschieden sind.
push und somit die konstante speicherung der daten auch wenn die app nicht geöffnet ist funktioniert gar nicht.
der Code ist in Python 3 geschrieben.

import blynklib
import Adafruit_DHT
import RPi.GPIO as GPIO
import time

BLYNK_AUTH = '************************************'

blynk = blynklib.Blynk(BLYNK_AUTH, server='blynk-cloud.com', port=80, heartbeat=10, rcv_buffer=1024, log=print)
    #blynk = blynklib.Blynk(BLYNK_AUTH)


GPIO_SENSOR = 17
GPIO_l = 29
GPIO_h = 12
sensor = Adafruit_DHT.DHT11

T_VPIN = 7
H_VPIN = 8



def setup():
    GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
    GPIO.setup(GPIO_h, GPIO.OUT) # Set ledPin's mode is output
    GPIO.setup(GPIO_l, GPIO.OUT)
    GPIO.output(GPIO_h, GPIO.LOW) # Set ledPin low to off led
    GPIO.output(GPIO_l, GPIO.LOW)
    #print ('h using pin%d'%GPIO_h)
    #print ('l using pin%d'%GPIO_l)

#def t():
    
                              
setup()

@blynk.handle_event('read v7')
def read_handler(T_VPIN):
    time.sleep(3)
    sensor = Adafruit_DHT.DHT11  # possible sensor modifications .DHT11 .DHT22 .AM2302. Also DHT21 === DHT22
    Feuchtigkeit, Temperatur = Adafruit_DHT.read_retry(sensor, GPIO_SENSOR)
    print('Temperatur={}'.format(Temperatur))
    blynk.virtual_write(T_VPIN, Temperatur)
    #Feuchtigkeit, Temperatur = Adafruit_DHT.read_retry(sensor, GPIO_SENSOR)
    #print('Temperatur={0:0.1f}*C  Feuchtigkeit={1:0.1f}%'.format(Temperatur, Feuchtigkeit))
    if Temperatur <= 24.0:
        print("Heizung an")
        GPIO.output(GPIO_h, GPIO.HIGH)
    elif Temperatur >= 26.0:
        print("Heizung aus")
        GPIO.output(GPIO_h, GPIO.LOW)
    else:
            print("Heizung im Standby")
    

  
    
@blynk.handle_event('read v8')    
def read_handler_2(H_VPIN):
    #time.sleep(3)
    sensor = Adafruit_DHT.DHT11  # possible sensor modifications .DHT11 .DHT22 .AM2302. Also DHT21 === DHT22
    Feuchtigkeit, Temperatur = Adafruit_DHT.read_retry(sensor, GPIO_SENSOR)
    print('Feuchtigkeit={}'.format(Feuchtigkeit))
    blynk.virtual_write(H_VPIN, Feuchtigkeit)
    
    
    if Feuchtigkeit > 50.0:
        print("Lüfter an")
        GPIO.output(GPIO_l, GPIO.HIGH)
    else:
        print("Lüfter aus")
        GPIO.output(GPIO_l, GPIO.LOW)
import blynklib
import Adafruit_DHT
import RPi.GPIO as GPIO
import time

BLYNK_AUTH = '***************************************'

blynk = blynklib.Blynk(BLYNK_AUTH, server='blynk-cloud.com', port=80, heartbeat=10, rcv_buffer=1024, log=print)
    #blynk = blynklib.Blynk(BLYNK_AUTH)


GPIO_SENSOR = 17
GPIO_l = 29
GPIO_h = 12
sensor = Adafruit_DHT.DHT11

T_VPIN = 7
H_VPIN = 8



def setup():
    GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
    GPIO.setup(GPIO_h, GPIO.OUT) # Set ledPin's mode is output
    GPIO.setup(GPIO_l, GPIO.OUT)
    GPIO.output(GPIO_h, GPIO.LOW) # Set ledPin low to off led
    GPIO.output(GPIO_l, GPIO.LOW)
    #print ('h using pin%d'%GPIO_h)
    #print ('l using pin%d'%GPIO_l)

#def t():
    
                              
setup()

@blynk.handle_event('read v7')
def read_handler(T_VPIN):
    time.sleep(3)
    sensor = Adafruit_DHT.DHT11  # possible sensor modifications .DHT11 .DHT22 .AM2302. Also DHT21 === DHT22
    Feuchtigkeit, Temperatur = Adafruit_DHT.read_retry(sensor, GPIO_SENSOR)
    print('Temperatur={}'.format(Temperatur))
    blynk.virtual_write(T_VPIN, Temperatur)
    #Feuchtigkeit, Temperatur = Adafruit_DHT.read_retry(sensor, GPIO_SENSOR)
    #print('Temperatur={0:0.1f}*C  Feuchtigkeit={1:0.1f}%'.format(Temperatur, Feuchtigkeit))
    if Temperatur <= 24.0:
        print("Heizung an")
        GPIO.output(GPIO_h, GPIO.HIGH)
    elif Temperatur >= 26.0:
        print("Heizung aus")
        GPIO.output(GPIO_h, GPIO.LOW)
    else:
            print("Heizung im Standby")
    

  
    
@blynk.handle_event('read v8')    
def read_handler_2(H_VPIN):
    #time.sleep(3)
    sensor = Adafruit_DHT.DHT11  # possible sensor modifications .DHT11 .DHT22 .AM2302. Also DHT21 === DHT22
    Feuchtigkeit, Temperatur = Adafruit_DHT.read_retry(sensor, GPIO_SENSOR)
    print('Feuchtigkeit={}'.format(Feuchtigkeit))
    blynk.virtual_write(H_VPIN, Feuchtigkeit)
    
    
    if Feuchtigkeit > 50.0:
        print("Lüfter an")
        GPIO.output(GPIO_l, GPIO.HIGH)
    else:
        print("Lüfter aus")
        GPIO.output(GPIO_l, GPIO.LOW)







def destroy():
    GPIO.output(GPIO_h, GPIO.LOW)
    GPIO.output(GPIO_l, GPIO.LOW)
    GPIO.cleanup()


if __name__  ==  "__main__":
    setup()
    try:
        while True:
                    blynk.run()
                    #t()
    except KeyboardInterrupt: 
        destroy()
´´´

Kann mir hier denn niemand helfen?

I do appreciate your desire to implement this project using the Raspberry Pi, but as I’ve explained before, there are not many people using this platform for this type of project.
You’ll get much more support, and probably complete your project sooner if you switch to a more mainstream MCU.

Pete.

Da ich aber trotzdem in Python programmieren möchte, bringt mir ne andere Mcu doch auch nichts… Alle Beispiele sind doch in C geschrieben.
Vll sollte Blynk ma drüber nachdenken den Support für Python einzustellen da es ihn ja scheinbar eh nicht gibt.
Sonst würde ich hier ja Hilfe bekommen.
Trotzdem Danke

From what you said before, you’ve spent a week learning Python. The learning curve for C++ would be much lower, because all of the sketch builder examples are written on C++ and there is a large pool of knowledge to help steer you in the right direction.

I think the Blynk Python library originally was a bit of a weekend hobby for one of the Blynk staff. It was then re-written quite a bit, but dome of the methods and syntax changed as a result. I think experienced Python users could probably use it effectively, but in reality the overwhelming majority of makers using MCUs are programming in C++, because the Arduino formed the roots of the current MCU wave.

This will be my last post on the subject for you, as I’m sure you are tired of hearing me say the same thing.

Good luck with your project and I hope you manage to make some progress.

Pete.