Setting binary light status

We have old home automation system in our house. It is using CAN bus.
I can read bus, and set light states as binary sensors.

like this:

binary_sensor:
  - platform: template
    name: "Työhuone led"
    id: tyohuone_led

Then i have this in lambda for canbus:

if(x[0]==0x06 and x[1]==0x31 and x[2]==0x61) {
  id(tyohuone_led).publish_state(x[3]);
}

This works fine, and HA sees light state.

I would like to use binary_light and not binary sensor, so i could also control lights from home assistant.
How can i set only state of light change in esphome without triggering any actions (when light state is physically changed)? Only when HA is changing state should esphome send light on/off state change to CAN bus to actually turn light on/off.

Something like this to turn light on

on_...:
  - canbus.send:
      data: [ 0x06, 0x30, 0x61, 0x01 ]
      can_id: 0x18efff21

You could also redefine the binary as a light.

Define a template output with the lambda you already have Template Output — ESPHome

Set up a binary light linked to that output Binary Light — ESPHome

I am new to this, and really do not know what i should change. I have done simple temperature etc sensor before, but this is my first bigger project.

This is my code, and it works as it should. I can see states of lights, motion sensors and temperatures in home assistant just fine.

What should i change to control lights from HA?

When physical light switch is pushed input module sends to can bus (tyohuone_led)
0x06 0x30 0x61 0x01 for light on
0x06 0x30 0x61 0x00 for light off

Then output module turns light on/off and responds to can bus (tyohuone_led)
0x06 0x31 0x61 0x01 for light on
0x06 0x31 0x61 0x00 for light off

I now monitor can bus for output module responses and change binary sensor.

What should i change to use light entity instead binary sensor?
Light state should be changed same as in now. When HA changes state, should esphome send input module on/off command to can bus.
If physical button is pressed, and output module sends response, light state should be changed, but nothing should be send to can bus (light is already controlled by output module of automation system).

esphome:
  name: talomat
  friendly_name: Talomat

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
  logs:
    component: ERROR
    canbus: ERROR

# Enable Home Assistant API
api:
  encryption:
    key: "keykeykey"

ota:
  password: "passwordpassword"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Talomat Fallback Hotspot"
    password: "passwordpassword"

web_server:
 port: 80

captive_portal:

sensor:
  - platform: template
    name: "Ulkolämpötila"
    id: temp_ulko
    device_class: "temperature"
    state_class: "measurement"
    accuracy_decimals: 0
  - platform: template
    name: "Sisälämpötila"
    id: temp_sisa
    device_class: "temperature"
    state_class: "measurement"
    accuracy_decimals: 0
  - platform: template
    name: "Ulko valoisuus raw"
    id: valo_ulko_raw
    state_class: "measurement"
    accuracy_decimals: 1
    filters:
      - throttle_average: 30s
      - filter_out: nan


