# UoM when migrating to OH4

**URL:** <https://community.openhab.org/t/uom-when-migrating-to-oh4/150033>\
**Category:** Migration\
**Created:** [October 1, 2023, 6:40am UTC](https://community.openhab.org/t/uom-when-migrating-to-oh4/150033 "2023-10-01T06:40:11Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![jlikonen](https://community.openhab.org/letter_avatar_proxy/v4/letter/j/ee59a6/32.png) [@jlikonen](https://community.openhab.org/u/jlikonen)\
**Post date:** [October 1, 2023, 1:32pm UTC](https://community.openhab.org/t/uom-when-migrating-to-oh4/150033/7 "2023-10-01T13:32:00Z")

</div>

OK, now I got it working finally with the help of rossko57’s [post](https://community.openhab.org/t/working-with-number-temperature-items-in-rules/116197).

My DSL script is now:

```auto
var QuantityType<Energy> tot_energy = 20350.27 | kWh
var PV_tot_energy = (FroniusSymoInverter_TotalEnergy.state as QuantityType<Energy>).toBigDecimal + tot_energy.toBigDecimal
Fronoius_PV_total_energy.sendCommand(PV_tot_energy)

```

---

_[View the full topic](https://community.openhab.org/t/uom-when-migrating-to-oh4/150033)._
