Giter VIP home page Giter VIP logo

Comments (3)

marylein avatar marylein commented on September 26, 2024 1

Hi @guevara777 , in the image you connect GPIO 18 and 19, but in the code you define the tx and rx for 16 and 17. Is that just a typo?
I'm using the exact same devices but I can't get this setup to work...

from loctekmotion_iot.

guevara777 avatar guevara777 commented on September 26, 2024

The Image is wrong. In the code it´s right. I use the GPIO-Pins 16 and 17 like this:

uart:
  id: desk_uart
  baud_rate: 9600
  tx_pin: GPIO17
  rx_pin: GPIO16

Here is the correct wirering:
image

I also added a position-action since i posted it here. You can populate the cover to Alexa and use voice commands like "set the desk to 70%".

for this you have to add this to the yaml-file:

    # Move desk to desired position
    position_action:
    #Check if we need to move desk up or down from current position
      if:
        condition:
        #Current height is more than target height, then move desk down
          lambda: |-
            float position = (float(id(desk_height).state) - float(${min_height})) / (float(${max_height}) - float(${min_height}));
            return pos < position;
        then:
          - logger.log: "Schreibtisch muss runter gefahren werden"
          - while:
              condition:
                # Move down till the current height is smaller then the target height
                lambda: |-
                  float position = (float(id(desk_height).state) - float(${min_height})) / (float(${max_height}) - float(${min_height}));
                  return pos < position;
              then:
                - logger.log: "Executing down command"
                - cover.template.publish:
                    id: desk_cover
                    current_operation: CLOSING
                - uart.write:
                    id: desk_uart
                    data: [0x9b, 0x06, 0x02, 0x02, 0x00, 0x0c, 0xa0, 0x9d]
                - delay: 108ms
        else:
          - logger.log: "Schreibtisch muss hoch gefahren werden"
          - while:
              condition:
                # Move up till the current height is bigger then the target height
                lambda: |-
                  float position = (float(id(desk_height).state) - float(${min_height})) / (float(${max_height}) - float(${min_height}));
                  return pos > position;
              then:
                - logger.log: "Executing up command"
                - cover.template.publish:
                    id: desk_cover
                    current_operation: OPENING
                - uart.write:
                    id: desk_uart
                    data: [0x9b, 0x06, 0x02, 0x01, 0x00, 0xfc, 0xa0, 0x9d]
                - delay: 108ms

from loctekmotion_iot.

xXkr13g3rXx avatar xXkr13g3rXx commented on September 26, 2024

Hi guys. If I add the second part (Move desk to desired position) i get a double definition error from position_action.

I‘m a noob in coding and do need help there. Can anyone help me?

from loctekmotion_iot.

Related Issues (20)

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.