Strange trigger values with MMBT-S interface

Thanks for digging into that Jens, I never noticed that the bytes(chr(trigger)) doesn’t work above 127 (so only a 7-bit value :thinking:), Using chr(128) does return the same value as bytearray([128]) so the issue is the unicode->str conversion rather than the chr conversion itself.

Your fix looks good and, as a minimum, we’ll fix that in the docs/tooltip.

Going further, I’ve talked before with @Kimberley_Dundas and now with @TParsons about providing a “datatype” dropdown for options, so that the user doesn’t need to look up how to convert between different types of trigger. I’m imagining options for:

  • string (as currently, so you can send “yes”)
  • numeric (0-255)
  • binary (e.g. 00111010 which is convenient to visualise particular lines going up/down)

The code from builder would then be hard-coded accordingly in the script (eg. int(trigger, 2) for the binary setting)

I think this will help people to think about the fact that an 8-bit value can be represented in various interchangeable ways and you need to be aware of your format

1 Like