How can i use bitcoded sensor

Hi
i have an modbus sensor:
- name: isg_betriebsstatus
input_type: input
address: 2500
slave: 1

the value of the sensor is bitcoded:

HK 1 PUMPE B0
HK 2 PUMPE B1
AUFHEIZPROGRAMM B2
NHZ STUFEN IN BETRIEB B3
WP IM HEIZBETRIEB B4
WP IM WARMWASSERBETRIEB B5
VERDICHTER IN BETRIEB B6
SOMMERBETRIEB AKTIV B7
KUEHLBETRIEB AKTIV B8
MIN. EINE IWS IM ABTAUBETRIEB B9
SILENTMODE 1 AKTIV B10
SILENTMODE 2 AKTIV (WP AUS) B11

for example i get a value of 81 = 01010001
which means bit 0 (HK 1 PUMPE ), bit 4(WP IM HEIZBETRIEB) and bit 6 (VERDICHTER IN BETRIEB ) are active

how can i show these values in homeassitant?

Welcome to HA! :slight_smile:
Take a look here:

thanks. that was the right hint. i will try that.

here my working config for the stiebel eltron heat pump. i hope it will help others.

` modbus:

  • name: “isg”
    type: tcp
    host: 192.168.1.xx
    port: 502
    sensors:
    • name: isg_aussentemperatur
      input_type: input
      address: 506
      unit_of_measurement: °C
      slave: 1
      scale: 0.1
      precision: 1
    • name: isg_ISTTEMPERATUR_HK_1
      input_type: input
      address: 507
      unit_of_measurement: °C
      state_class: measurement
      slave: 1
      scale: 0.1
      precision: 1
    • name: isg_SOLLTEMPERATUR_HK_1
      input_type: input
      address: 509
      unit_of_measurement: °C
      state_class: measurement
      slave: 1
      scale: 0.1
      precision: 1
    • name: isg_RUECKLAUFEMPERATUR_WP_1
      input_type: input
      address: 541
      unit_of_measurement: °C
      state_class: measurement
      slave: 1
      scale: 0.1
      precision: 1
    • name: isg_VORLAUFTEMPERATUR_WP_1
      input_type: input
      address: 542
      unit_of_measurement: °C
      state_class: measurement
      slave: 1
      scale: 0.1
      precision: 1
    • name: isg_betriebsstatus
      input_type: input
      address: 2500
      slave: 1
    • name: isg_evu-sperre
      input_type: input
      address: 2501
      slave: 1
    • name: isg_PUFFERLADEPUMPE_1
      input_type: input
      address: 2511
      slave: 1
    • name: isg_VERDICHTER_1
      input_type: input
      address: 2541
      slave: 1
    • name: isg_WASSERVOLUMENSTROM_WP_1
      input_type: input
      address: 547
      unit_of_measurement: l/m
      state_class: measurement
      slave: 1
      scale: 0.1
      precision: 1
    • name: isg_VD_HEIZEN_TAG
      input_type: input
      address: 3510
      unit_of_measurement: kWh
      state_class: total
      slave: 1
      scale: 1
      precision: 1
      device_class: energy
    • name: isg_VD_HEIZEN_SUMME
      input_type: input
      address: 3511
      unit_of_measurement: kWh
      state_class: total_increasing
      slave: 1
      scale: 1
      precision: 1
      device_class: energy
      template:
  • sensor:
    • name: “Total aktueller Stromverbrauch”
      unit_of_measurement: “Watt”
      state: >
      {{ states(“sensor.shellyem3_485519c9ac6c_channel_c_power”) | float + states(“sensor.shellyem3_485519c9ac6c_channel_b_power”)|float + states(“sensor.shellyem3_485519c9ac6c_channel_a_power”)|float}}
  • binary_sensor:
    • name: “isg_betriebsstatus_hk1_pumpe”
      state: " {{ states(‘sensor.isg_betriebsstatus’)|int|bitwise_and(1) > 0 }}"
      device_class: “running”
    • name: “isg_betriebsstatus_hk2_pumpe”
      state: " {{ states(‘sensor.isg_betriebsstatus’)|int|bitwise_and(2) > 0 }}"
      device_class: “running”
    • name: “isg_betriebsstatus_aufheizprogramm”
      state: " {{ states(‘sensor.isg_betriebsstatus’)|int|bitwise_and(4) > 0 }}"
      device_class: “running”
    • name: “isg_betriebsstatus_NHZ_STUFEN_IN_BETRIEB”
      state: " {{ states(‘sensor.isg_betriebsstatus’)|int|bitwise_and(8) > 0 }}"
      device_class: “running”
    • name: “isg_betriebsstatus_HEIZBETRIEB”
      state: " {{ states(‘sensor.isg_betriebsstatus’)|int|bitwise_and(16) > 0 }}"
      device_class: “running”
    • name: “isg_betriebsstatus_WARMWASSERBETRIEB”
      state: " {{ states(‘sensor.isg_betriebsstatus’)|int|bitwise_and(32) > 0 }}"
      device_class: “running”
    • name: “isg_betriebsstatus_VERDICHTER”
      state: " {{ states(‘sensor.isg_betriebsstatus’)|int|bitwise_and(64) > 0 }}"
      device_class: “running”
    • name: “isg_betriebsstatus_SOMMERBETRIEB”
      state: " {{ states(‘sensor.isg_betriebsstatus’)|int|bitwise_and(128) > 0 }}"
      device_class: “running” `

