Hi, sorry I’m not very expert and I have not found a solution in the forum.
I have a KNX sensor with value in DPT-9 to measure the electric power (W). Is it possible to convert it to decimal value?
Not exactly sure what you want to do. If the KNX sensor is only reporting an integer, changing it to a decimal value won’t do anything other than adding .00 to the end of it.
What is your KNX config?
It looks like you should be able to specify a type DPT-9 to it.
sensor:
- platform: knx
name: Heating.Valve1
state_address: '2/0/0'
type: 'DPT-9'
My programming is this:
sensor:
platform: knx
name: POTENZA1
state_address: 15/3/1
type: DPT-9
My consumption sensor only has hexadecimal output.
The problem is that the value is not decimal and is not displayed on a graph correctly.
I thought of turning it into a decimal value to be able to display it correctly.
type
(string)(Required)
A type from the following table must be defined. The DPT of the group address should match the expected KNX DPT to be parsed correctly.
You mentioned DPT-9, so I assumed the output of the sensor was in fact that. You have to match the output of the sensor.
There is a
type: power
which has units in Watts. Maybe you need to use that one?
What model knx sensor is it?
An output graph shouldn’t care about decimal or not. It can plot integer and hexidecimal numbers just fine.
if I put POWER on type, no value is displayed.
If I put DPT-9 the displayed value is correct but the graph is displayed incorrect.
I wanted to get a chart like this.
my sensor is:
KES - KNX Energy Saver
KNX Energy Saver
REF: ZN1IO-KES
Oh, I understand now.
> # Sensors with missing
unit_of_measurement are showing as discrete values.
Seems like an oversight of the knx integration. It should let you specify it there. Oh well, this is exactly what customizing entities is for.
Create a custom entry for your sensor.
homeassistant:
customize:
# Add an entry for each entity that you want to overwrite.
# Change this to the real name of the knx sensor
sensor.potenza1:
device_class: power
unit_of_measurement: W
ok. Thank you very much!
Now the graph is correct !!
Good to hear it works for you now.
In the next version of xknx there will be a sensor type for 2bit float (dpt9) power sensors that will set the device class automatically.
Great!
It is the first time that I use the forum and I am happy to have used it!