Comments (5)
Proposed fix:
diff --git a/x10_any/__init__.py b/x10_any/__init__.py
index 7660c06..fbcc74b 100644
--- a/x10_any/__init__.py
+++ b/x10_any/__init__.py
@@ -240,7 +240,7 @@ class MochadDriver(X10Driver):
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' # 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)
from x10_any.
The source code for Mochad, in encode.c:837
cm15a_encode()
appear to check for either \r
or \n
(it also checks for end-of-string), the behavior reported in clach04/home-assistant-x10#1 (comment) implies that is not working.
- Many of the code samples for Mochad (including the Python tk demo) only use
\n
- however the Perl code sample explicitly uses
\r
.
- however the Perl code sample explicitly uses
- hautomation_x10 sends
\n\n
- see https://github.com/jpardobl/hautomation_x10/blob/master/hautomation_x10/cmds.py#L19 and https://github.com/jpardobl/hautomation_x10/blob/master/hautomation_x10/driver.py#L22 - pytomation uses
\r
(well the byte literal\x0D
which is the same thing) https://github.com/zonyl/pytomation/blob/master/pytomation/interfaces/mochad.py#L151 - netcat
nc
(at least the default one Ubuntu uses which is the BSD implementation) when used withecho
only uses\n
- proved with a listen mode ofnc -l 1099 | od -c
- telnet uses the sequence
\r\n
(confirmed using nc listen mode) as expected and as that works for the original reported Mochad server this seems to be the way to go. Using this also works with the current version of https://bitbucket.org/clach04/mochad_firecracker
from x10_any.
@akeshan can you try the current version from git please? Example test.
import x10_any
x10_any.default_logger.setLevel(x10_any.logging.DEBUG) # DEBUG
dev = x10_any.MochadDriver()
dev.x10_command('B', 4, x10_any.ON)
dev.x10_command('B', 4, x10_any.OFF)
Thanks.
from x10_any.
Tried the latest version and it works great, very responsive.
from x10_any.
@akeshan many thanks for your assistance with this, https://pypi.python.org/pypi/x10_any/0.0.6 now posted and should be pip installable and working.
from x10_any.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from x10_any.