Smart Home Automation Forum
how to add Raspberry Pi GPIO integration to home assistant for SERVER-MINI - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=1)
+--- Forum: KinCony Server-Mini / Server-16 Raspberry Pi4 relay module (https://www.kincony.com/forum/forumdisplay.php?fid=53)
+--- Thread: how to add Raspberry Pi GPIO integration to home assistant for SERVER-MINI (/showthread.php?tid=3184)



how to add Raspberry Pi GPIO integration to home assistant for SERVER-MINI - admin - 08-22-2023

1. make home assistant SD card for KinCony Server-16.

download  https://www.raspberrypi.com/software/

2. install HACS addon (use by SSH)

https://hacs.xyz/docs/setup/download/

3. install "rpi_gpio" through HACS.

https://github.com/thecode/ha-rpi_gpio

4. config ymal for CM4 GPIOs.

install file edit add-on for HA , then config yaml

-------------------------------------
switch:
  - platform: rpi_gpio
    switches:
      - port: 5
        name: "CM4 relay1"
      - port: 22
        name: "CM4 relay2"
      - port: 17
        name: "CM4 relay3"
      - port: 4
        name: "CM4 relay4"
      - port: 6
        name: "CM4 relay5"
      - port: 13
        name: "CM4 relay6"
      - port: 19
        name: "CM4 relay7"
      - port: 26
        name: "CM4 relay8"
       
binary_sensor:
  - platform: rpi_gpio
    sensors:
      - port: 18
        name: "CM4 IN1"
        invert_logic: true
      - port: 23
        name: "CM4 IN2"
        invert_logic: true
      - port: 24
        name: "CM4 IN3"
        invert_logic: true
      - port: 25
        name: "CM4 IN4"
        invert_logic: true
      - port: 12
        name: "CM4 IN5"
        invert_logic: true
      - port: 16
        name: "CM4 IN6"
        invert_logic: true
      - port: 20
        name: "CM4 IN7"
        invert_logic: true
      - port: 21
        name: "CM4 IN8"
        invert_logic: true


RE: how to add Raspberry Pi GPIO integration to home assistant - kovalank - 08-29-2023

How to synchronize a physical button with a KinCony Server-Mini Raspberry Pi4 relay module?
Please give examble code!
When a physical button or switch is connected as a binary input,
For example, in the code you provided, port 18 is configured as a binary input (CM4 IN1). When this input is low, the Raspberry Pi will enable port5 CM4 relay1, 
When the input is high, the Raspberry Pi will disable CM4 relay1.


RE: how to add Raspberry Pi GPIO integration to home assistant - admin - 08-29-2023

if you are using home assistant, just create "AUTOMATION" in home assistant, when INPUT trigger OUTPUT "TOGGLE" is ok.


RE: how to add Raspberry Pi GPIO integration to home assistant - kovalank - 08-30-2023

(08-29-2023, 10:04 PM)admin Wrote: if you are using home assistant, just create "AUTOMATION" in home assistant, when INPUT trigger OUTPUT "TOGGLE" is ok.

How it work offline or when network fail, is it work?


RE: how to add Raspberry Pi GPIO integration to home assistant - admin - 08-30-2023

it can work without network.


RE: how to add Raspberry Pi GPIO integration to home assistant - iulik - 09-26-2023

I'm sorry to resume this topic, but if I don't want to use AUTOMATION from HA, what would be the code to turn on relay 1 with input 1 ??... for example.... Regards


RE: how to add Raspberry Pi GPIO integration to home assistant - admin - 09-26-2023

another way, you can install Node-Red software, link the INPUT with OUTPUT. at firstly you need install one software for CM4.