%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/beacons/ |
Current File : //lib/python2.7/site-packages/salt/beacons/sensehat.pyo |
� ���^c @@ s� d Z d d l m Z m Z d d l Z d d l Z d d l m Z d d l m Z e j e � Z d � Z d � Z d � Z d S( u6 Monitor temperature, humidity and pressure using the SenseHat of a Raspberry Pi =============================================================================== .. versionadded:: 2017.7.0 :maintainer: Benedikt Werner <1benediktwerner@gmail.com> :maturity: new :depends: sense_hat Python module i ( t absolute_importt unicode_literalsN( t six( t mapc C@ s d t k S( Nu sensehat.get_pressure( t __salt__( ( ( s9 /usr/lib/python2.7/site-packages/salt/beacons/sensehat.pyt __virtual__ s c C@ sU t | t � s t d f Si } t t | j | � � d | k rK t d f St d f S( u+ Validate the beacon configuration u1 Configuration for sensehat beacon must be a list.u sensorsu3 Configuration for sensehat beacon requires sensors.u Valid beacon configuration( t isinstancet listt FalseR t updatet True( t configt _config( ( s9 /usr/lib/python2.7/site-packages/salt/beacons/sensehat.pyt validate s c C@ s� g } i d d 6d d 6d d 6} i } t t | j | � � xb| j d i � D]N} d j | � } | t k r� t j d | � qP n | d | } t | t � r� t j | d � } t j | d � } n! | j | d � } t j | � } d | k rt j d d | � } n d | k r6t j d d | � } n t | � } t | � } t | � } | | k or| k n sP | j i d j | � d 6| | 6� qP qP W| S( u� Monitor the temperature, humidity and pressure using the SenseHat sensors. You can either specify a threshold for each value and only emit a beacon if it is exceeded or define a range and emit a beacon when the value is out of range. Units: * humidity: percent * temperature: degrees Celsius * temperature_from_pressure: degrees Celsius * pressure: Millibars .. code-block:: yaml beacons: sensehat: - sensors: humidity: 70% temperature: [20, 40] temperature_from_pressure: 40 pressure: 1500 u 0u humidityu pressureu -273.15u temperatureu sensorsu sensehat.get_{0}u&