在我的家中,我有一个叫做漂亮的设备克贡龙通过蓝牙LE广告信标监控两个小桶的流量并报告数据。Kegtron的团队最近在这里记录了完整的BLE消息传递格式:

gen1beresageformat.pdf(kegtron.com)

I would really like to get this data into Home Assistant, and it seems like all the base ingredients to build a simple integration are there, but my (already limited) coding skills have greatly atrophied over the years and I’ve not attempted to write a HA integration before, so I’m hoping some kind soul will take pity on me and offer some help or advice on my quest.

在我的RPI4 /哈索斯的安装上,我可以在运行时看到Kegtron BLE广告数据广播bluetoothctl从命令行和启用扫描。

查看蓝牙LE跟踪器的代码,看起来扫描类似的BLE消息,我无需连接到设备或询问UUID属性,因为所有数据都在被动扫描中呈现。但是,现有的BLE Tracker集成不是一个完美的模板,因为它似乎没有从设备中消耗广告数据包,因此我需要弄清楚。快速看看PyGatt库意味着扫描只是用于找到设备,而不是倾听广告广播,但我可能会丢失那里的东西。

如果有人有任何建议,或者想要乘坐骑行,请告诉我。谢谢!

我刚刚订购了Kegtron v1我的目标之一是让它进入HA。我在想,这可能是可行的BLEtoMQTT选项之一。需要得到它并试一试。有任何进展告诉我。

看起来这个可以支持kegtron。需要做更多的研究:被动BLE监视集成

我认为这只是添加到自定义组件:被动ble monitor.

它通过HACS安装

是的,我最近向Kegtron添加了支持的支持。一句话,您将必须启用active_scan.从钥匙器设备获取数据。

在无源BLE监视器组件中对Kegtron v1的支持是非常棒的。再次感谢@ernst.为支持。

图像

嗨Millercentral。

这是你为keg制作的好卡。你介意分享你创造的方式吗?

我可以找到端口名称,小桶类型,小桶尺寸和分配的升,但您是如何找到饮料的饮料,剩下的饮料?我假设你计算百吉百分比留下,或者你以克贡的一些聪明的方式阅读这一点吗?

这就是我所看到的:

图像

是的,您必须从起始卷和卷分配的卷计算它。我在configuration.yaml中制作了几个模板传感器来跟踪:

# Kegtron模板传感器kegerator_right_tap_name: friendly_name: "Kegerator Right Tap Name" value_template: "{{state_attr('sensor. state_attr ') . "kegerator_right_tap_volume_dispensed', '端口名称')}}" kegerator_right_tap_keg_type: friendly_name: "Kegerator Right Tap Keg Type" value_template: "{{state_attr('sensor. Keg ');kegerator_right_tap_volume_dispensed,桶的大小)}}“kegerator_right_tap_drinks_served: friendly_name:“星球大战正确利用饮料服务“value_template:“{{(州(sensor.kegerator_right_tap_volume_dispensed) |浮动/ 0.473)| |一轮int}}“icon_template: mdi: glass-mug-variant kegerator_right_tap_drinks_remaining: friendly_name:"Kegerator Right Tap Drinks Remaining" value_template: "{{((state_attr('sensor. "))kegerator_right_tap_volume_dispensed”、“卷”)开始|浮动——州(sensor.kegerator_right_tap_volume_dispensed) |浮动)/ 0.473)| |一轮int}}“icon_template: mdi: glass-mug-variant kegerator_right_tap_keg_remaining_percent: friendly_name:“星球大战正确的利用剩余百分比”value_template : "{{ ( ( ( state_attr(“传感器。Kegerator_right_tap_volume_dispensed ', 'volume start') | float - states('sensor. Kegerator_right_tap_volume_dispensed ') | float) / state_attr('sensor. Kegerator_right_tap_volume_dispensed ')Kegerator_right_tap_volume_dispensed ', 'volume start') | float) * 100) | round(1)}}" unit_of_measurement: "%"

我还制作了模板传感器,以便更容易地显示传感器的其他属性。

请注意,我只是假设饮料始终是美国品脱(0.473升),因为我用例工作。更强大的解决方案可能是使用ainput_select.实体允许您选择要跟踪的服务大小的内容。

与此集成的其他酷炫的事情:当剩余10%以下时,我发出警报,因为它已经清除了超过2个月(这也是手动跟踪的)。我也将在卷分配的传感器恢复为零时添加“龙头”传感器中的“龙头”传感器。

我真的很想做的是将此与Untappd API集成,以显示符合折叠桶的utapd啤酒卡。Getting the data from untappd is pretty easy using the REST integration (and you could store the untappd beerid in the kegtron “beer name” field using the kegtron app), but I don’t have the lovelace custom-card skills to recreate this info card in lovelace:


......但希望我最终会弄明白。

1就像