English
English
简体中文
日本語

Unit Joystick2 ESPHome Component

This page describes the I2C joystick component for Unit Joystick2 in ESPHome. It provides X/Y-axis values, Z-axis button status, and onboard RGB lighting control.

1. Component Overview

Item Information
Product name Unit Joystick2
SKU U024-V2
Main functions X/Y-axis joystick input, Z-axis button, and RGB lighting control
Communication interface I2C
Default I2C address x63
ESPHome component i2c_joystick_2 (external component)
ESPHome version requirement /

2. Component Details

Include the External Component

external_components:
  - source: github://m5stack/esphome-yaml/components
    components: [i2c_joystick_2]
    refresh: 0s

i2c_joystick_2:
  - id: joystick2
    i2c_id: i2c_bus
    address: 0x63

Sensor: Joystick Axes

Use the i2c_joystick_2 Sensor platform for the X and Y axes. xis accepts x or y; mode accepts dc_16bit, dc_8bit, offset_12bit, or offset_8bit.

sensor:
  - platform: i2c_joystick_2
    id: joystick2_x
    i2c_joystick_2_id: joystick2
    name: "Joystick2 X"
    axis: x
    mode: offset_12bit
    update_interval: 100ms

  - platform: i2c_joystick_2
    id: joystick2_y
    i2c_joystick_2_id: joystick2
    name: "Joystick2 Y"
    axis: y
    mode: offset_12bit
    update_interval: 100ms

Binary Sensor: Button

Use the i2c_joystick_2 Binary Sensor platform for the Z-axis button.

binary_sensor:
  - platform: i2c_joystick_2
    id: joystick2_button
    i2c_joystick_2_id: joystick2
    name: "Joystick2 Button"

Light: RGB Lighting

Combine three i2c_joystick_2 Output channels into an RGB light entity. The channel values are CHANNEL_R, CHANNEL_G, and CHANNEL_B.

output:
  - platform: i2c_joystick_2
    id: joystick2_red
    i2c_joystick_2_id: joystick2
    channel: CHANNEL_R
  - platform: i2c_joystick_2
    id: joystick2_green
    i2c_joystick_2_id: joystick2
    channel: CHANNEL_G
  - platform: i2c_joystick_2
    id: joystick2_blue
    i2c_joystick_2_id: joystick2
    channel: CHANNEL_B

light:
  - platform: rgb
    name: "Joystick2 Light"
    red: joystick2_red
    green: joystick2_green
    blue: joystick2_blue

3. Reference Example

Page Tools
PDF
On This Page