예제 #1
0
def add_weather_module():
  payload = {
    'type': MODULE_NAME
  }
  add_module_action = create_action('ADD_WEATHER_MODULE', payload)
  send_action(add_module_action)

  weather_action = create_weather_action(app_config.LOCATION['lat'], app_config.LOCATION['lon'])
  send_action(weather_action)
예제 #2
0
def set_room_temp(id, temp):
  """
  """
  payload = {
    'id': id,
    'temperature': temp
  }
  action = create_action('SET_ROOM_TEMP', payload)
  send_control_message(action)
예제 #3
0
def set_weather(temp):
  """
  """
  payload = {
    'temp': temp,
    'temp_min': temp,
    'temp_max': temp
  }
  action = create_action('SET_TEMP_WEATHER', payload)
  send_control_message(action)
예제 #4
0
import config
import time
import sense
from mqtt_publish import message_system
import autostat.app_config as app_config
from app.actions import create_action

payload = {
  'id': config.id,
  'temperature': sense.get_temperature()
}
register_satellite_action = create_action('REGISTER_SATELLITE', payload)
message_system(register_satellite_action)

while True:
  temp_action = sense.temp_update(config.id)
  message_system(temp_action)
  time.sleep(app_config.INTERVAL)
예제 #5
0
def create_weather_action(lat, lon):
  temperature_data = get_weather(lat, lon)
  weather_action = create_action('WEATHER_UPDATE', temperature_data)
  return weather_action