找回密码
 立即注册
搜索
查看: 140|回复: 3

[经验分享] 双路TDS傳感器改外部元件分享

[复制链接]

16

主题

453

回帖

3292

积分

论坛元老

积分
3292
金钱
2823
HASS币
0
发表于 前天 04:47 | 显示全部楼层 |阅读模式
本帖最后由 george65 于 2025-6-29 23:25 编辑

本來是用版上這位大哥的代碼  
https://bbs.hassbian.com/thread-23740-1-1.html
後來esphome改版後一直無法更新  
跟ChatGPT奮戰10幾次失敗
每次都是剛有苗頭就到達使用上限
然後就開始亂回答越用越糟
好在這次終於在到達使用上限前完成  


分享給需要的版友使用
檔案解壓縮後放到 /config/esphome/
uart:
  - id: uart_bus1
    tx_pin: 1
    rx_pin: 3
    baud_rate: 9600

# 外部元件
external_components:
  - source:
      type: local
      path: ./external_components
    components: [tds_uart]

# 使用從外部元件加載的感測器    
sensor:
  - platform: tds_uart
    uart_id: uart_bus1
    id: tds_uart_component
    tds1:
      name: TDS1
      icon: mdi:water-pump
      unit_of_measurement: ppm
      accuracy_decimals: 0
    temperature1:
      name: Temperature1
      icon: mdi:thermometer-water
      unit_of_measurement: °C
      accuracy_decimals: 1
    tds2:
      name: TDS2
      icon: mdi:air-filter
      unit_of_measurement: ppm
      accuracy_decimals: 0
    temperature2:
      name: Temperature2
      icon: mdi:thermometer-water
      unit_of_measurement: °C"
      accuracy_decimals: 1

# 感測器更新時間
time:
  - platform: homeassistant
    id: ha_time
    on_time:
      - seconds: /10
        then:
          - uart.write: [0x55, 0x07, 0x05, 0x01, 0x00, 0x00, 0x00, 0x62]
          - delay: 500ms
          - uart.write: [0x55, 0x07, 0x05, 0x02, 0x00, 0x00, 0x00, 0x63]




external_components.rar (1.68 KB, 下载次数: 3)

评分

参与人数 2金钱 +28 收起 理由
DDDear + 12 感谢楼主分享!
sorrypqa + 16 大神666!

查看全部评分

回复

使用道具 举报

75

主题

546

回帖

3616

积分

论坛元老

积分
3616
金钱
2995
HASS币
0
发表于 前天 11:42 | 显示全部楼层
感谢,等很久。不过一上传文件自己重启。应该是我的系统问题。
回复

使用道具 举报

75

主题

546

回帖

3616

积分

论坛元老

积分
3616
金钱
2995
HASS币
0
发表于 前天 12:13 | 显示全部楼层
正常使用,感谢分享。
回复

使用道具 举报

58

主题

1451

回帖

6833

积分

论坛DIY达人

积分
6833
金钱
5324
HASS币
40
发表于 前天 12:23 | 显示全部楼层
没玩过这DTS这玩意,先收藏备用,谢谢大佬分享!
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )

GMT+8, 2025-7-1 13:28 , Processed in 0.081644 second(s), 8 queries , MemCached On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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