『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
123
返回列表 发新帖
楼主: 924215947

[技术探讨] 怎么利用编码器和ESPHOME制作一个led调光并输出设备

[复制链接]

6

主题

292

帖子

2087

积分

金牌会员

Rank: 6Rank: 6

积分
2087
金钱
1795
HASS币
0
QQ
 楼主| 发表于 2020-7-6 14:20:15 | 显示全部楼层
bjy2005 发表于 2020-7-3 21:10
我还在试验。。 现在可以实现编码旋转、单击和双击EC11带的开关。。。    按压同时调整编码 还是搞不定。 ...

编码器是可以  只能先开 然后在调编码器    但是如果编码器先调呢   灯光会不会亮
回复

使用道具 举报

7

主题

367

帖子

2083

积分

金牌会员

Rank: 6Rank: 6

积分
2083
金钱
1716
HASS币
0
发表于 2020-7-6 22:15:11 | 显示全部楼层
924215947 发表于 2020-7-6 14:20
编码器是可以  只能先开 然后在调编码器    但是如果编码器先调呢   灯光会不会亮 ...

用esphome 实现可能费点劲。。。
回复

使用道具 举报

6

主题

292

帖子

2087

积分

金牌会员

Rank: 6Rank: 6

积分
2087
金钱
1795
HASS币
0
QQ
 楼主| 发表于 2020-7-8 20:57:04 | 显示全部楼层
bjy2005 发表于 2020-7-6 22:15
用esphome 实现可能费点劲。。。

所以就要考虑下 这个要怎么设置这个
回复

使用道具 举报

17

主题

178

帖子

1474

积分

金牌会员

Rank: 6Rank: 6

积分
1474
金钱
1296
HASS币
0
发表于 2021-10-15 13:09:39 | 显示全部楼层
bjy2005 发表于 2020-6-27 15:41
已经可以初步实现调光了,用的EC11编码器5点的  编码器A B分别接10K上拉到5V ,同时通过1nf电容到GND(看论 ...

你好,请问有接线图吗
回复

使用道具 举报

2

主题

182

帖子

3064

积分

论坛元老

Rank: 8Rank: 8

积分
3064
金钱
2882
HASS币
0
发表于 2021-12-30 19:05:23 | 显示全部楼层
substitutions:
  devicename: taiden_esp32c3_c0ab60

esphome:
  name: ${devicename}
  platform: ESP32
  board: esp32-c3-devkitm-1
  platformio_options:
    platform: https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
    platform_packages:
      - framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#2.0.0
    board_build.variant: esp32c3
    board_build.f_cpu: 160000000L
    board_build.f_flash: 40000000L
    upload_protocol: esptool
    board_build.flash_mode: dio


wifi: {ssid: "cc",password: "xxxxxxxxxxx",fast_connect: true}
api: {password: "xxxxxxxxxxx",reboot_timeout: 0s}
ota: {password: "xxxxxxxxxxx"}
web_server: {port: 80}
logger:





output:
  - platform: ledc
    pin: GPIO5
    id: pwm
    inverted: False

light:
  - platform: monochromatic
    name: ${devicename}_light1
    output: pwm
    default_transition_length: 0s
    id: light_1




binary_sensor:
  - platform: gpio
    internal: true
    id: button_1
    pin: {number: "GPIO20", inverted: true, mode: "INPUT_PULLUP"}
    on_press: {light.toggle: light_1}

sensor:
  - platform: rotary_encoder
    id: my_rotary_encoder
    pin_a: GPIO19
    pin_b: GPIO18
    on_clockwise:
        then:
          - if:
              condition:
                lambda: 'return id(light_1).current_values.get_brightness() > 0.85;'
              then:
                - light.turn_on:
                    id: light_1
                    brightness: 85%
              else:
                - light.dim_relative:
                    id: light_1
                    relative_brightness: 5%  #增加5%
                    transition_length: 0.1s
                - delay: 0.1s
    on_anticlockwise:
        then:
          - if:
              condition:
                lambda: 'return id(light_1).current_values.get_brightness() < 0.35;'
              then:
                - light.turn_off:
                    id: light_1
              else:

                - light.dim_relative:
                    id: light_1
                    relative_brightness: -5%  #减少5%
                    transition_length: 0.1s
                - delay: 0.1s


























回复

使用道具 举报

6

主题

292

帖子

2087

积分

金牌会员

Rank: 6Rank: 6

积分
2087
金钱
1795
HASS币
0
QQ
 楼主| 发表于 2021-12-30 19:46:24 | 显示全部楼层

感谢谢谢  等等去试试
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-29 17:58 , Processed in 0.454670 second(s), 26 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表