I’m using MQTT to interact with Arduino devices using the MySensor libraries. I am able to publish my ColorPicker updates to my MQTT server and subsequently to my Arduino client node. The problem is that OpenHAB is sending the long decimal string for the color selected. My client nodes can only receive a max 25 byte string, and the sent string is usually 35+ characters. The best option is to convert the integers to HEX and publish the 6 character HEX number. Second option would be to drop all the decimal places and then publish the integers. Unfortunately I can’t figure out how to do either, and I haven’t found any examples on my search.
I think the RULE idea is the most appropriate, since I don’t really want to introduce another tool in the mix. I have already figured out how to get the right data from the ColorPicker output using .state. Now I’m trying to figure out how to take a number like this:
And parse it into the following
Which I then save to variables
I’m unfamiliar with the code used within OpenHAB to right this rule up. I’ve seen some code for an Arduino to do this, however, they are not the same.