binary_sensor:
  - platform: template
    name: "Työhuone led"
    id: tyohuone_led
  - platform: template
    name: "Työhuone kansi"
    id: tyohuone_kansi
  - platform: template
    name: "MH Anton led"
    id: antonhuone_led
  - platform: template
    name: "MH Anton kansi"
    id: antonhuone_kansi
  - platform: template
    name: "MH Joonas led"
    id: joonashuone_led
  - platform: template
    name: "MH Joonas kansi"
    id: joonashuone_kansi
  - platform: template
    name: "Porras kansi"
    id: porras_kansi
  - platform: template
    name: "Yläaula led"
    id: ylaaula_led
  - platform: template
    name: "Yläkerta vessa led"
    id: ylavessa_led
  - platform: template
    name: "Vaatehuone led"
    id: vaatehuone_led
  - platform: template
    name: "Alakerta vessa led"
    id: alavessa_led
  - platform: template
    name: "Sauna kansi"
    id: sauna_kansi
  - platform: template
    name: "Sauna led"
    id: sauna_led
  - platform: template
    name: "Kylpyhuone led"
    id: kylpyhuone_led
  - platform: template
    name: "Kodinhoitohuone led"
    id: kodinhoitohuone_led
  - platform: template
    name: "Liiketunnistin yläkerta"
    id: liiketunnistin_ylakerta
    filters:
      - delayed_off: 10s
  - platform: template
    name: "Liiketunnistin eteinen"
    id: liiketunnistin_eteinen
    filters:
      - delayed_off: 10s
  - platform: template
    name: "Liiketunnistin kodinhoitohuone"
    id: liiketunnistin_kodinhoitohuone
    filters:
      - delayed_off: 10s  
  - platform: template
    name: "Liiketunnistin etuterassi"
    id: liiketunnistin_etuterassi
    filters:
      - delayed_off: 10s
  - platform: template
    name: "Liiketunnistin autokatos"
    id: liiketunnistin_autokatos
    filters:
      - delayed_off: 10s
  - platform: template
    name: "Liiketunnistin takaterassi"
    id: liiketunnistin_takaterassi
    filters:
      - delayed_off: 10s
  - platform: template
    name: "MH Pää kansi"
    id: makuuhuone_kansi
  - platform: template
    name: "MH Pää led"
    id: makuuhuone_led
  - platform: template
    name: "Keittiö kansi"
    id: keittio_kansi
  - platform: template
    name: "Keittiö led"
    id: keittio_led
  - platform: template
    name: "Keittiö allas led"
    id: keittioallas_led
  - platform: template
    name: "Keittiö uuni led"
    id: keittiouuni_led
  - platform: template
    name: "Keittiö porras led"
    id: keittioporras_led
  - platform: template
    name: "Kodinhoitohuone allas led"
    id: kodinhoitohuone_allas_led
  - platform: template
    name: "Etuterassi seinä"
    id: etuterassi_seina
  - platform: template
    name: "Etuterassi led"
    id: etuterassi_led
  - platform: template
    name: "Autokatos seinä"
    id: autokatos_seina
  - platform: template
    name: "Autokatos led"
    id: autokatos_led
  - platform: template
    name: "Etupiha pylväs"
    id: etupiha_pylvas
  - platform: template
    name: "Tekninen tila kansi"
    id: tekninen_kansi
  - platform: template
    name: "Sisävarasto kansi"
    id: sisavarasto_kansi

  - platform: template
    name: "Olohuone takaoikea led"
    id: ohtakaoikea_led
  - platform: template
    name: "Olohuone takavasen led"
    id: ohtakavasen_led
  - platform: template
    name: "Olohuone takka led"
    id: ohtakka_led
  - platform: template
    name: "Eteinen WC led"
    id: eteinenwc_led
  - platform: template
    name: "Eteinen vaatekaappi led"
    id: eteinenvaatekaappi_led
  - platform: template
    name: "Eteinen led"
    id: eteinen_led
  - platform: template
    name: "Olohuone etu led"
    id: ohetu_led
  - platform: template
    name: "Takaterassi led"
    id: takaterassi_led
  - platform: template
    name: "Takaterassi seinä"
    id: takaterassi_seina
  - platform: template
    name: "Takapiha pylväs"
    id: takapiha_pylvas
  - platform: template
    name: "Eteinen seinä"
    id: eteinen_seina
  - platform: template
    name: "Parveke led"
    id: parveke_led
  - platform: template
    name: "Parveke Seinä"
    id: parveke_seina



