logo elektroda
logo elektroda
X
logo elektroda

Raspberry, domoticz physical and remote switches, and GPIO pin extension

bplukaszbp 7131 12
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 17464855
    bplukaszbp
    Level 10  
    Hello,

    There are many instructions on the network how to control the relay, let's turn on the lamp with domoticz and it actually works after configuration :) . My question is how do I add a doorbell switch to all of this? I do not know how to set the GPIO pin in domoticz as the input and connect it in the program so that the switch can be turned on both with the bell switch and remotely with domoticz.
    I will add that I want to use a raspberry to control lighting at home and this is where another question arises. There are too few GPIO pins in raspberry for me to use them as inputs and outputs for that lighting. Is it enough to buy an external extension of the GPIO pins to solve this problem and it will be possible to configure it so that in domoticz these pins are also visible, or do I need to connect it all, for example, under the arduinono mega (here there are enough pins and the control is currently working) and connect them with raspberry using mysensors? Let me add that I would prefer to omit the arduino entirely if it was possible ... Thanks in advance for your help.
    Do you have a problem with Arduino? Ask question. Visit our forum Arduino.
  • ADVERTISEMENT
  • #2 17650477
    neo_84
    Level 15  
    I am looking for exactly the same everywhere a lot of information how to turn on the relay but from the domoticz panel. It would be a bit nonsense to go everywhere with a smartphone to turn on the light, and what if the battery dies?
    Has anyone solved this problem? how to configure it so that the lighting works remotely and via the button
  • #3 17659042
    Arek1984
    Level 16  
    And isn't it better to use esp8266 to control the light and only have domoticz on rpi?
  • #4 17659524
    Slawek K.
    Level 35  
    You need some hardware to make it work via a button. I have it on esp8266 and more specifically on the Wemos D1 Mini. In the light switch box I have a self-produced module with esp and relay and an input for connecting the switch. I replaced the ordinary bistable switch with a monostable one (eg "Bell") and after giving the impulse, the state of the relay changes to the opposite, turning off and on the light, and at the same time I can also control it from the domotics. ESPEasy uploaded to esp8266.

    Greetings
  • ADVERTISEMENT
  • #5 17666935
    neo_84
    Level 15  
    Arek1984 wrote:
    And isn't it better to use esp8266 to control the light and only have domoticz on rpi?

    hmm sure and better On the other hand, to have 20 or more esp, does it not send a signal? all via wifi.
    The creators of domoticza made the program available for free, so you have to take what is. Maybe it's better to buy an arduino and expand the ports, but the question is whether it works with fakes ch340?
  • #6 17667477
    Slawek K.
    Level 35  
    [quote = "neo_84"]
    Arek1984 wrote:
    .... Maybe it's better to buy an arduino and expand the ports, but the question is whether it works with fakes ch340?

    How does this affect the operation of domotics? ch340 is pretty good chip, serial-> usb converter like any other.

    Pos
  • ADVERTISEMENT
  • #7 17747050
    credens
    Level 10  
    My friend. You set yourself some GPIO as input by editing the file in the console:

    sudo nano /etc/init.d/domoticz.sh

    At the end you add e.g. for pin 27:

    
    /usr/bin/gpio export 27 in
    /usr/bin/gpio edge 27 both

    You restart Domoticz.

    Then in the panel you add the switch as 'Contact' and below in the list you select GPIO. If you correctly edited domoticz.sh, you should be able to choose pin 27 as INPUT. You add a device and by shorting the pin to 5V, the arrows on the screen should turn red (the reaction of the program works with a slight delay).
  • #8 18460879
    zbzu
    Level 9  
    I will hook to the topic, because I want to start the option of adding switches in Domoticz by activating the GPIO I / O and something is not working for me and I do not know why. I added these commands in the domoticz.sh file as it is given in this thread and when I want to activate the switch in domoticz, in the GPIO field I have the GPIO INIT ERROR message instead of the GPIO pin address to choose from. Anyone can tell what's wrong?
  • ADVERTISEMENT
  • #9 18464653
    zbzu
    Level 9  
    I will answer myself because I have already fought the problem. Wiring that is uploaded is ver2.5 and the new Raspberry Pi 4 B raspberry requires uploading the 2.52 wiring version and then it works as it should.
    It may be useful to someone
  • #10 18762331
    peete1978
    Level 9  
    Hello,

    I wanted to connect to the topic:

    I wanted to connect the lighting switch on the terrace with the domotic via WIFI and the MQTT protocol.
    I connected the usual bistable switch via sonoff mini (with the ESP Easy Mega v.20200328 soft loaded) according to the diagram.
    The problem is that it works from domotics, but the physical switch does not, how to fix it?

    In sonoff: I set GPIO 0 to the physical switch, and GPIO12 to the relay as below.
    Raspberry, domoticz physical and remote switches, and GPIO pin extension

    BUTTON:
    Raspberry, domoticz physical and remote switches, and GPIO pin extension

    RELAY:
    Raspberry, domoticz physical and remote switches, and GPIO pin extension

    DOMOTICZ:
    Raspberry, domoticz physical and remote switches, and GPIO pin extension


    Thanks in advance for your help
  • #11 18762405
    starob
    Level 29  
    Set BUTTON: IDX = 8 Send To Controler.

    With your settings, you send the switch state in vain.
    If that doesn't work, create a "dummy" switch and assign its index.
    Associate the "dummy" state with Taras

    The physical button should be "bell" because there will be times when you will have to switch it twice
  • #12 18770011
    peete1978
    Level 9  
    I made changes as posted but it didn't help.

    A friend helped me solve the mystery.

    The problem was the wrong assignment of the GPIO.
    After assigning the BUTTON to the GPIO4, the physical and domotic switch works.
    Raspberry, domoticz physical and remote switches, and GPIO pin extension
    Thanks for the help.
    best regards
  • #13 18775001
    peete1978
    Level 9  
    I have one more question about the switch, not related directly to the Raspberry, but more to the sonof and the switch itself.
    Namely, the switch from the Simon basic series with LED backlight works as it should, except ..... backlight (in the normal system, the backlight turns on when the light on the terrace is turned off, it goes out when it is turned on).
    I understand that at the moment the switch itself is not plugged into the 230v circuit, but only gives an impulse to the sonoff when turned on and off.
    I would like the visible backlight of the switch itself. During the day I will not know if the light is on on the terrace - and I would like to be able to judge it with one glance at the switch, the question is how to push it / bypass the problem so that the backlight in the switch works?
    Someone struggled with it and solved the problem.
    Thanks in advance for your help.

Topic summary

The discussion revolves around integrating a doorbell switch with Domoticz on a Raspberry Pi for controlling lighting both remotely and via a physical switch. Users share various methods to configure GPIO pins as inputs in Domoticz, including editing the domoticz.sh file to set up GPIO pin states. Suggestions include using ESP8266 modules for relay control and the importance of proper GPIO assignments to ensure functionality. Issues with physical switches not working alongside Domoticz are addressed, with solutions involving correct GPIO configurations and the use of dummy switches. Additionally, users discuss the limitations of GPIO pins on Raspberry Pi and the potential for using Arduino for expanded control.
Summary generated by the language model.
ADVERTISEMENT