Jump to content

OutdoorWeather Python Code Probleme


devilz

Recommended Posts

Hallo zusammen,

 

ich versuche grade die Wetterstation mit dem OutdoorWeather Modul zu erweitern.

 

Leider bekomme ich die Werte aus der cb_station_data/cb_sensor_data Callback nicht in die Button_Callbackfunktion.

 

    def cb_station_data(self, identifier, temperature, humidity, battery_low):

            print("Identifier (Station): " + str(identifier))

            print("Temperature (Station): " + str(temperature/10.0) + " °C")

            print("Humidity (Station): " + str(humidity) + " %RH")

            print("Battery Low (Station): " + str(battery_low))

            print("")

 

 

    def cb_sensor_data(self, identifier, temperature, humidity):

            print("Identifier (Sensor): " + str(identifier))

            print("Temperature (Sensor): " + str(temperature/10.0) + " °C")

            print("Humidity (Sensor): " + str(humidity) + " %RH")

            print("")

 

 

    def cb_button_pressed(self, button):

            lt = localtime()

            date = (strftime(" %d %b %Y  %H:%M", lt))           

            if button == 2:

                if self.lcd.is_backlight_on():

                    self.lcd.backlight_off()

                else:

                    self.lcd.backlight_on()

            if button == 3:           

                self.lcd.write_line(0, 0, date)

                self.lcd.write_line(1, 0, " ***  Sensor1  ***")

                self.lcd.write_line(2, 0, "Temperatur: ...")

                self.lcd.write_line(3, 0, "Feuchtigkeit ...")

 

Gibt es hier eine Möglichkeit die Werte aus den beiden Callbacks oben in die Button Callbackfunktion zu übernehmen?

Wie kann ich die Sensorwerte gezielt in eine Variable speichern?

 

Danke für jeden Tipp ;)

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...