Giter Site home page Giter Site logo

Covers position? about controllinomqtt HOT 8 CLOSED

lknop avatar lknop commented on June 18, 2024
Covers position?

from controllinomqtt.

Comments (8)

lknop avatar lknop commented on June 18, 2024

@ricreis394 can you elaborate what you mean by "covers return position value" ?

I am also integrating this with home assistant, but I need to complete modbus configuration before it's ready.

from controllinomqtt.

plckr avatar plckr commented on June 18, 2024

Cover position I mean a value between 0 and 100% where 0 is fully closed and 100 is fully opened, this can be calculated based on time, it's only necessary to put the time length between fully closed to fully opened, the software makes all the math
Here is an example from esphome: https://esphome.io/components/cover/time_based.html

Will you integrate to Home Assistant via modbus? I thought you will use mqtt instead
With mqtt there's a very great advantage, the discovery function

from controllinomqtt.

lknop avatar lknop commented on June 18, 2024

No I need modbus because I have wellpro modules wired to switches and lights and already connected to controllino. Currently it's hardcoded and I have to support modbus<->mqtt bridge before migrating to home assistant because some of the lights will not work. I could probably use modbus integration from home assistant but I don't want to rewire it, and also in controllino I can poll the inputs very fast.

Regarding the cover issue, it seems to me that it should be configurable in home assistant, controllino does not contain any logic, it just reads the inputs and switches on/off the digital outputs and relays. If you have an idea how it can be done I am open to discussion.

from controllinomqtt.

plckr avatar plckr commented on June 18, 2024

About the cover position, it can be made in Home Assistant, but it's better in controllino since controllino works without Home Assistant, even if you take a restart on HA and then close the roller shutter, when HA boots up it stays the last state remembered, if controllino gives that feedback it's more accurate.
I guess the code for the position is like this: https://github.com/esphome/esphome/blob/dev/esphome/components/time_based/time_based_cover.cpp#L126-L150

from controllinomqtt.

plckr avatar plckr commented on June 18, 2024

Hey, long time we first talked.
I see you are very active lately, I started my code in November 2020, check it out my repository, maybe it has something to gather ideas
https://github.com/ricreis394/controllino-home-control

from controllinomqtt.

lknop avatar lknop commented on June 18, 2024

@ricreis394 Hi, yes I finally decided to go forward with this project which has been sitting in half-baked state for a very long time.

Back in the summer I got stuck at some memory issues with the code I forked, there was either some buffer overflow or stack overflow. On the other hand, I liked the working of the configuration class which allows changing values without a rebuild and it made a lot of sense in how it was designed. I also thought the Button class was nice - with built-in debouncing.

However, to finally have a workable lighting in my home I had to fix the issues, but without breaking the whole electricity for a week. I did a prototype copy from arduino mega with ethernet shield and I was able to code and test it completely independent from the controllino (see the #ifdefs for SIMULATED_CONTROLLINO).

To clean up memory I first converted all strings to use PROGMEM and then I recreated the whole Button, Event, EventArgs, FastDelegate and Timer logic with 20 lines of plain C, no objects on the heap etc.

I was thinking whether to put logic into controllino, but decided against it, instead I will try to add any logic I need to home assistant. Thanks to mqtt autodiscovery I can publish all inputs and outputs automatically and they appear available for use in Home Assistant.

However, in case anything breaks in Home Assistant or my network, there is also a fallback logic - a basic switch/light combination, which is controlled by a jumper - I noticed there is a convenient RXD2 pin next to GND in controllino mega. The jumper is in the X2 pin connector, in case I need to run controllino without network I can remove the jumper and have workable lights (at least for the important parts of the house like bathroom, kitchen etc.)

I looked at your project and it looks really nice, the Button/Callback is much more sensible than in the original project (that ugly FastDelegate was bugging me from the start). Maybe I could also reuse the Modbus slave class you created, this looks much cleaner than what I have come up with.

When looking for automation hardware I became a fan of modbus, I have two WP8026ADAM input modules, 16 inputs each, and I can handle 50 switches (2x module + controllino) very easily, very cheaply. The only big problem is that the modules need to be polled very quickly to avoid delays, that's why it's handled by controllino.

Let me know if you need some support, I think we have different needs about what controllino has to do so it's not possible to merge the two, but several bits are common and could be shared. If I had seen your project earlier I think I would have based mine on that.

from controllinomqtt.

lknop avatar lknop commented on June 18, 2024

@ricreis394 Regarding the original issue about covers position, now that I know much more about controllino and home assistant, it seems to me that it could be resolved by mqtt retained messages - Controllino could publish the cover state in mqtt with retained flag.

However, this still requires hardcoding of which inputs/outputs control which cover. I was thinking about storing it in controllino but somehow make it generic and hopefully dynamic - perhaps controllino could poll configuration from mqtt. Or it could be input via serial and stored in EEPROM.

My covers are handled by qubino z-wave modules. Not the best idea to have it wireless, but it has a local button so it can work without any other controller or automation software.

So far I am happy with what I have, almost everything works as I intended. There were just a few minor bugs but they are now fixed and I will live with what I have now. Actually I have to wire remaining switches because there are still a few unconnected ones. Once all is working I can think about making further changes.

from controllinomqtt.

plckr avatar plckr commented on June 18, 2024

@lknop I do use a Configuration namespace too, started without it but later, when code expands I needed that. For two reasons mainly, so I can access static elements inside from anywhere, even in protected scopes, the other reason was to simplify the readings and have every main element in a single place.

For the buttons, I have a class with builtin debouncing, which I'm using OneButton Library to do the hard work.

For the position of covers, I prefer not rely on external sources, and since I use a Nextion display, this needs to work even without lan connection. I'm using a Shutters library, which I find it pretty useful.

Modbus is working fine for me, I have support for buttons (inputs) and switches/lights (outputs), shutters in my case will be in the main controllino so I don't need that to support modbus. One thing I didn't tested yet is add a lot of inputs and outputs in modbus, and try to simulate very buttons pressed at the same time to see how it reacts.

I didn't knew about WP8026ADAM and never thought about buy it instead of another controllino, but makes sense. Maybe I'll buy one :) seems insteresting.

Since I have a nextion display, my Alarm core will be in Controllino, keypad in nextion, so far, I'm really impressed with Nextion capabilities.

Sure our projects are very different, at first I was searching all over the place to find a nice project instead of hardcoding, but never found. And I'm glad I started coding, I can now change anything more quickly and easier.

from controllinomqtt.

Related Issues (2)

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.