1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 14:43:51 +00:00

CAN bus: support bit mask for on_frame can_id (#3196)

This commit is contained in:
Felix Storm
2022-02-17 05:00:31 +01:00
committed by GitHub
parent c054fb8a2c
commit 38259c96c9
4 changed files with 58 additions and 9 deletions

View File

@@ -2551,6 +2551,25 @@ canbus:
lambda: "return x[0] == 0x11;"
then:
light.toggle: ${roomname}_lights
- can_id: 0b00000000000000000000001000000
can_id_mask: 0b11111000000000011111111000000
use_extended_id: true
then:
- lambda: |-
auto pdo_id = can_id >> 14;
switch (pdo_id)
{
case 117:
ESP_LOGD("canbus", "exhaust_fan_duty");
break;
case 118:
ESP_LOGD("canbus", "supply_fan_duty");
break;
case 119:
ESP_LOGD("canbus", "supply_fan_flow");
break;
// to be continued...
}
- platform: esp32_can
id: esp32_internal_can
rx_pin: GPIO04
@@ -2570,6 +2589,25 @@ canbus:
lambda: "return x[0] == 0x11;"
then:
light.toggle: ${roomname}_lights
- can_id: 0b00000000000000000000001000000
can_id_mask: 0b11111000000000011111111000000
use_extended_id: true
then:
- lambda: |-
auto pdo_id = can_id >> 14;
switch (pdo_id)
{
case 117:
ESP_LOGD("canbus", "exhaust_fan_duty");
break;
case 118:
ESP_LOGD("canbus", "supply_fan_duty");
break;
case 119:
ESP_LOGD("canbus", "supply_fan_flow");
break;
// to be continued...
}
teleinfo:
id: myteleinfo