pictureferro.blogg.se

Easyweather import data
Easyweather import data





  1. #Easyweather import data software#
  2. #Easyweather import data code#

find ( "tempf" ) != - 1 : temp_out = round (( float ( item ) - 32.0 ) * 5 / 9, 2 ) data_dict ' ] = temp_out if item. find ( "baromabsin" ) != - 1 : barometer_abs_in = round (( float ( item ) * 33.86389 ), 2 ) #inch_mercury-hpa data_dict ' ] = barometer_abs_in if item. find ( "baromrelin" ) != - 1 : barometer_rel_in = round (( float ( item ) * 33.86389 ), 2 ) #inch_mercury-hpa data_dict ' ] = barometer_rel_in if item. find ( "humidityin" ) != - 1 : hum_in = int ( item ) data_dict ' ] = hum_in if item. find ( "tempinf" ) != - 1 : temp_in = round (( float ( item ) - 32.0 ) * 5 / 9, 2 ) #from F to C data_dict ' ] = temp_in if item. replace ( '+', 'T' ) data_dict = ws_datetime if item. find ( "dateutc" ) != - 1 : ws_datetime = item.

easyweather import data

split ( '&' ) #print(data_list) for item in data_list : if item. subscribe ( MQTT_TOPIC, 0 ) def on_disconnect ( _client, _userdata, _message ): """Callback that is executed when we disconnect from the broker.""" print ( "Disconnected from the broker." ) def on_subscribe ( _client, _userdata, _mid, _granted_qos ): """Callback that is executed when subscribing to a topic.""" print ( 'Subscribed on topic.' ) def on_unsubscribe ( _client, _userdata, _mid, _granted_qos ): """Callback that is executed when unsubscribing to a topic.""" print ( 'Unsubscribed on topic.' ) def on_message ( _client, _userdata, message ): """Callback that is executed when a message is received.""" print ( 'Message received.' ) def parse_ecowitt_data ( data ): """Parse the ecowitt data and add it to a dictionnary.""" data_dict = # create empty dictionary data_list = data.

easyweather import data

#Easyweather import data code#

Subscribe to the topic (topic name, QoS).""" print ( "Connected with result code " + str ( result_code )) mqtt_client. # """ # pylint: disable-msg=C0103 # pylint: disable-msg=R0912 # pylint: disable-msg=R0914 # pylint: disable-msg=R0915 # pylint: disable-msg=W0105 import socket import sys from time import strftime, localtime from datetime import datetime import as mqtt HOST = '' # empty: all interfaces PORT = 8000 # MQTT things MQTT_CLIENT_ID = "weatherstation_" + strftime ( " %s ", localtime ()) # must be unique!# must be unique! MQTT_SERVER_IP = "192.168.1.60" # 127.0.0.1 if mosquitto is running on same server as python script MQTT_SERVER_PORT = 1883 MQTT_TOPIC = "weigu/garden/garden/weatherstation" #- Functions - def on_connect ( _client, _userdata, _flags, result_code ): """Callback that is executed when the client receives a CONNACK response from the server.

#Easyweather import data software#

# You should have received a copy of the GNU General Public License # along with this program if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. See the # GNU General Public License for more details. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

easyweather import data

#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ # Name: weather_ecowitt_2_mqtt.py # Purpose: Get the ecowitt weather data on port 8000 and send data to # the mqtt server # Author: # Date: # Version 1.0 # Copyright 2020 weigu # This program is free software you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation either version 2 of the License, or # (at your option) any later version.







Easyweather import data