I have a sensor that I am trying to retrieve a temperature information in HEX value from a large json string for Home assistant to display as a temperature sensor.
The value is in both Data and CmndData
I am using CmndData as it is shorter.
The 2 characters in position 24 and 25 for my hex value
010100010105020004000000**4B**650100010066040001006704000101
How can I return these 2 characters as a sensor value or does someone have a better way
How can I return these 2 characters as a sensor value or does someone have a better way
I know that once i get the values I will need to convert them to decimal hopefully by appending
|int(base=16) to the end
Based only on a seat of the pants feeling, I think it’s more efficient. Performing a simple string slice seems like less effort required than searching through a string for a matching pattern. Plus the template is more compact and legible (i.e. [24:26] versus '^.{24}([0-9a-fA-F]{2})').