@license: MIT License @note: Created on Jun 26, 2015 @Summary: Routines to load and save basic Device Data """ __updated__ = '2019-07-31' # Import system type stuff # Import PyHouse files from Modules.House import utils from Modules.Core.Utilities.xml_tools import PutGetXML, XmlConfigTools from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.DeviceTools ') class XML(object): @staticmethod def read_base_device_object_xml(p_obj, p_xml): """ Get the BaseUUIDObject entries from the XML element. Adds: Device Info, Room Info. @param p_obj: is the object we wish to populate with data @param p_xml: is the element we will extract data from (including children). """ XmlConfigTools.read_base_UUID_object_xml(p_obj, p_xml) try: # p_obj.Comment = PutGetXML.get_text_from_xml(p_xml, 'Comment')
__version_info__ = (18, 10, 1) __version__ = '.'.join(map(str, __version_info__)) # Import system type stuff # Import PyMh files from Modules.House.Family.insteon import insteon_utils from Modules.House.Family.insteon.insteon_hvac import DecodeResponses as DecodeHvac from Modules.House.Family.insteon.insteon_light import DecodeResponses as DecodeLight from Modules.House.Family.insteon.insteon_security import DecodeResponses as DecodeSecurity from Modules.House.Family.insteon.insteon_link import Decode as linkDecode from Modules.House.Family.insteon.insteon_constants import ACK, STX, X10_HOUSE, X10_UNIT, X10_COMMAND from Modules.House.Family.insteon.insteon_utils import Decode as utilDecode from Modules.Core.Utilities.debug_tools import FormatBytes from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.insteon_decode ') # OBJ_LIST = [Lights, Controllers, Buttons, Thermostats, Irrigation, Pool] class DecodeResponses(object): m_pyhouse_obj = None m_idex = 0 def __init__(self, p_pyhouse_obj, p_controller_obj): self.m_pyhouse_obj = p_pyhouse_obj self.m_controller_obj = p_controller_obj self.m_link = linkDecode(p_pyhouse_obj, p_controller_obj) LOG.info('Starting Decode')
__version_info__ = (19, 5, 1) __version__ = '.'.join(map(str, __version_info__)) # Import system type stuff from datetime import datetime import platform import importlib # Import PyHouse files from Modules.Core.Utilities import extract_tools, uuid_tools, config_tools from Modules.Computer.Nodes.nodes import MqttActions as nodesMqtt from Modules.Core.Utilities.debug_tools import PrettyFormatAny from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.Computer ') COMPUTER_DIVISION = 'ComputerDivision' UUID_FILE_NAME = 'Computer.uuid' CONFIG_FILE_NAME = 'computer.yaml' MODULES = [ 'Bridges', 'Communication', 'Internet', 'Node', 'Pi', # 'Weather', 'Web' ]
__updated__ = '2019-07-05' # Import system type stuff import os # Import PyMh files and modules. from Modules.Core import logging_pyh as Logger from Modules.Core.Utilities import json_tools # Handy helper for finding external resources nearby. webpath = os.path.join(os.path.split(__file__)[0]) templatepath = os.path.join(webpath, 'template') g_debug = 0 LOG = Logger.getLogger('PyHouse.webUpdate ') class UpdateElement(athena.LiveElement): """ a 'live' webs element. """ docFactory = loaders.xmlfile( os.path.join(templatepath, 'updateElement.html')) jsClass = u'update.UpdateWidget' def __init__(self, p_workspace_obj, _p_params): self.m_workspace_obj = p_workspace_obj self.m_pyhouse_obj = p_workspace_obj.m_pyhouse_obj @athena.expose def getUpdateData(self):
@Summary: If garage door opens and after sunset and before sunrise, turn on outside garage door lights. """ from _ast import Pass __updated__ = '2019-08-01' __version_info__ = (19, 8, 0) __version__ = '.'.join(map(str, __version_info__)) # Import system type stuff # Import PyMh files and modules. from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.RulesXml ') class RulesInformation: """ The collection of information about a house. Causes JSON errors due to API type data methinks. ==> PyHouse.House.xxx as in the def below. """ def __init__(self): self.Name = None self.Comment = None self.Event = None # List of Names of the events that triggers this rule self.Condition = None # List of additional conditions to activate the rule self.Device = None # the device to control self.Type = None # The type (On/Off)
# Import system type stuff from datetime import datetime import fnmatch # Filename matching with shell patterns import netifaces # has gateways(), ifaddresses(). interfaces() from netifaces import * import os import pyudev import subprocess # Import PyMh files and modules. from Modules.Core.data_objects import NodeInformation, NodeInterfaceData # from Modules.Communication import ir_control from Modules.Core.Utilities.uuid_tools import Uuid as toolUuid from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.NodeLocal ') __all__ = [ 'NODE_NOTHING', 'NODE_USB_CONTROLLER', 'NODE_PANDORA', 'NODE_CAMERA', 'NODE_PIFACECAD', 'NODE_V6ROUTER', 'API' ] NODE_NOTHING = 0x0000 # a basic node with no special functions NODE_USB_CONTROLLER = 0x0001 # Node has an attached controller for Lights (optionally other stuff) NODE_PANDORA = 0x0002 # Node can use pianobar to receive Pandora streams NODE_CAMERA = 0x0004 # Pi with attached camera (not USB camera) NODE_PIFACECAD = 0x0008 # NODE_V6ROUTER = 0x0010 # Iv6 Router node NODE_NOT_UNIX = 0x0020 # Windows - not Linux NODE_TUNNEL = 0x0040 # IPv6 Tunnel NODE_IR = 0x0080 # Infrared receiver and optional transmitter
__updated__ = '2019-09-01' __version_info__ = (19, 8, 1) __version__ = '.'.join(map(str, __version_info__)) # Import system type stuff # Import PyHouse files from Modules.Core.Utilities import config_tools from Modules.House.rooms import Config as roomConfig from Modules.House.Family.family import Config as familyConfig from Modules.Core.Utilities.debug_tools import PrettyFormatAny from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.LightingButton ') CONFIG_FILE_NAME = 'buttons.yaml' class ButtonInformation: def __init__(self): self.Name = None self.Comment = None self.DeviceType = 'Lighting' self.DeviceSubType = 'Button' self.Family = None # FamilyInformation() self.Room = None # RoomInformation() class ButtonFamilyInformation:
@copyright: (c) 2013-2017 by D. Brian Kimmel @license: MIT License @note: Created on May 30, 2013 @summary: Handle all of the information for a house. """ # Import system type stuff import os from nevow import loaders from nevow import athena # Import PyMh files and modules. from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.webHMenu ') # Handy helper for finding external resources nearby. webpath = os.path.join(os.path.split(__file__)[0]) templatepath = os.path.join(webpath, 'template') class HouseMenuElement(athena.LiveElement): """ """ docFactory = loaders.xmlfile( os.path.join(templatepath, 'houseMenuElement.html')) jsClass = u'houseMenu.HouseMenuWidget' def __init__(self, p_workspace_obj): self.m_workspace_obj = p_workspace_obj
""" __updated__ = '2019-09-04' __version_info__ = (19, 5, 1) __version__ = '.'.join(map(str, __version_info__)) # Import system type stuff # Import PyMh files from Modules.House.Family.family_utils import FamUtil from Modules.House.Lighting.lighting_utility import Utility from Modules.House.Lighting.lighting_lights import LightData from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.Schedule_lightn') class API(): m_pyhouse_obj = None def __init__(self, p_pyhouse_obj): self.m_pyhouse_obj = p_pyhouse_obj LOG.info("Initialized.") def LoadXml(self, _p_pyhouse_obj): """ Load the Schedule from the XML info. """ LOG.info('Loaded Schedules XML')
This is a skeleton until we start the use of the data. Things are just a placeholder for now. """ __updated__ = '2019-07-31' # Import system type stuff import xml.etree.ElementTree as ET # Import PyMh files and modules. from Modules.House.Irrigation.irrigation_data import IrrigationSystemData, IrrigationZoneData from Modules.Core import logging_pyh as Logger from Modules.Core.Utilities.xml_tools import PutGetXML, XmlConfigTools LOG = Logger.getLogger('PyHouse.IrrigationXml ') DIVISION = 'HouseDivision' SECTION = 'IrrigationSection' SYSTEM = 'System' ZONE = 'Zone' class Xml(object): """ """ @staticmethod def _read_one_zone(p_xml): """ @param p_xml: XML information for one Zone. @return: an IrrigationZone object filled in with data from the XML passed in
# Import system type stuff import datetime # Import PyMh files from Modules.Core.Utilities import extract_tools, config_tools from Modules.Core.Utilities.coordinate_tools import Coords from Modules.Core.Utilities.json_tools import encode_json from Modules.Core.Utilities.config_tools import ConfigYamlNodeInformation from Modules.House.house_data import \ RoomInformation, \ RoomsInformationPrivate from Modules.Core.Utilities.debug_tools import PrettyFormatAny from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.Rooms ') CONFIG_FILE_NAME = 'rooms.yaml' class RoomInformation: """ A room of the house. Used to draw pictures of the house Used to define the location of switches, lights etc. ==> PyHouse.House.Rooms.xxx as in the def below """ def __init__(self): self.Name = None self.Comment = None
# Import system type stuff try: import Queue except ImportError: import queue as Queue # Import PyMh files from Modules.Families.family_utils import FamUtil from Modules.Families.UPB.UPB_data import UPBData from Modules.Families.UPB.UPB_constants import pim_commands from Modules.Core.Utilities.debug_tools import FormatBytes from Modules.Core.Utilities.debug_tools import PrettyFormatAny from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.UPB_PIM ') # UPB Control Word # Page 15 LINK_PKT = 0x80 LOW_REQ = 0x02 ACK_REQ = 0x10 ACK_ID = 0x20 ACK_MSG = 0x40 # Timeouts for send/receive delays SEND_TIMEOUT = 0.8 RECEIVE_TIMEOUT = 0.9 # this is for fetching data in the RX buffer # Command types
__version_info__ = (19, 9, 1) __version__ = '.'.join(map(str, __version_info__)) # Import system type stuff # Import PyHouse files from Modules.Core.Utilities import config_tools from Modules.House.Lighting.buttons import API as buttonsApi from Modules.House.Lighting.controllers import API as controllersApi, MqttActions as controllerMqtt from Modules.House.Lighting.lights import API as lightsApi, MqttActions as lightMqtt from Modules.House.Lighting.outlets import API as outletsApi from Modules.Core.Utilities.debug_tools import PrettyFormatAny from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.Lighting ') CONFIG_FILE_NAME = 'lighting.yaml' class LightingInformation: """ ==> PyHouse.House.Lighting.xxx as in the def below """ def __init__(self): self.Buttons = None # ==> ButtonInformation() self.Controllers = None # ==> ControllerInformation() self.Lights = None # ==> LightInformation() self.Outlets = None # ==> OutletInformation
import os import yaml from twisted.internet.endpoints import TCP4ClientEndpoint from twisted.internet.error import ConnectionDone from twisted.internet.protocol import Factory from twisted.protocols.basic import LineReceiver from queue import Queue # Import PyMh files and modules. from Modules.Core.Utilities import convert from Modules.Core.Utilities import extract_tools from Modules.House.Entertainment.entertainment_data import EntertainmentDeviceInformation, EntertainmentDeviceControl, EntertainmentDeviceStatus from Modules.Core.Utilities.debug_tools import PrettyFormatAny from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.Onkyo ') SECTION = 'onkyo' class OnkyoDeviceInformation(EntertainmentDeviceInformation): """ A superet that contains some onkyo specific fields """ def __init__(self): super(OnkyoDeviceInformation, self).__init__() pass class OnkyoDeviceControl(EntertainmentDeviceControl): """ Used to control a device. All defaults are None - Only fill in what you need so inadvertent controls are not done.
FamilyYaml_ModuleAPI will point to Insteon_yaml.API() where LoadConfig """ __updated__ = '2019-09-06' __version_info__ = (19, 9, 1) __version__ = '.'.join(map(str, __version_info__)) # Import system type stuff import importlib # Import PyHouse files from Modules.Core.Utilities.debug_tools import PrettyFormatAny from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.Family ') CONFIG_FILE_NAME = 'families.yaml' class FamilyModuleInformation: """ A container for every family that has been defined in modules. PyHouse_obj.House.Family.() PyHouse_obj.House.Family is a dict indexed by lower() family name. Each entry is an object of this class. """ def __init__(self): self.Name = None self.DeviceName = None # insteon_device
""" __updated__ = '2019-09-04' __version_info__ = (19, 8, 1) __version__ = '.'.join(map(str, __version_info__)) # Import system type stuff # Import PyMh files from Modules.Core.Utilities import config_tools from Modules.House.Family.family import Config as familyConfig from Modules.House.rooms import Config as roomConfig from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.MotionSensor ') CONFIG_FILE_NAME = 'motion_sensor.yaml' class MotionSensorInformation: """ This is the motion sensor data ==> PyHouse.House.Security.Motion.xxx as in the def below """ def __init__(self): self.Name = None self.Comment = None self.DeviceType = 'Security' self.DeviceSubType = 'MotionSensor' self.Family = None # FamilyInformation()
@license: MIT License @note: Created on Mar 20, 2012 @summary: This module sends our external IP to freedns. """ __updated__ = '2019-07-30' # Import system type stuff from twisted.web.client import getPage from twisted.internet.defer import Deferred # Import PyMh files and modules. from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.Internet ') INITIAL_DELAY = 1 * 60 class DynDnsAPI(object): """Update zero or more dynamic DNS sites. This is a repeating two stage process. First get our current External IP address. Second, update zero or more Dyn DNS sites with our address Then wait UpdateInterval time and repeat forever. Allow for missing responses so as to not break the chain of events. """ def XX__init__(self, p_internet_obj, p_reactor): """ Wait a bit to avoid all the starting chaos. """
""" __updated__ = '2019-09-04' __version_info__ = (19, 8, 1) __version__ = '.'.join(map(str, __version_info__)) # Import system type stuff # Import PyMh files from Modules.Core.Utilities import config_tools from Modules.House.Family.family import Config as familyConfig from Modules.House.rooms import Config as roomConfig from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.GarageDoor ') CONFIG_FILE_NAME = 'garagedoor.yaml' class GarageDoorInformation: """ ==> PyHouse.House.Security.GarageDoors.xxx as in the def below """ def __init__(self): self.Name = None self.Comment = None self.DeviceType = 'Security' self.DeviceSubType = 'GarageDoor' self.Family = None # FamilyInformation()
@summary: Display a clock on the web page. """ __updated__ = '2019-03-02' # Import system type stuff import os import time from twisted.web._element import Element # Import PyMh files and modules. from Modules.Core.Utilities import json_tools from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.webClock ') # Handy helper for finding external resources nearby. modulepath = FilePath('Modules/Computer/Web/') templatepath = modulepath.child('template') class ClockElement(Element): jsClass = u'clock.ClockWidget' docFactory = loaders.xmlfile( os.path.join(templatepath, 'clockElement.html')) def __init__(self, p_workspace_obj, _p_params): self.m_workspace_obj = p_workspace_obj self.m_pyhouse_obj = p_workspace_obj.m_pyhouse_obj
@note: Created on Apr 3, 2011 @license: MIT License @summary: This module is for Insteon/X10 """ __updated__ = '2019-08-09' # Import system type stuff import xml.etree.ElementTree as ET # Import PyMh files from Modules.Core import logging_pyh as Logger g_debug = 0 LOG = Logger.getLogger('PyHouse.Dev_X10 ') class ReadWriteXml(object): """Overload the base methods with specific ones here. """ def extract_device_xml(self, p_device_obj, _p_entry_xml): """ @param p_entry_xml: is the e-tree XML house object @param p_house: is the text name of the House. @return: a dict of the entry to be attached to a house object. """ return p_device_obj def insert_device_xml(self, p_entry_xml, p_device_obj): if p_device_obj.Family.Name == 'Insteon':
from Modules.Core.Utilities import uuid_tools, config_tools from Modules.House import location, rooms, floors from Modules.House.rooms import Mqtt as roomsMqtt from Modules.House.Entertainment.entertainment import MqttActions as entertainmentMqtt from Modules.House.Hvac.hvac import MqttActions as hvacMqtt from Modules.House.Irrigation.irrigation import MqttActions as irrigationMqtt from Modules.House.Lighting.lighting import MqttActions as lightingMqtt from Modules.House.Schedule.schedule import MqttActions as scheduleMqtt from Modules.House.Lighting.outlets import MqttActions as outletMqtt from Modules.Core.Utilities.debug_tools import PrettyFormatAny from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.House ') CONFIG_FILE_NAME = 'house.yaml' UUID_FILE_NAME = 'House.uuid' # Note that the following are in the order needed to sequence the startup MODULES = [ 'Lighting', 'Hvac', 'Security', 'Irrigation', 'Pool', 'Rules', 'Schedule', 'Sync', 'Entertainment', 'Family' ] class HouseInformation: """ The collection of information about a house. Causes JSON errors due to API type data methinks.
__updated__ = '2017-01-27' # Import system type stuff import os from nevow import athena from nevow import loaders # Import PyMh files and modules. from Modules.Core.data_objects import ThermostatData from Modules.Computer.Web import web_family, web_utils from Modules.Computer.Web.web_utils import GetJSONHouseInfo from Modules.Core.Utilities import json_tools from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.webThermost ') # Handy helper for finding external resources nearby. webpath = os.path.join(os.path.split(__file__)[0]) templatepath = os.path.join(webpath, 'template') class ThermostatsElement(athena.LiveElement): """ a 'live' thermostat element. """ docFactory = loaders.xmlfile( os.path.join(templatepath, 'thermostatElement.html')) jsClass = u'thermostats.ThermostatsWidget' def __init__(self, p_workspace_obj, _p_params): self.m_workspace_obj = p_workspace_obj
Json is now used for Mqtt messages in addition to web browser. """ __updated__ = '2019-08-20' # Import system type stuff import jsonpickle # Import PyMh files from Modules.Core.Utilities.debug_tools import FormatBytes from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.Json_Tools ') def encode_json(p_obj): """Convert a python object to a valid json object. """ try: l_json = jsonpickle.encode(p_obj, unpicklable=False, max_depth=5) except (TypeError, ValueError) as l_error: LOG.error('ERROR encode_json{}'.format(l_error)) l_json = u'{}' return l_json def decode_json_unicode(p_json): """Convert a json object to a valid python object.
""" @name: Modules/House/Security/login.py @author: D. Brian Kimmel @contact: [email protected] @copyright: (c) 2019-2019 by D. Brian Kimmel @note: Created on Jul 23, 2019 @license: MIT License @summary: Handle logging in. """ # Import system type stuff # Import PyMh files and modules. from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.Security ') class LoginInformation: """ """ def __init__(self): self.Name = None # Username self.Password = None class Config: """ """ m_pyhouse_obj = None
@copyright: (c) 2019-2019 by D. Brian Kimmel @note: Created on Jan 20, 2019 @license: MIT License @summary: """ __updated__ = '2019-08-10' # Import system type stuff # Import PyMh files # from Modules.Families.family_utils import FamUtil from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.LightUtility ') class Utility: """ """ def _test_object_by_id(self, p_obj, name=None, key=None, UUID=None): """ Return the device object for a house using the given value. A name, key or UUID may be used to identify the device. @return: the Device object found or None. """ if name != None and p_obj.Name == name: return p_obj elif key != None and p_obj.Key == key:
import os # from nevow import athena # from nevow import loaders # Import PyMh files and modules. from Modules.Core.data_objects import ScheduleBaseData from Modules.Computer.Web.web_utils import GetJSONHouseInfo from Modules.Core import logging_pyh as Logger from Modules.Core.Utilities import json_tools # Handy helper for finding external resources nearby. webpath = os.path.join(os.path.split(__file__)[0]) templatepath = os.path.join(webpath, 'template') g_debug = 0 LOG = Logger.getLogger('PyHouse.webSchedule ') class SchedulesElement(athena.LiveElement): """ a 'live' schedules element. """ docFactory = loaders.xmlfile( os.path.join(templatepath, 'schedulesElement.html')) jsClass = u'schedules.SchedulesWidget' def __init__(self, p_workspace_obj, _p_params): self.m_workspace_obj = p_workspace_obj self.m_pyhouse_obj = p_workspace_obj.m_pyhouse_obj @athena.expose def getHouseData(self):
# Import system type stuff from twisted.internet.endpoints import TCP4ClientEndpoint from twisted.internet.error import ConnectionDone from twisted.internet.protocol import Protocol, ClientFactory from twisted.conch.telnet import StatefulTelnetProtocol from queue import Queue # Import PyMh files and modules. from Modules.Core.Utilities import extract_tools, config_tools from Modules.House.Entertainment.entertainment_data import EntertainmentDeviceInformation, EntertainmentDeviceStatus from Modules.House.Entertainment.entertainment import EntertainmentPluginInformation from Modules.Core.Utilities.debug_tools import PrettyFormatAny from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.Pioneer ') SECTION = 'pioneer' DISCONNECT_TIMER = 30 # Seconds CONFIG_FILE_NAME = 'pioneer.yaml' # See https://tylerwatt12.com/vsx-822k-telnet-interface/ CONTROL_COMMANDS = { 'PowerQuery': b'?P', 'PowerOn': b'PN', 'PowerOff': b'PF', 'VolumeQuery': b'?V', 'VolumeUp': b'VU', 'VolumeDown': b'VD', 'MuteQuery': b'?M', 'FunctionQuery': b'?F',
@note: Created on Jun 5, 2015 @Summary: Connect this computer node to the household Mqtt Broker. """ __updated__ = '2019-08-17' # Import system type stuff from twisted.internet import defer # from twisted.internet.endpoints import SSL4ClientEndpoint # from twisted.internet.ssl import Certificate, optionsForClientTLS # Import PyMh files and modules. from Modules.Core.Mqtt.mqtt_protocol import PyHouseMqttFactory from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.Mqtt_Client ') CLIENT_PREFIX = 'PyH-Comp-' PEM_FILE = '/etc/pyhouse/ca_certs/rootCA.pem' class Struct: def __init__(self, **args): self.__dict__.update(args) class Util(object): """ """
from twisted.web.template import Element, XMLString, renderer # Import PyMh files and modules. from Modules.Drivers import VALID_INTERFACES, VALID_PROTOCOLS from Modules.Housing.Hvac import VALID_TEMP_SYSTEMS, VALID_THERMOSTAT_MODES from Modules.Families import VALID_FAMILIES, VALID_DEVICE_TYPES from Modules.Housing import VALID_FLOORS from Modules.Housing.Lighting import VALID_LIGHTING_TYPE from Modules.Housing.Schedules import VALID_SCHEDULING_TYPES, VALID_SCHEDULE_MODES from Modules.Core import logging_pyh as Logger from Modules.Core.Utilities.debug_tools import PrettyFormatAny from Modules.Computer.Web.web_users import VALID_USER_ROLES from Modules.Core.Utilities import json_tools from Modules.Core.data_objects import LoginData LOG = Logger.getLogger('PyHouse.WebLogin ') # Handy helper for finding external resources nearby. webpath = os.path.join(os.path.split(__file__)[0]) templatepath = os.path.join(webpath, 'template') class LoginElement(Element): """ a login element containing a username and password. """ loader = XMLString(( """ <!-- PyHouse/Project/src/Modules/Computer/Web/templates/mainpage.html --> <!DOCTYPE html> <html xmlns='http://www.w3.org/1999/xhtml'
""" __updated__ = '2017-01-19' # Import system type stuff import os from nevow import loaders from nevow import athena # Import PyMh files and modules. from Modules.Core.data_objects import MotionSensorData from Modules.Computer.Web import web_family, web_utils from Modules.Computer.Web.web_utils import GetJSONHouseInfo from Modules.Core.Utilities import json_tools from Modules.Core import logging_pyh as Logger LOG = Logger.getLogger('PyHouse.webMotion ') # Handy helper for finding external resources nearby. webpath = os.path.join(os.path.split(__file__)[0]) templatepath = os.path.join(webpath, 'template') class MotionSensorsElement(athena.LiveElement): """ a 'live' controllers element. """ docFactory = loaders.xmlfile( os.path.join(templatepath, 'motionSensorsElement.html')) jsClass = u'motionSensors.MotionSensorsWidget' def __init__(self, p_workspace_obj, _p_params): self.m_workspace_obj = p_workspace_obj