Started to flesh out device classes proposed interfaces
1 parent 4f174ba commit 55de8694948784c7690a3078d20136f8cae85ae8
@David Whale David Whale authored on 17 May 2016
Showing 2 changed files
View
14
doc/classes.txt
 
--------------------------------------------------------------------------------
REQUIREMENTS
 
1. To be able to write expressive and compact applications,
1. EXPRESSIVE: To be able to write expressive and compact applications,
that talk in the vocabulary of physical devices.
 
a. All known Energenie devices to be modelled as classes inside a
device database, and the capabilities and operations on those devices
and allows users to focus ore on the intents of the application, rather
than the implementation details.
 
 
2. To be able to build a local registry of devices and their configurations,
2. NAME REGISTRY: To be able to build a local registry of devices and their configurations,
and refer to devices by name inside the application.
 
a. to be configurable by learning (e.g. listen for messages such as
a join message, and add the device to the registry)
e. the registry can be queried, such as 'find me all devices that are of
type x' or 'find me all devices in location kitchen'.
 
 
3. To be able to command and query devices in a way that represents
3. INTENTS: To be able to command and query devices in a way that represents
meaningful device-based intents (such as tv.on() and tv.get_power())
 
a. received data values to be cached for deferred query, such as get_power()
 
d. the last known state of a transmitting device to be known (e.g. switch state
both by commanded state and retrieved state)
 
 
4. To be able to refer to user devices in an Energenie device agnostic way.
4. AGNOSTIC: To be able to refer to user devices in an Energenie device agnostic way.
 
e.g. it doesn't matter if the TV is plugged into a green button device,
or a MiHome device. It is always tv.on() in the code.
 
 
5. To be able to instigate and manage learn mode from within an app
5. LEARN/DISCOVER: To be able to instigate and manage learn mode from within an app
 
a. To send specific commands to green button devices so they can
learn the pattern
 
 
c. To process MiHome join requests, and send MiHome join acks
 
 
6. To completely hide the user from the on-air radio interface
6. ABSTRACTED RADIO: To completely hide the user from the on-air radio interface
 
a. choosing the correct radio frequency and modulation automatically
 
b. choosing the correct physical layer configuration automatically,
 
Not as part of this work, but this should at least be enabled
by the design
 
7. To be able to build a well performing system
7. PERFORMING: To be able to build a well performing system
with very few message collisions and message losses
 
a. by dynamically learning report patterns of MiHome devices
 
View
81
src/energenie/Devices.py
if productid == PRODUCTID_MIHO005: return True
return False
 
 
#----- NEW DEVICE CLASSES -----------------------------------------------------
 
class Device():
pass
# get_manufacturer_id
# get_product_id
# get_sensor_id
 
# get_last_receive_time
# get_last_send_time
# get_next_receive_time
# get_next_send_time
 
# incoming_message (OOK or OpenThings as appropriate, stripped of header? decrypted, decoded to pydict)
# send_message (a link out to the transport, could be mocked, for example)
 
 
class EnergenieDevice(Device):
pass
# get_radio_config -> config_selector? (freq, modulation) config_parameters? (inner_repeats, delay, outer_repeats)
# has_switch
# can_send
# can_receive
 
 
class LegacyDevice(EnergenieDevice):
pass
# modulation = OOK
# freq = 433.92MHz
# codec = 4bit
 
 
class ENER002(LegacyDevice):
pass
# turn_on
# turn_off
 
 
class MiHomeDevice(EnergenieDevice):
pass
# modulation = FSK
# freq = 433.92MHz
# codec = OpenThings
 
 
class MIHO005(MiHomeDevice): # Adaptor Plus
pass
# tx_repeats = 4
# turn_on
# turn_off
# is_on
# is_off
# get_switch
# get_voltage
# get_frequency
# get_apparent
# get_reactive
# get_real
 
 
class MIHO006(MiHomeDevice): # Home Monitor
pass
# get_battery_voltage
# get_current
 
 
class MIHO012(MiHomeDevice): # eTRV
pass
# tx_repeats = 10
# get_battery_voltage
# get_ambient_temperature
# get_pipe_temperature
# get_setpoint_temperature
# set_setpoint_temperature
# get_valve_position
# set_valve_position
# turn_on
# turn_off
# is_on
# is_off
 
# END