Hello everyone,
I’m struggeling with my bitcoded value from my LWZ.
In my isg_sensors.yaml I’ve got a sensor representing the systemstatus called “Betriebsstatus”

  - name:                'HEIZUNG-BETRIEBSSTATUS'
    slave:              1
    address:            2000
    input_type:         input
    data_type:          uint16

At present I got the value 17.

In a second file called binary_sensor.yaml I hava got separate sensors to get the different status out of the bitcoded value.

- platform: template
  sensors:

    isg_betriebsstatus_hk1_pumpe:
      friendly_name: "Heizung Schaltprogramm aktiv"
      value_template: "{{ states('sensor.HEIZUNG-BETRIEBSSTATUS')|int|bitwise_and(1) > 0 }}"
    
    isg_betriebsstatus_hk2_pumpe:
      friendly_name: "Heizung Verdichter"
      value_template: "{{ states('sensor.HEIZUNG-BETRIEBSSTATUS')|int|bitwise_and(2) > 0 }}"
    
    isg_betriebsstatus_aufheizprogramm:
      friendly_name: "Heizung Heizen"
      value_template: "{{ states('sensor.HEIZUNG-BETRIEBSSTATUS')|int|bitwise_and(4) > 0 }}"      
 
    isg_betriebsstatus_en:
      friendly_name: "Heizung KĂŒhlen"
      value_template: "{{ states('sensor.HEIZUNG-BETRIEBSSTATUS')|int|bitwise_and(8) > 0 }}"          
 
    isg_betriebsstatus_heizbetrieb:
      friendly_name: "Heizung Warmwasserbereitung"
      value_template: "{{ states('sensor.HEIZUNG-BETRIEBSSTATUS')|int|bitwise_and(16) > 0 }}"  
  
    isg_betriebsstatus_waremwasserbetrieb:
      friendly_name: "Heizung Elektr. NE"
      value_template: "{{ states('sensor.HEIZUNG-BETRIEBSSTATUS')|int|bitwise_and(32) > 0 }}"  
  
    isg_betriebsstatus_verdichter:
      friendly_name: "Heizung Service"
      value_template: "{{ states('sensor.HEIZUNG-BETRIEBSSTATUS')|int|bitwise_and(64) > 0 }}"
  
    isg_betriebsstatus_sommerbetrieb:
      friendly_name: "ISG State Summer Mode active"
      value_template: "{{ states('sensor.HEIZUNG-BETRIEBSSTATUS')|int|bitwise_and(128) > 0 }}"
  
    isg_betriebsstatus_kuehlbetrieb:
      friendly_name: "ISG State Cooling active"
      value_template: "{{ states('sensor.HEIZUNG-BETRIEBSSTATUS')|int|bitwise_and(256) > 0 }}"

    isg_betriebsstatus_auftauen:
      friendly_name: "ISG State Defrost active"
      value_template: "{{ states('sensor.HEIZUNG-BETRIEBSSTATUS')|int|bitwise_and(512) > 0 }}"

    isg_betriebsstatus_silentmode1_active:
      friendly_name: "ISG State Silentmode1 active"
      value_template: "{{ states('sensor.HEIZUNG-BETRIEBSSTATUS')|int|bitwise_and(1024) > 0 }}"

    isg_betriebsstatus_silentmode2_active:
      friendly_name: "ISG State Silentmode2 active"
      value_template: "{{ states('sensor.HEIZUNG-BETRIEBSSTATUS')|int|bitwise_and(2048) > 0 }}"

My dashboard shows for all binary sensors the vale “not availible”. I can not get it run.

Does anybode have an idea, where to find the mistake or waht to change?

exactly what i was looking for! Thank you very much! :slight_smile:

1 Like