Coder Social home page Coder Social logo

Comments (5)

clach04 avatar clach04 commented on June 24, 2024

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.

clach04 avatar clach04 commented on June 24, 2024

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.

from x10_any.

clach04 avatar clach04 commented on June 24, 2024

@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.

akeshan avatar akeshan commented on June 24, 2024

Tried the latest version and it works great, very responsive.

from x10_any.

clach04 avatar clach04 commented on June 24, 2024

@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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.