Coverage for janitoo.value : 87%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*-
"""
This file is part of Janitoo.
Janitoo 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 3 of the License, or (at your option) any later version.
Janitoo 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. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Janitoo. If not, see <http://www.gnu.org/licenses/>.
"""
# Set default logging handler to avoid "No handler found" warnings. try: # Python 2.7+ # pragma: no cover from logging import NullHandler # pragma: no cover except ImportError: # pragma: no cover class NullHandler(logging.Handler): # pragma: no cover """NullHandler logger for python 2.6""" # pragma: no cover def emit(self, record): # pragma: no cover pass # pragma: no cover
############################################################## #Check that we are in sync with the official command classes #Must be implemented for non-regression
##############################################################
""" :param int uuid: the unique uuid of the value on the controller """ """The UUID of the value""" """The UUID of the node the valuse is attached to""" """The voice_uuid of this value. Can be use to a""" """The HADD of the node associated to this value""" """The command class implemented by the value""" """Is the value readonly""" """Is the value writeonly""" """The default data of the value""" """The help of the value""" """The label of the value""" """The units of the value""" """The list of all valid items when the value type is list. This list is separated with pipe : '|'""" """The max of the value""" """The min of the value""" """The genre of the value""" """The type of the value""" """Get the value index (use with multi_instance nodes)""" """Say if the value is polled""" """The delay between 2 polls""" """The callback to get the value""" """The callback to get the value""" """The last known data of the value""" """The hadd to reply to"""
def data(self): """ Get the current data of the value.
:return: The data of the value :rtype: depending of the type of the value
"""
def data(self, value): """ Set the data of the value.
Best practice: Use check_data before setting it:
new_val = value.check_data(some_data) if new_val != None: value.data = new_val
:param value: The new data value :type value:
""" res = True if self._set_data_cb is not None: res = self._set_data_cb(self.node_uuid, self.index, value) if res == True: self._data = value return res
"""Update internal dict from adict """ self.__dict__.update(adict) return self
"""Retrieve a dict version of the value """
"""Retrieve a json version of the value """ res = self.to_dict() return json_dumps(res)
help='The heartbeat delay in seconds', label='heartbeat', units='seconds', index=0, cmd_class=COMMAND_CONFIGURATION, genre=0x04, max=3000, min=0, type=0x04, is_readonly=False, is_writeonly=False, is_polled=False, poll_delay=0, get_data_cb = get_data_cb, set_data_cb = set_data_cb )
help='The config timeout before applying configuration and rebooting', label='config_timeout', units='seconds', index=0, cmd_class=COMMAND_CONFIGURATION, genre=0x04, max=3000, min=0, type=0x04, is_readonly=False, is_writeonly=False, is_polled=False, poll_delay=0, get_data_cb = get_data_cb, set_data_cb = set_data_cb )
help='The Janitoo Home address', label='hadd', units='', index=0, cmd_class=COMMAND_CONFIGURATION, genre=0x04, type=0x20, is_readonly=False, is_writeonly=False, is_polled=False, poll_delay=0, get_data_cb = get_data_cb, set_data_cb = set_data_cb )
help='The name of the node', label='name', index=0, cmd_class=COMMAND_CONFIGURATION, genre=0x03, type=0x08, is_readonly=False, is_writeonly=False, is_polled=False, poll_delay=0, get_data_cb = get_data_cb, set_data_cb = set_data_cb )
help='The location of the node', label='location', index=0, cmd_class=COMMAND_CONFIGURATION, genre=0x03, type=0x08, is_readonly=False, is_writeonly=False, is_polled=False, poll_delay=0, get_data_cb = get_data_cb, set_data_cb = set_data_cb )
return JNTValue( uuid=uuid, help=help, label=label, index=index, cmd_class=COMMAND_CONFIGURATION, genre=0x03, type=0x04, is_readonly=False, is_writeonly=False, is_polled=False, default = default, poll_delay=0, get_data_cb = get_data_cb, set_data_cb = set_data_cb ) |