Skip to content

Commit

Permalink
Work with real Mochad server use \r as terminator
Browse files Browse the repository at this point in the history
Fixes issue #1, see issue #1 comments for reasons but the main one
is to more closely follow telnet payload.
  • Loading branch information
clach04 committed Jul 20, 2016
1 parent 0f52f95 commit 6d2c8d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion x10_any/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ class MochadDriver(X10Driver):
NOTE This implementation opens the socket and then closes it for each command.
TODO implement status support, see https://github.com/zonyl/pytomation/blob/master/pytomation/interfaces/mochad.py
Useful Mochad references:
* Wiki is down as of 2016-07
* https://sourceforge.net/p/mochad/code/ci/master/tree/README
* https://bfocht.github.io/mochad/
* https://bfocht.github.io/mochad/mochad_reference.html
* https://github.com/SensorFlare/mochad
"""

def __init__(self, device_address=None, default_type=None):
Expand Down Expand Up @@ -240,7 +247,7 @@ def _x10_command(self, house_code, unit_number, state):
house_and_unit = to_bytes(house_and_unit)
# TODO normalize/validate state
state = to_bytes(state)
mochad_cmd = self.default_type + b' ' + house_and_unit + b' ' + state + b'\n' # byte concat works with older Python 3.4
mochad_cmd = self.default_type + b' ' + house_and_unit + b' ' + state + b'\r\n' # byte concat works with older Python 3.4
log.debug('mochad send: %r', mochad_cmd)
mochad_host, mochad_port = self.device_address
result = netcat(mochad_host, mochad_port, mochad_cmd)
Expand Down
1 change: 1 addition & 0 deletions x10_any/cm17a.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import serial

# The FireCracker spec is at http://text.staticfree.info/cm17a_proto.txt
# http://www.edcheung.com/automa/rf.txt

leadInOutDelay = 0.5
bitDelay = 0.001
Expand Down

0 comments on commit 6d2c8d7

Please sign in to comment.