• Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. jcmschoot
    J
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 4
    • Best 0
    • Controversial 0
    • Groups 0

    jcmschoot

    @jcmschoot

    0
    Reputation
    191
    Profile views
    4
    Posts
    0
    Followers
    0
    Following
    Joined Last Online
    Location Netherlands

    jcmschoot Unfollow Follow

    Latest posts made by jcmschoot

    • RE: Unipi 1.1 Evok 1.0.1 to 2.0.7 no UART

      It seems that I have used a modified version of Evok 1.0.2
      My apigpio.py contains the following class:

      class SerialBus(_PigBus):
          def __init__(self, circuit=1,
                       host=os.getenv("PIGPIO_ADDR", ''),
                       port=os.getenv("PIGPIO_PORT", 8888),
                       uart_port="",
                       uart_baudr=0
                       ):
              super(SerialBus, self).__init__(circuit, host, port)
              # _PigBus.__init__(self, circuit, host, port)
              self.uart_port = uart_port
              self.uart_baudr=uart_baudr
      
          def full(self):
              return {'dev': 'serialbus', 'circuit': self.circuit, 'uart_port': self.uart_port, 'uart_baudr': self.uart_baudr}
      

      And in the unipi.py

      class P1(object):
          """ 
              P1 to Serial
          
          """
      
          def __init__(self, serialbus, circuit):
              self.circuit=circuit
              self.serialbus = serialbus
              print("Opening serialbus: ", serialbus.uart_port)
              self.uart= serialbus.serial_open(serialbus.uart_port, serialbus.uart_baudr)
              atexit.register(self.stop)
      
          def stop(self):
              self.serialbus.serial_close(self.uart)
      
          def full(self):
              return {'dev': 'P1', 'circuit':self.circuit, 'value':self.data}
      
      
          @gen.coroutine
          def read_loop(self, mainloop):
              print("Entering read loop")
              #mainloop = IOLoop.instance()
              self.completedata=""
              try:
      
                  while True:
                      if (self.read()):
                          yield gen.Task(mainloop.call_later, 5)
      
              except Exception, E:
                  print("%s" % str(E))
          
          @gen.coroutine
          def read(self):
              with (yield self.serialbus.iolock.acquire()):
                  rdy=yield self.serialbus.apigpio_command(pigpio. _PI_CMD_SERDA, self.uart,0)
              if (rdy > 0):
                 # print("Bytes ready: ") + str(rdy)
                  with (yield self.serialbus.iolock.acquire()):
                      bytes = pigpio.u2i((yield self.serialbus.apigpio_command(pigpio._PI_CMD_SERR, self.uart, rdy)))
                      if bytes > 0:
                            databytes= yield self.serialbus.arxbuf(bytes)
                  
                  self.completedata= self.completedata+str(databytes)
                  if "!" in databytes: 
                      self.data=self.completedata
                      devents.status(self)
                      self.completedata=""
                      return
          
              raise gen.Return(True)
      

      But since it is not original to Evok I probably have to figure this out on my own..

      posted in Official EVOK API
      J
      jcmschoot
    • RE: Unipi 1.1 Evok 1.0.1 to 2.0.7 no UART

      @martin_triska The UART it self works, I have tested that on the PI with an serial console test and also with the unipig library in a python test app. But the UART device implementation is not in the EVOK 2.0.7 anymore.

      posted in Official EVOK API
      J
      jcmschoot
    • RE: Unipi 1.1 Evok 1.0.1 to 2.0.7 no UART

      Sorry for the late reply.

      The UART port on the Unipi 1.1. I have connected it to an digital "smart" electricity meter we use. The digital meter produces messages in P1 format on it's RS232 port which is connected to the UART port on the Unipi 1.1.
      This all worked fine in Evok 1.0.1. but in Evok 2.0.7 the UART port cannot be addressed..

      I made slight changes to the Evok 1.0.1 so the UART input/ P1 messages will be send in the websocket connection. I tried to copy and change this to Evok 2.0.7 but I am missing parts to connect to the UART port.

      I have tested if it is possible using the unipig libraries of Unipi 2.0.7 in a separate python app and that works.

      posted in Official EVOK API
      J
      jcmschoot
    • Unipi 1.1 Evok 1.0.1 to 2.0.7 no UART

      I have upgraded my Evok 1.0.1 to 2.0.7 on my Unipi 1.1. Now I am missing the UART interface in EVOK. What happend to it? And can I get it back?

      posted in Official EVOK API
      J
      jcmschoot