Modbus - Read Full Byte and Decode

I’m finally raising the white flag as I can’t sort this out. I’m interfacing to a Triangle Tube boiler and seem to only be receiving 6 bits of address 0.

image

Currently the reading with the below modbus config is 52 (binary 110100 ) which is short 2 bits. I’ve tried all of the options for structure: (>, <, f, F, I, i, etc). I’m sure it is something to do with the LB: Flag8 that I haven’t been able to wrap my mind around.

I switched the boiler into manual mode which should trigger bit 0 and it doesn’t.
DHW Pump (bit 6) gives a value of 64
System / CH2 Pump gives a value of 32

Any help would be appreciated. Once I sort that out, I may need help actually decoding the value.

      sensors:
        - name: "boiler_status"
          slave: 1
          input_type: input
          address: 0
          scan_interval: 10
          data_type: custom
          structure: ">H"

https://www.rapidtables.com/convert/number/binary-to-hex.html

Thanks for the help. I was using the tables but didn’t think about dropping in the full binary to see if it was just dropping. My ModBus configuration ended up as below.

        - name: "boiler_status"
          slave: 1
          input_type: input
          address: 0
          scan_interval: 5
          data_type: int16

I was able to decode the bits with the following Sensor Templates (for anyone searching to make this work)

      state: >
        "{{ states('sensor.boiler_status') | int(0) | bitwise_and(1) > 0 }}"
      attributes:
        friendly_name: "Boiler PC Manual Mode"
    
    - name: boiler_dhw_mode
      state: >
        "{{ states('sensor.boiler_status') | int(0 ) | bitwise_and(2) > 0 }}"
      attributes:
        friendly_name: "Boiler DHW Mode"
              
    - name: boiler_ch_mode
      state: >
        "{{ states('sensor.boiler_status') | int(0) | bitwise_and(4) > 0 }}"
     attributes:
        friendly_name: "Boiler CH Mode"
        
    - name: boiler_freeze_protect
      state: >    
        "{{ states('sensor.boiler_status') | int(0) | bitwise_and(8) > 0 }}"
      attributes:
        friendly_name: "Boiler Freeze Protection Mode"
    
    - name: boiler_flame_present
      state: >
        "{{ states('sensor.boiler_status') | int(0) | bitwise_and(16) > 0 }}"
      attributes:
        friendly_name: "Boiler Flame Present"
            
    - name: boiler_ch1_pump
      state: >
        "{{ states('sensor.boiler_status') | int(0) | bitwise_and(32) > 0 }}"
      attributes:
        friendly_name: "Boiler CH1 Pump On"
              
    - name: boiler_dhw_pump
      state: >
        "{{ states('sensor.boiler_status') | int(0) | bitwise_and(64) > 0 }}"
      attributes:
        friendly_name: "Boiler DHW Pump On"
            
    - name: boiler_system_pump
      state: >
        "{{ states('sensor.boiler_status') | int(0) | bitwise_and(128) > 0 }}"
      attributes:
        friendly_name: "Boiler System Pump On"

Nice work. Have you been able to make any efficiency improvements to your boiler using this data? I was hoping I could pull CH and DHW total fires and total runtime via modbus but appears thats calculated on their controller, not available data. I guess I’ll have to replicate that through some database math.

I haven’t messed with trying to adjust anything via HA. It’s self modulating with an outdoor air temp, so it does a pretty good job on it’s own (I have infloor heat that is never ‘setback’).

I created a sensor for total runtime each day

sensor:
  - platform: history_stats
    name: Boiler On Today
    entity_id: binary_sensor.boiler_ch_mode
    state: "on"
    type: time
    start: "{{ now().replace(hour=0, minute=0, second=0) }}"
    end: "{{ now() }}"