Hi,
I'm using a dummy device to manage a counter of events. I also need to send this count to an external endpoint using SendToHTTP - BUT it needs to be encoded as a hexadecimal number... I can't find any way to do it in rules.
In a sense, I need the reverse of 'strtol' or at least the reverse of 'ord'
Any help appreciated!
--
Andrzej
Number to hex string conversion in rules
Moderators: grovkillen, Stuntteam, TD-er
Re: Number to hex string conversion in rules
Hmm the other way around is already present, but I can only think of very elaborate ways to convert to hex.
So unless you want to create very elaborate (thus slow) rules, I guess it is a nice feature request.
So unless you want to create very elaborate (thus slow) rules, I guess it is a nice feature request.
Re: Number to hex string conversion in rules
I was afraid you would say so ...
I'm thinking about maybe using substring creatively - if it's possible to declare a string literal (var) somewhere, like "01234567890ABCDEF" and to concatenate substrings (or chars), then I could do some math juggling to create the hex strings piecemeal - but I suspect that's not possible either?
--
Andrzej
I'm thinking about maybe using substring creatively - if it's possible to declare a string literal (var) somewhere, like "01234567890ABCDEF" and to concatenate substrings (or chars), then I could do some math juggling to create the hex strings piecemeal - but I suspect that's not possible either?
--
Andrzej
Re: Number to hex string conversion in rules
That's what I meant with "very elaborate rules"
I think a new feature supporting this should be something like the other "Standard Conversions" (See System Variables page)
I will see what I can think of...
I think a new feature supporting this should be something like the other "Standard Conversions" (See System Variables page)
I will see what I can think of...
Re: Number to hex string conversion in rules
It was really easy to do, most of the needed time was in updating the system variables documentation.
See: https://github.com/letscontrolit/ESPEasy/pull/3296
See: https://github.com/letscontrolit/ESPEasy/pull/3296
Re: Number to hex string conversion in rules
Ah, this is great! it saves me a lot of trouble going the micropython route (python irq handling and button debouncing is not trivial).
Thank you!
--
Andrzej
Thank you!
--
Andrzej
Who is online
Users browsing this forum: Bing [Bot] and 111 guests