canbus:
  - platform: esp32_can
    tx_pin: GPIO27
    rx_pin: GPIO26
    can_id: 100       # can id for transmitting frames
    bit_rate: 125kbps # talomat rate
    on_frame:
    - can_id: 0  # listen to all messages
      can_id_mask: 0
      use_extended_id: True
      then:
      - lambda: |-
          bool tunnistettu = false;
          int muunnos_temp;
          bool debug_on = false;

          // Ulkolämpötila
          if(x[0]==0x06 and x[1]==0x09 and x[2]==0x31) {
            if(x[3]>127) {
              muunnos_temp = x[3] - 256;
            }
            else {
              muunnos_temp = x[3];
            }
            id(temp_ulko).publish_state(muunnos_temp);
            tunnistettu = true;
          }

          // Sisälämpötila
          if(x[0]==0x06 and x[1]==0x08 and x[2]==0x31) {
            if(x[3]>127) {
              muunnos_temp = x[3] - 256;
            }
            else {
              muunnos_temp = x[3];
            }
            id(temp_sisa).publish_state(muunnos_temp);
            tunnistettu = true;
          }
          if(x[0]==0x06 and x[1]==0x32 and x[2]==0x27) {
            id(valo_ulko_raw).publish_state(x[3]);
            tunnistettu = true;
          }


          // Liiketunnistin yläkerta
          if(x[0]==0x06 and x[1]==0x97 and x[2]==0x20) {
            id(liiketunnistin_ylakerta).publish_state(x[3]);
            tunnistettu = true;
          }

          // Liiketunnistin kodinhoitohuone
          if(x[0]==0x06 and x[1]==0x94 and x[2]==0x20) {
            id(liiketunnistin_kodinhoitohuone).publish_state(x[3]);
            tunnistettu = true;
          }

          // Liiketunnistin eteinen
          if(x[0]==0x06 and x[1]==0x93 and x[2]==0x20) {
            id(liiketunnistin_eteinen).publish_state(x[3]);
            tunnistettu = true;
          }

          // Liiketunnistin etuterassi
          if(x[0]==0x06 and x[1]==0x91 and x[2]==0x20) {
            id(liiketunnistin_etuterassi).publish_state(x[3]);
            tunnistettu = true;
          }

          // Liiketunnistin autokatos
          if(x[0]==0x06 and x[1]==0x95 and x[2]==0x20) {
            id(liiketunnistin_autokatos).publish_state(x[3]);
            tunnistettu = true;
          }

          // Liiketunnistin takaterassi
          if(x[0]==0x06 and x[1]==0x92 and x[2]==0x20) {
            id(liiketunnistin_takaterassi).publish_state(x[3]);
            tunnistettu = true;
          }


          if(x[0]==0x06 and x[1]==0x30 and x[2]==0x61) tunnistettu = true; // Työhuone katto LED
          if(x[0]==0x06 and x[1]==0x31 and x[2]==0x61) {
            id(tyohuone_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x90 and x[2]==0x61) tunnistettu = true; // Työhuone katto Kansi
          if(x[0]==0x06 and x[1]==0x91 and x[2]==0x61) {
            id(tyohuone_kansi).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x00 and x[2]==0x64) tunnistettu = true; // Antonin huone katto Led
          if(x[0]==0x06 and x[1]==0x01 and x[2]==0x64) {
            id(antonhuone_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x30 and x[2]==0x64) tunnistettu = true; // Antonin huone katto Kansi
          if(x[0]==0x06 and x[1]==0x31 and x[2]==0x64) {
            id(antonhuone_kansi).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x80 and x[2]==0x64) tunnistettu = true; // Joonaksen huone katto Led
          if(x[0]==0x06 and x[1]==0x81 and x[2]==0x64) {
            id(joonashuone_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x50 and x[2]==0x64) tunnistettu = true; // Joonaksen huone katto Kansi
          if(x[0]==0x06 and x[1]==0x51 and x[2]==0x64) {
            id(joonashuone_kansi).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x80 and x[2]==0x62) tunnistettu = true; // Porras katto Kansi
          if(x[0]==0x06 and x[1]==0x81 and x[2]==0x62) {
            id(porras_kansi).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x50 and x[2]==0x62) tunnistettu = true; // Yläaula katto Led
          if(x[0]==0x06 and x[1]==0x51 and x[2]==0x62) {
            id(ylaaula_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0xa0 and x[2]==0x62) tunnistettu = true; // Yläkerta WC katto Led
          if(x[0]==0x06 and x[1]==0xa1 and x[2]==0x62) {
            id(ylavessa_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0xb0 and x[2]==0x63) tunnistettu = true; // Vaatehuone katto Led
          if(x[0]==0x06 and x[1]==0xb1 and x[2]==0x63) {
            id(vaatehuone_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x10 and x[2]==0x61) tunnistettu = true; // Alakerta Wc katto Led
          if(x[0]==0x06 and x[1]==0x11 and x[2]==0x61) {
            id(alavessa_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0xd0 and x[2]==0x64) tunnistettu = true; // Sauna seinä Kansi
          if(x[0]==0x06 and x[1]==0xd1 and x[2]==0x64) {
            id(sauna_kansi).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0xe0 and x[2]==0x64) tunnistettu = true; // Sauna katto Kuitu
          if(x[0]==0x06 and x[1]==0xe1 and x[2]==0x64) {
            id(sauna_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x60 and x[2]==0x60) tunnistettu = true; // Kylpyhuone katto LED
          if(x[0]==0x06 and x[1]==0x61 and x[2]==0x60) {
            id(kylpyhuone_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x40 and x[2]==0x60) tunnistettu = true; // Kodinhoitohuone katto Led
          if(x[0]==0x06 and x[1]==0x41 and x[2]==0x60) {
            id(kodinhoitohuone_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x10 and x[2]==0x64) tunnistettu = true; // Makuuhuone katto Kansi
          if(x[0]==0x06 and x[1]==0x11 and x[2]==0x64) {
            id(makuuhuone_kansi).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x50 and x[2]==0x63) tunnistettu = true; // Makuuhuone katto Led
          if(x[0]==0x06 and x[1]==0x51 and x[2]==0x63) {
            id(makuuhuone_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x30 and x[2]==0x20) tunnistettu = true; // Keittiö katto Kansi
          if(x[0]==0x06 and x[1]==0x31 and x[2]==0x20) {
            id(keittio_kansi).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x10 and x[2]==0x60) tunnistettu = true; // Keittiö katto Led
          if(x[0]==0x06 and x[1]==0x11 and x[2]==0x60) {
            id(keittio_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x80 and x[2]==0x61) tunnistettu = true; // Keittiö taso Lednauha
          if(x[0]==0x06 and x[1]==0x81 and x[2]==0x61) {
            id(keittioallas_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x70 and x[2]==0x61) tunnistettu = true; // Keittiö uuni Lednauha
          if(x[0]==0x06 and x[1]==0x71 and x[2]==0x61) {
            id(keittiouuni_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x90 and x[2]==0x60) tunnistettu = true; // Keittiö porrasaula katto Led
          if(x[0]==0x06 and x[1]==0x91 and x[2]==0x60) {
            id(keittioporras_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x60 and x[2]==0x62) tunnistettu = true; // Kodinhoitohuone allas Lednauha
          if(x[0]==0x06 and x[1]==0x61 and x[2]==0x62) {
            id(kodinhoitohuone_allas_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0xb0 and x[2]==0x62) tunnistettu = true; // Etuterassi seinä Kansi
          if(x[0]==0x06 and x[1]==0xb1 and x[2]==0x62) {
            id(etuterassi_seina).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x10 and x[2]==0x63) tunnistettu = true; // Etuterassi katto Led
          if(x[0]==0x06 and x[1]==0x11 and x[2]==0x63) {
            id(etuterassi_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x20 and x[2]==0x63) tunnistettu = true; // Autokatos seinä Kansi
          if(x[0]==0x06 and x[1]==0x21 and x[2]==0x63) {
            id(autokatos_seina).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x30 and x[2]==0x63) tunnistettu = true; // Autokatos katto Led
          if(x[0]==0x06 and x[1]==0x31 and x[2]==0x63) {
            id(autokatos_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0xd0 and x[2]==0x62) tunnistettu = true; // Etupiha Pylväs
          if(x[0]==0x06 and x[1]==0xd1 and x[2]==0x62) {
            id(etupiha_pylvas).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x70 and x[2]==0x65) tunnistettu = true; // Tekninen tila katto Kansi
          if(x[0]==0x06 and x[1]==0x71 and x[2]==0x65) {
            id(tekninen_kansi).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x10 and x[2]==0x65) tunnistettu = true; // Sisävarasto katto Kansi
          if(x[0]==0x06 and x[1]==0x11 and x[2]==0x65) {
            id(sisavarasto_kansi).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x30 and x[2]==0x62) tunnistettu = true; // Olohuone taka oikea katto Led
          if(x[0]==0x06 and x[1]==0x31 and x[2]==0x62) {
            id(ohtakaoikea_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x20 and x[2]==0x62) tunnistettu = true; // Olohuone taka vasen katto Led
          if(x[0]==0x06 and x[1]==0x21 and x[2]==0x62) {
            id(ohtakavasen_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x60 and x[2]==0x61) tunnistettu = true; // Olohuone takka katto Led
          if(x[0]==0x06 and x[1]==0x61 and x[2]==0x61) {
            id(ohtakka_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x30 and x[2]==0x60) tunnistettu = true; // Eteinen WC edusta katto Led
          if(x[0]==0x06 and x[1]==0x31 and x[2]==0x60) {
            id(eteinenwc_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x40 and x[2]==0x62) tunnistettu = true; // Eteinen vaatekaappi Lednauha
          if(x[0]==0x06 and x[1]==0x41 and x[2]==0x62) {
            id(eteinenvaatekaappi_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x50 and x[2]==0x60) tunnistettu = true; // Eteinen katto Led
          if(x[0]==0x06 and x[1]==0x51 and x[2]==0x60) {
            id(eteinen_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x20 and x[2]==0x60) tunnistettu = true; // Olohuone etu katto Led
          if(x[0]==0x06 and x[1]==0x21 and x[2]==0x60) {
            id(ohetu_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x00 and x[2]==0x63) tunnistettu = true; // Takaterassi katto Led
          if(x[0]==0x06 and x[1]==0x01 and x[2]==0x63) {
            id(takaterassi_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0xf0 and x[2]==0x62) tunnistettu = true; // Takaterassi seinä Kansi
          if(x[0]==0x06 and x[1]==0xf1 and x[2]==0x62) {
            id(takaterassi_seina).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0xe0 and x[2]==0x62) tunnistettu = true; // Takapiha Pylväs
          if(x[0]==0x06 and x[1]==0xe1 and x[2]==0x62) {
            id(takapiha_pylvas).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x90 and x[2]==0x62) tunnistettu = true; // Eteinen seinä Kansi
          if(x[0]==0x06 and x[1]==0x91 and x[2]==0x62) {
            id(eteinen_seina).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x60 and x[2]==0x65) tunnistettu = true; // Parveke katto Led
          if(x[0]==0x06 and x[1]==0x61 and x[2]==0x65) {
            id(parveke_led).publish_state(x[3]);
            tunnistettu = true;
          }

          if(x[0]==0x06 and x[1]==0x50 and x[2]==0x65) tunnistettu = true; // Parveke seinä Kansi
          if(x[0]==0x06 and x[1]==0x51 and x[2]==0x65) {
            id(parveke_seina).publish_state(x[3]);
            tunnistettu = true;
          }




          // DEBUG
          if (x[0] != 15 and x[0] != 10 and tunnistettu == false) {
            ESP_LOGD("can_id", "CAN ID %x : %x             : 0b%i%i%i%i %i%i%i%i 0b%i%i%i%i %i%i%i%i 0b%i%i%i%i %i%i%i%i 0b%i%i%i%i %i%i%i%i               Hex %02x %02x %02x %02x     Dec %3i %3i %3i %3i", can_id,  remote_transmission_request,
            (x[0] >> 7) &1, (x[0] >> 6) &1, (x[0] >> 5) &1, (x[0] >> 4) &1, (x[0] >> 3) &1, (x[0] >> 2) &1, (x[0] >> 1) &1, (x[0] >> 0) &1,
            (x[1] >> 7) &1, (x[1] >> 6) &1, (x[1] >> 5) &1, (x[1] >> 4) &1, (x[1] >> 3) &1, (x[1] >> 2) &1, (x[1] >> 1) &1, (x[1] >> 0) &1,
            (x[2] >> 7) &1, (x[2] >> 6) &1, (x[2] >> 5) &1, (x[2] >> 4) &1, (x[2] >> 3) &1, (x[2] >> 2) &1, (x[2] >> 1) &1, (x[2] >> 0) &1,
            (x[3] >> 7) &1, (x[3] >> 6) &1, (x[3] >> 5) &1, (x[3] >> 4) &1, (x[3] >> 3) &1, (x[3] >> 2) &1, (x[3] >> 1) &1, (x[3] >> 0) &1,
            x[0], x[1], x[2], x[3], x[0], x[1], x[2], x[3]);
          }
          if (x[0] != 15 and x[0] != 10 and tunnistettu == true and debug_on == true) {
            ESP_LOGD("can_id", "CAN ID %x : %x tunnistettu : 0b%i%i%i%i %i%i%i%i 0b%i%i%i%i %i%i%i%i 0b%i%i%i%i %i%i%i%i 0b%i%i%i%i %i%i%i%i               Hex %02x %02x %02x %02x     Dec %3i %3i %3i %3i", can_id,  remote_transmission_request,
            (x[0] >> 7) &1, (x[0] >> 6) &1, (x[0] >> 5) &1, (x[0] >> 4) &1, (x[0] >> 3) &1, (x[0] >> 2) &1, (x[0] >> 1) &1, (x[0] >> 0) &1,
            (x[1] >> 7) &1, (x[1] >> 6) &1, (x[1] >> 5) &1, (x[1] >> 4) &1, (x[1] >> 3) &1, (x[1] >> 2) &1, (x[1] >> 1) &1, (x[1] >> 0) &1,
            (x[2] >> 7) &1, (x[2] >> 6) &1, (x[2] >> 5) &1, (x[2] >> 4) &1, (x[2] >> 3) &1, (x[2] >> 2) &1, (x[2] >> 1) &1, (x[2] >> 0) &1,
            (x[3] >> 7) &1, (x[3] >> 6) &1, (x[3] >> 5) &1, (x[3] >> 4) &1, (x[3] >> 3) &1, (x[3] >> 2) &1, (x[3] >> 1) &1, (x[3] >> 0) &1,
            x[0], x[1], x[2], x[3], x[0], x[1], x[2], x[3]);
          }
           if (x[0] == 10 and tunnistettu == false) {
            ESP_LOGD("can_id", "CAN ID %x : %x             : 0b%i%i%i%i %i%i%i%i 0b%i%i%i%i %i%i%i%i 0b%i%i%i%i %i%i%i%i 0b%i%i%i%i %i%i%i%i 0b%i%i%i%i %i%i%i%i   Hex %02x %02x %02x %02x %02x  Dec %3i %3i %3i %3i %3i", can_id,  remote_transmission_request,
            (x[0] >> 7) &1, (x[0] >> 6) &1, (x[0] >> 5) &1, (x[0] >> 4) &1, (x[0] >> 3) &1, (x[0] >> 2) &1, (x[0] >> 1) &1, (x[0] >> 0) &1,
            (x[1] >> 7) &1, (x[1] >> 6) &1, (x[1] >> 5) &1, (x[1] >> 4) &1, (x[1] >> 3) &1, (x[1] >> 2) &1, (x[1] >> 1) &1, (x[1] >> 0) &1,
            (x[2] >> 7) &1, (x[2] >> 6) &1, (x[2] >> 5) &1, (x[2] >> 4) &1, (x[2] >> 3) &1, (x[2] >> 2) &1, (x[2] >> 1) &1, (x[2] >> 0) &1,
            (x[3] >> 7) &1, (x[3] >> 6) &1, (x[3] >> 5) &1, (x[3] >> 4) &1, (x[3] >> 3) &1, (x[3] >> 2) &1, (x[3] >> 1) &1, (x[3] >> 0) &1,
            (x[4] >> 7) &1, (x[4] >> 6) &1, (x[4] >> 5) &1, (x[4] >> 4) &1, (x[4] >> 3) &1, (x[4] >> 2) &1, (x[4] >> 1) &1, (x[4] >> 0) &1,
            x[0], x[1], x[2], x[3], x[4], x[0], x[1], x[2], x[3], x[4]);
          }
          if (x[0] == 15 and tunnistettu == false) {
          }