Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106346

Homeassistant template with XOR

$
0
0

Hello,

For a specific script I need to be able to send a computed value in MQTT, based on a xor operation:

...
    sequence:
        - service: mqtt.publish
          data:
              topic: "sensor"
              payload_template: "12345678{{ '%X' % V1 }}0{{ '%X' % V2 }}000{{ '%X' % (V1 ^ V2) }}"
...

The last byte is a kind of checksum based on a XOR operation. The problem is that this XOR operation does not exist in homeassistant. There are some pull request providing this operation to homeassistant (bitwise_xor), but it is not taken into account by developpers.

Do you have any workaround to perform such an operation ? I bet that my only choice will be to use a custom component, to add this basic feature. However, I have no idea how to add some jinja2 filter to homeassistant.

Thank you in advance

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106346

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>