xknx icon indicating copy to clipboard operation
xknx copied to clipboard

Feature Request : Integration of DPT 235.001 / DPT_Tariff_ActiveEnergy

Open bbreton09 opened this issue 3 years ago • 10 comments

Hello, do you think it's possible to integrate the DPT 235.001. Is a 6bytes DPT. This contains DPT 13.010 and 5.006+1 data validity byte.

image

Thank you

bbreton09 avatar Dec 18 '22 14:12 bbreton09

Hi 👋

Currently we don’t support “compound” DPTs as sensors. It would need a quite big change in how HA entity creation works.

Such a feature could also be used for other DPTs like RBG color etc.

farmio avatar Dec 18 '22 15:12 farmio

Hi, it's bad new :'( thank you for quick answere.

bbreton09 avatar Dec 18 '22 15:12 bbreton09

It's not like this feature wouldn't be welcomed. It's just that someone would need to find time to implement it.

farmio avatar Dec 18 '22 16:12 farmio

🤔 thinking about that a little bit more, it might actually be trivial to add support for HA events and services (not sensors / entities). I guess that would be a good start as sensors might get created from templates easily then.

@bbreton09 do you want to start working on that?

farmio avatar Dec 18 '22 16:12 farmio

🤔 thinking about that a little bit more, it might actually be trivial to add support for HA events and services (not sensors / entities). I guess that would be a good start as sensors might get created from templates easily then.

@bbreton09 do you want to start working on that?

Hi @farmio,

Unfortunately, I'm not a developer at all. I can however test things I have a machine with Hass.io and a module that supports DPT 235.001.

bbreton09 avatar Dec 18 '22 20:12 bbreton09

Hi @bbreton09,

could you tell me a little bit more about your usecase with this particular DPT? What would you want to do with it?

marvin-w avatar Dec 18 '22 20:12 marvin-w

@marvin-w

I have a Hager TX230 module which receive the active energy in kWh via teleinfo. Unfortunately this module uses DPT 235.001. Therefore active energy DPT 13.010 is combined with Tariff DPT 5.006. The goal here is therefore to be able to recover the active energy in kWh to use the HA energy module.

bbreton09 avatar Dec 18 '22 20:12 bbreton09

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please make sure to update to the latest version of xknx (or Home Assistant) and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Mar 24 '23 09:03 github-actions[bot]

Hi, any news about this DPT ? How can i help ?

Not shure it help but in jeedom KNX plugin the décoding is make like this:

case "235":
	if ($dpt != "235.001"){
	/*if ($value < 0)
	$value = (abs($value) ^ 0xffffffff) + 1 ; */
	foreach(explode('|',$option["ActiveElectricalEnergy"]) as $tarif => $ActiveElectricalEnergy){
	$value=cmd::byId(str_replace('#','',$ActiveElectricalEnergy))->execCmd();
	$data= array(($value>>24) & 0xFF, ($value>>16) & 0xFF,($value>>8) & 0xFF,$value & 0xFF,$tarif,(0<< 1) & 0x02 | 0);
	}
}
			case "235":
				if ($dpt == "235.001"){
					$value = $data[5] & 0x01;  
					if($value == 1)
					   break; 
					log::add('eibd', 'debug', 'La valeur de la énergie electrique est valide');		
					$value=($data[5]>>1) & 0x01;
					if($value == 1)
					   break;
					log::add('eibd', 'debug', 'La valeur du tarif est valide');	
					if ($option != null){
						if ($option["ActiveElectricalEnergy"] !=''){	
							$ActiveElectricalEnergy=explode('|',$option["ActiveElectricalEnergy"]);
							$Tarif=$data[4];
							log::add('eibd', 'debug', 'Nous allons mettre à jour le tarif '. $Tarif);	
							$ActiveElectricalEnergyCommande=cmd::byId(str_replace('#','',$ActiveElectricalEnergy[$Tarif]));
							if (is_object($ActiveElectricalEnergyCommande)){
								$valeur =$data[0] << 24 | $data[1] << 16 | $data[2] << 8 | $data[3] ;
								if ($valeur >= 0x80000000)
									$valeur = -(($valeur - 1) ^ 0xffffffff);  # invert twos complement    
								log::add('eibd', 'debug', 'L\'objet '.$ActiveElectricalEnergyCommande->getName().' à été trouvé et va être mis à jour avec la valeur '. $valeur);
								$ActiveElectricalEnergyCommande->event($valeur);
								$ActiveElectricalEnergyCommande->setCache('collectDate', date('Y-m-d H:i:s'));
							}
						}
					}
				}

bbreton09 avatar Nov 01 '23 13:11 bbreton09

Hi 👋! No news on this front. The first answer to this issue still applies. Parsing the payload is not the problem - handling the result down the pipeline in xknx devices, HA entities, services and events etc. is.

farmio avatar Nov 03 '23 07:11 farmio

Thank you ! Do you know how many time is take to this update is include in haos ?

bbreton09 avatar May 27 '24 12:05 bbreton09

It will need some changes in the integration code and the frontend too. And some testing would be good too. So definitely not in the coming release (that's in 2 days).

I did plan to release this as part of a bigger (breaking) change to xknx.

farmio avatar May 27 '24 13:05 farmio

It will need some changes in the integration code and the frontend too. And some testing would be good too. So definitely not in the coming release (that's in 2 days).

I did plan to release this as part of a bigger (breaking) change to xknx.

Hi, thank's your work ! I saw XKNX 3.0.0 with DPT 235.001 is release. Is he also available in HA 2024.8 ?

bbreton09 avatar Aug 09 '24 13:08 bbreton09

Yes 👍

farmio avatar Aug 09 '24 14:08 farmio

Yes 👍

What type should I use ? I try TariffActiveEnergy, DPT-235.001 but HA say error

https://www.home-assistant.io/integrations/knx/#sensor

bbreton09 avatar Aug 09 '24 15:08 bbreton09

It is not supported by the sensor platform. Only by triggers (knx.telegram or interface device), actions (knx.send) and group monitor.

It should be possible to create a trigger based template sensor with that. https://www.home-assistant.io/integrations/template/#trigger-based-template-binary-sensors-buttons-images-numbers-selects-and-sensors

farmio avatar Aug 09 '24 15:08 farmio

It is not supported by the sensor platform. Only by triggers (knx.telegram or interface device), actions (knx.send) and group monitor.

It should be possible to create a trigger based template sensor with that. https://www.home-assistant.io/integrations/template/#trigger-based-template-binary-sensors-buttons-images-numbers-selects-and-sensors

Ok, try to read in group monitor but return is null. In ETS i assign DPT 235.001 to Address Group and upload to HA.

image

image

bbreton09 avatar Aug 09 '24 16:08 bbreton09

Seems like the value is marked "invalid" 🤔 https://github.com/XKNX/xknx/blob/main/xknx/dpt/dpt_235.py#L19 See the screenshot in the initial post here.

farmio avatar Aug 09 '24 16:08 farmio

Hi, this is the log knx when receive value with DPT 235.001. I alway have null value.

2024-10-25 16:45:02.941 DEBUG (KNX Interface) [xknx.knx] Received from 192.168.1.4:3671: <KNXIPFrame <KNXIPHeader HeaderLength="6" ProtocolVersion="16" KNXIPServiceType="TUNNELLING_REQUEST" TotalLength="27" /> body="<TunnellingRequest communication_channel_id="69" sequence_counter="114" cemi="2900bce0110d4002070080054024a80000" />" />
2024-10-25 16:45:02.941 DEBUG (KNX Interface) [xknx.knx] Sending to 192.168.1.4:3671: <KNXIPFrame <KNXIPHeader HeaderLength="6" ProtocolVersion="16" KNXIPServiceType="TUNNELLING_ACK" TotalLength="10" /> body="<TunnellingAck communication_channel_id="69" sequence_counter="114" status_code="ErrorCode.E_NO_ERROR" />" />
2024-10-25 16:45:02.944 DEBUG (MainThread) [xknx.cemi] Incoming CEMI: <CEMIFrame code="L_DATA_IND" info="CEMIInfo("")" data="CEMILData(src_addr="IndividualAddress("1.1.13")" dst_addr="GroupAddress("8/0/2")" flags="1011110011100000" tpci="TDataGroup()" payload="<GroupValueWrite value="<DPTArray value="[0x5,0x40,0x24,0xa8,0x0,0x0]" />" />")" />
2024-10-25 16:45:02.944 DEBUG (MainThread) [xknx.telegram] <Telegram direction="Incoming" source_address="1.1.13" destination_address="8/0/2" payload="<GroupValueWrite value="<DPTArray value="[0x5,0x40,0x24,0xa8,0x0,0x0]" />" />" data="TariffActiveEnergy(energy=None, tariff=None) (DPTTariffActiveEnergy)" />
2024-10-25 16:45:02.947 WARNING (MainThread) [xknx.log] Can not process <Telegram direction="Incoming" source_address="1.1.13" destination_address="8/0/2" payload="<GroupValueWrite value="<DPTArray value="[0x5,0x40,0x24,0xa8,0x0,0x0]" />" />" data="TariffActiveEnergy(energy=None, tariff=None) (DPTTariffActiveEnergy)" /> for energy.Total - Value: <CouldNotParseTelegram description="Invalid payload length for DPTString" expected_length="14" payload="<DPTArray value="[0x5,0x40,0x24,0xa8,0x0,0x0]" />"/>

bbreton09 avatar Oct 25 '24 15:10 bbreton09

@farmio @bbreton09 : for information I opened a PR to fix this https://github.com/XKNX/xknx/pull/1685

NHanser avatar May 11 '25 21:05 NHanser

Bonjour, je suis novice dans la programmation de HA mais j’ai quelques compétences en KNX (KNX Partner). L’évolution de XkNX permet maintenant de décoder le DPT 235.001 au niveau du groupe monitor KNX. Est-ce qu’une personne pourrait m’indiquer la marche à suivre pour créer correctement le sensor afin de pouvoir l’intégrer dans l’énergie ?

Lorsque j’indique le type ou le numéro de DPT, HA refuse l’entrée indiquée.

Merci !

Hello, I am a novice in HA programming but I have some skills in KNX (KNX Partner). The evolution of XkNX now allows decoding the DPT 235.001 at the level of the KNX monitor group. Could someone tell me the procedure to follow to properly create the sensor in order to integrate it into energy?

When I indicate the type or number of DPT, HA refuses the indicated entry. Image

Image

Foulek94 avatar Oct 24 '25 20:10 Foulek94

@Foulek94 Hi 👋! See https://github.com/XKNX/xknx/issues/1108#issuecomment-2278261126 You can use the knx.telegram trigger for a template sensor.

farmio avatar Oct 24 '25 20:10 farmio

@farmio Hi,

Thank you for your reply. Could you please send me an example of YAML code that I can use to create this?

Foulek94 avatar Oct 24 '25 21:10 Foulek94

Something along the lines of state: "{{ trigger.value.energy }}" but I never tested that. You'll probably find similar examples in the template documentation linked above.

I'd use a helper created in UI instead of pure yaml 😉

farmio avatar Oct 24 '25 21:10 farmio