Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A8s v2 inputs
#3
Hi, I tested with you code, still nothing.

What can I test?

Here is my code:

Code:
esphome:
  friendly_name : Green House
  name: "green-house"

esp32:
  board: esp32dev

# Enable logging
logger:

# Enable Home Assistant API

api:

ota:
 

web_server:
  port: 80
  auth:
    username: admin
    password: !secret web_server_password

modbus:
  id: modbus1
  uart_id: mod_bus

modbus_controller:
  - id: a8s
    address: 0x01
    modbus_id: modbus1
    setup_priority: -10
    update_interval: 5s

uart:
  id: mod_bus
  tx_pin: 33
  rx_pin: 32
  baud_rate: 9600
  stop_bits: 1
  parity: NONE

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0

sensor:

  - platform: modbus_controller
    modbus_controller_id: a8s
    name: "Box Temp"
    id: modbus_temp
    register_type: holding
    address: 0
    unit_of_measurement: "°C"
    value_type: S_WORD
    accuracy_decimals: 1
    filters:
      - lambda: return x / 10.0;

  - platform: modbus_controller
    modbus_controller_id: a8s
    name: "Box Hum"
    id: modbus_Hum
    register_type: holding
    address: 1
    unit_of_measurement: "%"
    value_type: S_WORD
    accuracy_decimals: 1
    filters:
      - lambda: return x / 10.0;

  - platform: dht
    pin: 14
    temperature:
      name: "Green House Temperature"
    humidity:
      name: "Green House Humidity"
    update_interval: 10s 
   

  #- platform: adc
  #  pin: 36
  #  name: "analog-1"
  #  update_interval: 10s
  #  attenuation: auto
  #  id: "analog1"

  #- platform: adc
  #  pin: 39
  #  name: "analog-2"
  #  update_interval: 10s
  #  attenuation: auto

  #- platform: adc
  #  pin: 34
  #  name: "analog-3"
  #  update_interval: 10s
  #  attenuation: auto

  #- platform: adc
  #  pin: 35
  #  name: "analog-4"
  #  update_interval: 10s
  #  attenuation: auto

i2c:
  sda: 4
  scl: 5
  scan: true
  id: bus_a

pcf8574:
- id: "pcf8574_hub_out_1" # for output channel 1-8
  address: 0x24

- id: "pcf8574_hub_in_1" # for input channel 9-16
  address: 0x22

# Individual outputs
switch:
- platform: gpio
  name: “(8) Pump”
  id: "relay_8"
  pin:
    pcf8574: pcf8574_hub_out_1
    number: 7
    mode: OUTPUT
    inverted: true

- platform: gpio
  name: “(7) Sud”
  id: "relay_7"
  pin:
    pcf8574: pcf8574_hub_out_1
    number: 6
    mode: OUTPUT
    inverted: true

- platform: gpio
  name: “(6) Z14 Zahon 2”
  id: "relay_6"
  interlock: &interlock_group [relay_1, relay_2, relay_3, relay_4, relay_5, relay_6]
  interlock_wait_time: 0.5s
  pin:
    pcf8574: pcf8574_hub_out_1
    number: 5
    mode: OUTPUT
    inverted: true

- platform: gpio
  name: “(5) Z13 Zahon 1”
  id: "relay_5"
  interlock: *interlock_group
  interlock_wait_time: 0.5s
  pin:
    pcf8574: pcf8574_hub_out_1
    number: 4
    mode: OUTPUT
    inverted: true

- platform: gpio
  name: “(4) Z12 Green House 2”
  id: "relay_4"
  interlock: *interlock_group
  interlock_wait_time: 0.5s
  pin:
    pcf8574: pcf8574_hub_out_1
    number: 3
    mode: OUTPUT
    inverted: true

- platform: gpio
  name: “(3) Z11 Green House 1”
  id: "relay_3"
  interlock: *interlock_group
  interlock_wait_time: 0.5s
  pin:
    pcf8574: pcf8574_hub_out_1
    number: 2
    mode: OUTPUT
    inverted: true

- platform: gpio
  name: “(2) Z10 od chodnika (T)”
  id: "relay_2"
  interlock: *interlock_group
  interlock_wait_time: 0.5s
  pin:
    pcf8574: pcf8574_hub_out_1
    number: 1
    mode: OUTPUT
    inverted: true

