Outils pour utilisateurs

Outils du site


serialkiller-plugins-metar

Installation plugin metar

git clone https://github.com/tomp/python-metar.git
cd python-metar
python setup.py install
#!/usr/bin/env python
# -*- coding: utf-8 -*-
 
import os
import time
 
from skplugins import addValuePlugin, addEventPlugin, addValue, addEvent
from skplugins.weather.skmetar import skmetar
 
server = '192.168.1.1'
while True:
 
    # Check metar for LFMT station
    result = skmetar(cachefile='/tmp/metar_34.cache', station='LFMT')
    addValue(server, 'city:weather:temp', 'float', result.results['result'])
    addValue(server, 'city:weather:dewpt', 'float', result.results['dewpt'])
    addValue(server, 'city:weather:humidity', 'float', result.results['humidity'])
    addValue(server, 'city:weather:pressure', 'float', result.results['pressure'])
    addValue(server, 'city:weather:wind_chill', 'float', result.results['wind_chill'])
    addValue(server, 'city:weather:wind_speed', 'float', result.results['wind_speed'])
    addValue(server, 'city:weather:visibility', 'ushort', result.results['visibility'])
 
    #Sleep
    time.sleep(5)
serialkiller-plugins-metar.txt · Dernière modification: 2015/08/12 22:29 (modification externe)