- platform: gpio
  name: “(1) Z9 od plota (T)”
  id: "relay_1"
  interlock: *interlock_group
  interlock_wait_time: 0.5s
  pin:
    pcf8574: pcf8574_hub_out_1
    number: 0
    mode: OUTPUT
    inverted: true

binary_sensor:

- platform: gpio
  name: “10%”
  id: "Input_1"
  pin:
    pcf8574: pcf8574_hub_in_1
    number: 0
    mode: INPUT
    inverted: true

- platform: gpio
  name: “25%”
  id: "Input_2"
  pin:
    pcf8574: pcf8574_hub_in_1
    number: 1
    mode: INPUT
    inverted: true

- platform: gpio
  name: “50%”
  id: "Input_3"
  pin:
    pcf8574: pcf8574_hub_in_1
    number: 2
    mode: INPUT
    inverted: true

- platform: gpio
  name: “75%”
  id: "Input_4"
  pin:
    pcf8574: pcf8574_hub_in_1
    number: 3
    mode: INPUT
    inverted: true

- platform: gpio
  name: “100%”
  id: "Input_5"
  pin:
    pcf8574: pcf8574_hub_in_1
    number: 4
    mode: INPUT
    inverted: true

- platform: gpio
  name: “input6”
  id: "Input_6"
  pin:
    pcf8574: pcf8574_hub_in_1
    number: 5
    mode: INPUT
    inverted: true

- platform: gpio
  name: “input7”
  id: "Input_7"
  pin:
    pcf8574: pcf8574_hub_in_1
    number: 6
    mode: INPUT
    inverted: true

- platform: gpio
  name: “input8”
  id: "Input_8"
  pin:
    pcf8574: pcf8574_hub_in_1
    number: 7
    mode: INPUT
    inverted: false

- platform: status
  id: ha_conected
  name: "Green House Status"
  on_state:
    then:
      - if:
          condition:
            binary_sensor.is_on: ha_conected
          then:
            - light.turn_on:
                id: RGB_LED
                red: 0
                green: 1
                blue: 0
      - light.turn_on:
            id: RGB_LED
            red: 1
            green: 0
            blue: 0
            flash_length: 1s


button:
  - platform: restart
    name: "Restart Green House"

  - platform: safe_mode
    name: "Restart Green House(Safe Mode)"

  - platform: template
    name: LED Red
    id: LED_R
    on_press:
    - light.turn_on:
        id: RGB_LED
        brightness: 100%
        red: 1
        green: 0
        blue: 0

  - platform: template
    name: LED Blue
    id: LED_B
    on_press:
    - light.turn_on:
        id: RGB_LED
        brightness: 100%
        red: 0
        green: 0
        blue: 1
  - platform: template
    name: LED Green
    id: LED_G
    on_press:
    - light.turn_on:
        id: RGB_LED
        brightness: 100%
        red: 0
        green: 1
        blue: 0
  - platform: template
    name: LED White
    id: LED_w
    on_press:
    - light.turn_on:
        id: RGB_LED
        brightness: 100%
        red: 1
        green: 1
        blue: 1

light:
  - platform: neopixelbus
    id: RGB_LED
    type: GRB
    variant: WS2811
    pin: 12
    num_leds: 1
    name: "NeoPixel Light"
    effects:
           - pulse:
              name: "Slow Pulse"
              update_interval: 2s
Reply


Messages In This Thread
A8s v2 inputs - by milan.net - 06-16-2024, 06:51 PM
RE: A8s v2 inputs - by admin - 06-16-2024, 10:30 PM
RE: A8s v2 inputs - by milan.net - 06-17-2024, 07:01 AM
RE: A8s v2 inputs - by admin - 06-17-2024, 10:23 AM
RE: A8s v2 inputs - by milan.net - 06-17-2024, 01:49 PM
RE: A8s v2 inputs - by admin - 06-17-2024, 10:32 PM
RE: A8s v2 inputs - by milan.net - 06-18-2024, 07:23 AM
RE: A8s v2 inputs - by admin - 06-18-2024, 08:50 AM
RE: A8s v2 inputs - by milan.net - 06-19-2024, 01:24 PM
RE: A8s v2 inputs - by admin - 06-20-2024, 12:43 AM

Forum Jump:


Users browsing this thread: