OpenHab2 JS Transform?

I’m attempting to move my OH1 setup to OH2. I’m slowly progressing, but one of the first things that have caused me an issue is the JS transform I use to convert my MQTT temperature sensor values from C to F. I’m getting the following error in my log file: “[WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type JS”

Attempting to add the “JS” transform to addons.cfg did not work. What is my issue? Is the JS transform gone in OH2? Is there an easier way to perform this transform?

ETA: Found the transform installation in the control panel, it’s now named “javascript”

1 Like

Right, so I assume your question is answered then, right?

Yes, this one is solved, thanks! :slight_smile:

Hello!
I do so, it works, but in a permanent error log. What am I doing wrong?

addons.cfg:
transformation = javascript,map

my.items:
String dev_uptime “Uptime [%s]” { mqtt="<[mqtt-loc:dev/uptime:state:JS(uptime.js)]" }

uptime.js:
(function(seconds){
var days = Math.floor(seconds / 86400);
seconds -= days * 86400;
var hours = Math.floor(seconds / 3600);
seconds -= hours * 3600;
var minutes = Math.floor(seconds / 60);
seconds -= minutes * 60;

if (days > 0) { days = days + ' d. '; }
if(minutes < 10) { min = min + '0'; }

return days + hours + ':' + minutes;

})(input)

openhab.log:
2016-11-16 08:52:34.537 [ERROR] [.mqtt.internal.MqttMessageSubscriber] - Error processing MQTT message.
org.openhab.core.transform.TransformationException: An error occured while executing script.
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:63)[195:org.openhab.core.compat1x:2.0.0.201611152358]
at org.openhab.binding.mqtt.internal.MqttMessageSubscriber.processMessage(MqttMessageSubscriber.java:138)[194:org.openhab.binding.mqtt:1.9.0.201611130211]
at org.openhab.io.transport.mqtt.internal.MqttBrokerConnection.messageArrived(MqttBrokerConnection.java:552)[196:org.openhab.io.transport.mqtt:1.9.0.201611130211]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:336)[196:org.openhab.io.transport.mqtt:1.9.0.201611130211]
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:148)[196:org.openhab.io.transport.mqtt:1.9.0.201611130211]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]

Thanks!

Is the JavaScript transformation known by the name js? Your .js file seems to be correct syntax, but maybe the needed transformation service is not installed?

Hello!
uptime.js file is in the directory / transform
in PaperUI:

or I misunderstood you?
Sorry, my English is very bad :frowning:

PS Again, the script works!
All good, but the persistent errors in the log.

1 Like

It looks to me like you’ve done everything correctly and the transform is working as intended, but there is still some issue that’s not apparent. I think a more complete listing of your items, transform scripts and .cfg file might help track down the source. For readability, please use this formatting in your posts:

```
code or log output
```

Thanks!

Which version do you use? Having similar errors in the log since update to OH2 build #587… - Before I did the update, everything works fine without errors.

But didn´t find the time to look in the details yet. Maybe this evening.

climate.items

Group		gTempIn
Group		gHumiIn

// garage-box-climate
Switch		garage_box_climate_state		"Статус"				<switch>				{ mqtt="<[mqtt-loc:garage/box/climate/state:command:default]" }
DateTime	garage_box_climate_last_update		"Данные обновлены [%1$ta %1$tR]"	<clock>					
String		garage_box_climate_uptime		"Время в сети [%s]"			<clock>					{ mqtt="<[mqtt-loc:garage/box/climate/uptime:state:JS(uptime.js)]" }
Number		garage_box_climate_temp			"В гараже [%.1f °C]"			<temperature>		(gTempIn)	{ mqtt="<[mqtt-loc:garage/box/climate/temp:state:default]" }
Number		garage_box_climate_humi			"В гараже [%.0f %%]"			<humidity>		(gHumiIn)	{ mqtt="<[mqtt-loc:garage/box/climate/humi:state:default]" }

// garage-room-climate
Switch		garage_room_climate_state		"Статус"				<switch>				{ mqtt="<[mqtt-loc:garage/room/climate/state:state:default]" }
DateTime	garage_room_climate_last_update		"Данные обновлены [%1$ta %1$tR]"	<clock>
String		garage_room_climate_uptime		"В сети [%s]"				<clock>					{ mqtt="<[mqtt-loc:garage/room/climate/uptime:state:JS(uptime.js)]" }
Number		garage_room_climate_temp		"В комнате [%.1f °C]"			<temperature>		(gTempIn)	{ mqtt="<[mqtt-loc:garage/room/climate/temp:state:default]" }
Number		garage_room_climate_humi		"В комнате [%.0f %%]"			<humidity>		(gHumiIn)	{ mqtt="<[mqtt-loc:garage/room/climate/humi:state:default]" }

// garage-cellar-climate
Switch		garage_cellar_climate_state		"Статус"				<switch>				{ mqtt="<[mqtt-loc:garage/cellar/climate/state:command:default]" }
DateTime	garage_cellar_climate_last_update	"Данные обновлены [%1$ta %1$tR]"	<clock>
String		garage_cellar_climate_uptime		"В сети [%s]"				<clock>					{ mqtt="<[mqtt-loc:garage/cellar/climate/uptime:state:JS(uptime.js)]" }
Number		garage_cellar_climate_temp		"В подвале [%.1f °C]"			<temperature>		(gTempIn)	{ mqtt="<[mqtt-loc:garage/cellar/climate/temp:state:default]" }
Number		garage_cellar_climate_humi		"В подвале [%.0f %%]"			<humidity>		(gHumiIn)	{ mqtt="<[mqtt-loc:garage/cellar/climate/humi:state:default]"}

// garage-street-climate
Switch		garage_street_climate_state		"Статус"				<switch>				{ mqtt="<[mqtt-net:work/climate/state:command:default]" }
DateTime	garage_street_climate_last_update	"Данные обновлены [%1$ta %1$tR]"	<clock>
String		garage_street_climate_uptime		"В сети [%s]"				<clock>					{ mqtt="<[mqtt-net:work/climate/uptime:state:JS(uptime.js)]" }
Number		garage_street_climate_temp		"На улице [%.1f °C]"			<temperature>				{ mqtt="<[mqtt-net:work/climate/street/temp:state:default]" }
Number		garage_street_climate_humi		"На улице [%.0f %%]"			<humidity>				{ mqtt="<[mqtt-net:work/climate/street/humi:state:default]" }
Number		garage_street_climate_press		"Давление [%.0f %%]"			<press>					{ mqtt="<[mqtt-net:work/climate/press:state:default]" }

// buttons chart
Number 		chart_period_temp			"Период"				<chart>
Number		chart_period_humi			"Период"				<chart>

last_update.rules

//---------------------------------------------------------------------------------------------
rule "Last update: garage-box-climate"
when
    Item garage_box_climate_uptime received update
then
    postUpdate(garage_box_climate_last_update, new DateTimeType())
end
//---------------------------------------------------------------------------------------------
rule "Last update: garage-room-climate"
when
    Item garage_room_climate_uptime received update
then
    postUpdate(garage_room_climate_last_update, new DateTimeType())
end
//---------------------------------------------------------------------------------------------
rule "Last update: garage-cellar-climate"
when
    Item garage_cellar_climate_uptime received update
then
    postUpdate(garage_cellar_climate_last_update, new DateTimeType())
end
//---------------------------------------------------------------------------------------------
rule "Last update: garage-street-climate"
when
    Item garage_street_climate_uptime received update
then
    postUpdate(garage_street_climate_last_update, new DateTimeType())
end
//---------------------------------------------------------------------------------------------

uptime.js

(function(seconds){
    var days = Math.floor(seconds / 86400);
    seconds -= days * 86400;
    var hours = Math.floor(seconds / 3600);
    seconds -= hours * 3600;
    var minutes = Math.floor(seconds / 60);
    seconds -= minutes * 60;

    if (days > 0) { days = days + ' ะด. '; }
    if(minutes < 10) { min = min + '0'; }

    return days + hours + ':' + minutes;
})(input)

addons.cfg

# The base installation package of this openHAB instance (default is "standard")
# Valid options:
#   - minimal  : Installation only with dashboard, but no UIs or other addons
#   - standard : Typical installation with all standards UIs
#   - demo     : A demo setup which includes UIs, a few bindings, config files etc.
#
#package = standard

# Access Remote Add-on Repositories
# Defines whether the remote openHAB add-on repository should be used for browsing and installing add-ons.
# This not only makes latest snapshots of add-ons available, it is also required for the installation of
# any legacy 1.x add-on and all experimental features. (default is false for offline distro, true for online distro)
#
#remote = true

# Include legacy 1.x bindings. If set to true, it also allows the installation of 1.x bindings for which there is 
# already a 2.x version available (requires remote repo access, see above). (default is false)
#
#legacy = true

# Include experimental add-ons. If set to true, it also allows the installation of extensions that are not (yet) part
# of the official distribution and need further testing (requires remote repo access, see above). (default is false)
#
#experimental = true


# A comma-separated list of bindings to install (e.g. "sonos,knx,zwave")
binding = astro,mqtt

# A comma-separated list of UIs to install (e.g. "basic,paper")
ui = habpanel

# A comma-separated list of persistence services to install (e.g. "rrd4j,jpa")
persistence = rrd4j 

# A comma-separated list of actions to install (e.g. "mail,pushover")
action = telegram

# A comma-separated list of transformation services to install (e.g. "map,jsonpath")
transformation = javascript,map

# A comma-separated list of voice services to install (e.g. "marytts,freetts")
voice = 

# A comma-separated list of miscellaneous services to install (e.g. "myopenhab")
misc = 

events.log

2016-11-18 10:24:33.518 [ItemChannelLinkAddedEvent ] - Link 'sun_elevation-astro:sun:local:position#elevation' has been added.
2016-11-18 10:24:33.542 [ItemChannelLinkAddedEvent ] - Link 'sun_astrodawn-astro:sun:local:astroDawn#start' has been added.
2016-11-18 10:24:33.568 [ItemChannelLinkAddedEvent ] - Link 'sun_rise-astro:sun:local:rise#start' has been added.
2016-11-18 10:24:33.589 [ItemChannelLinkAddedEvent ] - Link 'sun_noon-astro:sun:local:noon#start' has been added.
2016-11-18 10:24:33.591 [ItemChannelLinkAddedEvent ] - Link 'sun_set-astro:sun:local:set#start' has been added.
2016-11-18 10:24:33.593 [ItemChannelLinkAddedEvent ] - Link 'sun_night-astro:sun:local:night#start' has been added.
2016-11-18 10:24:33.595 [ItemChannelLinkAddedEvent ] - Link 'season_name-astro:sun:local:season#name' has been added.
2016-11-18 10:24:33.598 [ItemChannelLinkAddedEvent ] - Link 'season_spring-astro:sun:local:season#spring' has been added.
2016-11-18 10:24:33.600 [ItemChannelLinkAddedEvent ] - Link 'season_summer-astro:sun:local:season#summer' has been added.
2016-11-18 10:24:33.643 [ItemChannelLinkAddedEvent ] - Link 'season_autumn-astro:sun:local:season#autumn' has been added.
2016-11-18 10:24:33.645 [ItemChannelLinkAddedEvent ] - Link 'season_winter-astro:sun:local:season#winter' has been added.
2016-11-18 10:24:34.423 [ThingAddedEvent           ] - Thing 'astro:sun:local' has been added.
2016-11-18 10:24:34.492 [ItemAddedEvent            ] - Item 'astro_sun_local_astroDawn_start' has been added.
2016-11-18 10:24:34.494 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_astroDawn_start-astro:sun:local:astroDawn#start' has been added.
2016-11-18 10:24:34.508 [ItemAddedEvent            ] - Item 'astro_sun_local_astroDusk_start' has been added.
2016-11-18 10:24:34.510 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_astroDusk_start-astro:sun:local:astroDusk#start' has been added.
2016-11-18 10:24:34.511 [ItemAddedEvent            ] - Item 'astro_sun_local_civilDawn_start' has been added.
2016-11-18 10:24:34.514 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_civilDawn_start-astro:sun:local:civilDawn#start' has been added.
2016-11-18 10:24:34.518 [ItemAddedEvent            ] - Item 'astro_sun_local_civilDusk_start' has been added.
2016-11-18 10:24:34.520 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_civilDusk_start-astro:sun:local:civilDusk#start' has been added.
2016-11-18 10:24:34.532 [ItemAddedEvent            ] - Item 'astro_sun_local_daylight_start' has been added.
2016-11-18 10:24:34.534 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_daylight_start-astro:sun:local:daylight#start' has been added.
2016-11-18 10:24:34.536 [ItemAddedEvent            ] - Item 'astro_sun_local_eveningNight_start' has been added.
2016-11-18 10:24:34.539 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_eveningNight_start-astro:sun:local:eveningNight#start' has been added.
2016-11-18 10:24:34.541 [ItemAddedEvent            ] - Item 'astro_sun_local_morningNight_start' has been added.
2016-11-18 10:24:34.550 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_morningNight_start-astro:sun:local:morningNight#start' has been added.
2016-11-18 10:24:34.552 [ItemAddedEvent            ] - Item 'astro_sun_local_nauticDawn_start' has been added.
2016-11-18 10:24:34.554 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_nauticDawn_start-astro:sun:local:nauticDawn#start' has been added.
2016-11-18 10:24:34.562 [ItemAddedEvent            ] - Item 'astro_sun_local_nauticDusk_start' has been added.
2016-11-18 10:24:34.564 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_nauticDusk_start-astro:sun:local:nauticDusk#start' has been added.
2016-11-18 10:24:34.566 [ItemAddedEvent            ] - Item 'astro_sun_local_night_start' has been added.
2016-11-18 10:24:34.568 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_night_start-astro:sun:local:night#start' has been added.
2016-11-18 10:24:34.570 [ItemAddedEvent            ] - Item 'astro_sun_local_noon_start' has been added.
2016-11-18 10:24:34.572 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_noon_start-astro:sun:local:noon#start' has been added.
2016-11-18 10:24:34.573 [ItemAddedEvent            ] - Item 'astro_sun_local_position_elevation' has been added.
2016-11-18 10:24:34.579 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_position_elevation-astro:sun:local:position#elevation' has been added.
2016-11-18 10:24:34.584 [ItemAddedEvent            ] - Item 'astro_sun_local_rise_start' has been added.
2016-11-18 10:24:34.591 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_rise_start-astro:sun:local:rise#start' has been added.
2016-11-18 10:24:34.596 [ItemAddedEvent            ] - Item 'astro_sun_local_season_autumn' has been added.
2016-11-18 10:24:34.603 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_season_autumn-astro:sun:local:season#autumn' has been added.
2016-11-18 10:24:34.607 [ItemAddedEvent            ] - Item 'astro_sun_local_season_name' has been added.
2016-11-18 10:24:34.610 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_season_name-astro:sun:local:season#name' has been added.
2016-11-18 10:24:34.624 [ItemAddedEvent            ] - Item 'astro_sun_local_season_spring' has been added.
2016-11-18 10:24:34.627 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_season_spring-astro:sun:local:season#spring' has been added.
2016-11-18 10:24:34.631 [ItemAddedEvent            ] - Item 'astro_sun_local_season_summer' has been added.
2016-11-18 10:24:34.633 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_season_summer-astro:sun:local:season#summer' has been added.
2016-11-18 10:24:34.637 [ItemAddedEvent            ] - Item 'astro_sun_local_season_winter' has been added.
2016-11-18 10:24:34.640 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_season_winter-astro:sun:local:season#winter' has been added.
2016-11-18 10:24:34.651 [ItemAddedEvent            ] - Item 'astro_sun_local_set_start' has been added.
2016-11-18 10:24:34.653 [ItemChannelLinkAddedEvent ] - Link 'astro_sun_local_set_start-astro:sun:local:set#start' has been added.
2016-11-18 10:24:39.643 [ThingAddedEvent           ] - Thing 'astro:sun:local' has been added.
2016-11-18 10:24:40.063 [hingStatusInfoChangedEvent] - 'astro:sun:local' changed from UNINITIALIZED to INITIALIZING
2016-11-18 10:24:40.286 [hingStatusInfoChangedEvent] - 'astro:sun:local' changed from INITIALIZING to ONLINE
2016-11-18 10:24:40.773 [ItemCommandEvent          ] - Item 'garage_box_climate_state' received command OFF
2016-11-18 10:24:40.786 [ThingUpdatedEvent         ] - Thing 'astro:sun:local' has been updated.
2016-11-18 10:24:40.845 [ItemCommandEvent          ] - Item 'garage_cellar_climate_state' received command OFF
2016-11-18 10:24:40.847 [ItemStateChangedEvent     ] - garage_room_climate_state changed from NULL to OFF
2016-11-18 10:24:40.853 [ItemStateChangedEvent     ] - garage_box_climate_state changed from NULL to OFF
2016-11-18 10:24:40.892 [ItemStateChangedEvent     ] - garage_cellar_climate_state changed from NULL to OFF
2016-11-18 10:24:41.021 [GroupItemStateChangedEvent] - gTempIn changed from NULL to UNDEF through garage_box_climate_temp
2016-11-18 10:24:41.044 [ItemStateChangedEvent     ] - garage_box_climate_temp changed from NULL to 17.5
2016-11-18 10:24:41.082 [ItemStateChangedEvent     ] - garage_box_climate_humi changed from NULL to 23.800000000000000710542735760100185871124267578125
2016-11-18 10:24:41.093 [GroupItemStateChangedEvent] - gHumiIn changed from NULL to UNDEF through garage_box_climate_humi
2016-11-18 10:24:41.109 [ItemStateChangedEvent     ] - garage_room_climate_temp changed from NULL to 23.300000000000000710542735760100185871124267578125
2016-11-18 10:24:41.134 [ItemStateChangedEvent     ] - garage_room_climate_humi changed from NULL to 22.199999999999999289457264239899814128875732421875
2016-11-18 10:24:41.148 [ItemStateChangedEvent     ] - garage_cellar_climate_temp changed from NULL to 10
2016-11-18 10:24:41.187 [ItemStateChangedEvent     ] - garage_cellar_climate_humi changed from NULL to 11.0999999999999996447286321199499070644378662109375
2016-11-18 10:24:41.208 [ItemStateChangedEvent     ] - garage_street_climate_temp changed from NULL to -24.39999999999999857891452847979962825775146484375
2016-11-18 10:24:41.231 [ItemStateChangedEvent     ] - garage_street_climate_humi changed from NULL to 99.900000000000005684341886080801486968994140625
2016-11-18 10:24:42.500 [ItemStateChangedEvent     ] - astro_sun_local_rise_start changed from NULL to 2016-11-18T08:33:00.000+0800
2016-11-18 10:24:42.516 [ItemStateChangedEvent     ] - sun_rise changed from NULL to 2016-11-18T08:33:00.000+0800
2016-11-18 10:24:42.536 [GroupItemStateChangedEvent] - gAstro changed from NULL to UNDEF through sun_rise
2016-11-18 10:24:42.555 [ItemStateChangedEvent     ] - astro_sun_local_set_start changed from NULL to 2016-11-18T17:05:00.000+0800
2016-11-18 10:24:42.572 [ItemStateChangedEvent     ] - sun_set changed from NULL to 2016-11-18T17:05:00.000+0800
2016-11-18 10:24:42.576 [ItemStateChangedEvent     ] - astro_sun_local_noon_start changed from NULL to 2016-11-18T12:51:00.000+0800
2016-11-18 10:24:42.585 [ItemStateChangedEvent     ] - sun_noon changed from NULL to 2016-11-18T12:51:00.000+0800
2016-11-18 10:24:42.588 [ItemStateChangedEvent     ] - astro_sun_local_night_start changed from NULL to 2016-11-18T19:10:00.000+0800
2016-11-18 10:24:42.634 [ItemStateChangedEvent     ] - sun_night changed from NULL to 2016-11-18T19:10:00.000+0800
2016-11-18 10:24:42.642 [ItemStateChangedEvent     ] - astro_sun_local_morningNight_start changed from NULL to 2016-11-18T00:00:00.000+0800
2016-11-18 10:24:42.647 [ItemStateChangedEvent     ] - astro_sun_local_astroDawn_start changed from NULL to 2016-11-18T06:32:00.000+0800
2016-11-18 10:24:42.669 [ItemStateChangedEvent     ] - sun_astrodawn changed from NULL to 2016-11-18T06:32:00.000+0800
2016-11-18 10:24:42.676 [ItemStateChangedEvent     ] - astro_sun_local_nauticDawn_start changed from NULL to 2016-11-18T07:13:00.000+0800
2016-11-18 10:24:42.684 [ItemStateChangedEvent     ] - astro_sun_local_civilDawn_start changed from NULL to 2016-11-18T07:55:00.000+0800
2016-11-18 10:24:42.693 [ItemStateChangedEvent     ] - astro_sun_local_astroDusk_start changed from NULL to 2016-11-18T18:30:00.000+0800
2016-11-18 10:24:42.712 [ItemStateChangedEvent     ] - astro_sun_local_nauticDusk_start changed from NULL to 2016-11-18T17:48:00.000+0800
2016-11-18 10:24:42.720 [ItemStateChangedEvent     ] - astro_sun_local_civilDusk_start changed from NULL to 2016-11-18T17:09:00.000+0800
2016-11-18 10:24:42.768 [ItemStateChangedEvent     ] - astro_sun_local_eveningNight_start changed from NULL to 2016-11-18T19:10:00.000+0800
2016-11-18 10:24:42.771 [ItemStateChangedEvent     ] - astro_sun_local_daylight_start changed from NULL to 2016-11-18T08:37:00.000+0800
2016-11-18 10:24:42.777 [ItemStateChangedEvent     ] - astro_sun_local_position_elevation changed from NULL to 11.57
2016-11-18 10:24:42.780 [ItemStateChangedEvent     ] - sun_elevation changed from NULL to 11.57
2016-11-18 10:24:42.782 [ItemStateChangedEvent     ] - astro_sun_local_season_name changed from NULL to AUTUMN
2016-11-18 10:24:42.786 [ItemStateChangedEvent     ] - season_name changed from NULL to AUTUMN
2016-11-18 10:24:42.881 [ItemStateChangedEvent     ] - astro_sun_local_season_spring changed from NULL to 2016-03-20T12:31:00.000+0800
2016-11-18 10:24:42.885 [ItemStateChangedEvent     ] - season_spring changed from NULL to 2016-03-20T12:31:00.000+0800
2016-11-18 10:24:42.901 [ItemStateChangedEvent     ] - astro_sun_local_season_autumn changed from NULL to 2016-09-22T22:22:00.000+0800
2016-11-18 10:24:42.905 [ItemStateChangedEvent     ] - season_winter changed from NULL to 2016-12-21T18:45:00.000+0800
2016-11-18 10:24:42.912 [ItemStateChangedEvent     ] - astro_sun_local_season_summer changed from NULL to 2016-06-21T06:35:00.000+0800
2016-11-18 10:24:42.915 [ItemStateChangedEvent     ] - season_summer changed from NULL to 2016-06-21T06:35:00.000+0800
2016-11-18 10:24:42.949 [ItemStateChangedEvent     ] - season_autumn changed from NULL to 2016-09-22T22:22:00.000+0800
2016-11-18 10:24:42.956 [ItemStateChangedEvent     ] - astro_sun_local_season_winter changed from NULL to 2016-12-21T18:45:00.000+0800
2016-11-18 10:24:45.382 [ItemCommandEvent          ] - Item 'garage_street_climate_state' received command ON
2016-11-18 10:24:45.398 [ItemStateChangedEvent     ] - garage_street_climate_state changed from NULL to ON
2016-11-18 10:24:48.056 [ItemStateChangedEvent     ] - garage_street_climate_temp changed from -24.39999999999999857891452847979962825775146484375 to -24.3
2016-11-18 10:24:48.587 [ItemStateChangedEvent     ] - garage_street_climate_humi changed from 99.900000000000005684341886080801486968994140625 to 99.9
2016-11-18 10:24:48.886 [ItemStateChangedEvent     ] - garage_street_climate_press changed from NULL to 737.95974963
2016-11-18 10:24:50.827 [ItemStateChangedEvent     ] - garage_street_climate_press changed from 737.95974963 to 737.975500932
2016-11-18 10:25:00.216 [ItemStateChangedEvent     ] - garage_box_climate_uptime changed from NULL to 1 д. 22:38
2016-11-18 10:25:00.230 [ItemStateChangedEvent     ] - garage_box_climate_humi changed from 23.800000000000000710542735760100185871124267578125 to 23.7
2016-11-18 10:25:00.242 [ItemStateChangedEvent     ] - garage_box_climate_temp changed from 17.5 to 17.6
2016-11-18 10:25:02.298 [ItemStateChangedEvent     ] - garage_box_climate_last_update changed from NULL to 2016-11-18T10:25:02.279+0800
2016-11-18 10:25:05.431 [ItemStateChangedEvent     ] - garage_cellar_climate_humi changed from 11.0999999999999996447286321199499070644378662109375 to 11.8
2016-11-18 10:25:05.611 [ItemStateChangedEvent     ] - garage_cellar_climate_uptime changed from NULL to 1 д. 16:38
2016-11-18 10:25:05.628 [ItemStateChangedEvent     ] - garage_cellar_climate_last_update changed from NULL to 2016-11-18T10:25:05.615+0800
2016-11-18 10:25:16.638 [ItemStateChangedEvent     ] - garage_room_climate_humi changed from 22.199999999999999289457264239899814128875732421875 to 22.2
2016-11-18 10:25:16.642 [ItemStateChangedEvent     ] - garage_room_climate_temp changed from 23.300000000000000710542735760100185871124267578125 to 23.3
2016-11-18 10:25:16.727 [ItemStateChangedEvent     ] - garage_room_climate_uptime changed from NULL to 1 д. 16:38
2016-11-18 10:25:16.752 [ItemStateChangedEvent     ] - garage_room_climate_last_update changed from NULL to 2016-11-18T10:25:16.740+0800
2016-11-18 10:25:42.871 [ItemStateChangedEvent     ] - astro_sun_local_position_elevation changed from 11.57 to 11.66
2016-11-18 10:25:42.886 [ItemStateChangedEvent     ] - sun_elevation changed from 11.57 to 11.66
2016-11-18 10:25:50.838 [ItemStateChangedEvent     ] - garage_street_climate_press changed from 737.975500932 to 737.99350242
2016-11-18 10:26:00.190 [ItemStateChangedEvent     ] - garage_box_climate_uptime changed from 1 д. 22:38 to 1 д. 22:39
2016-11-18 10:26:00.219 [ItemStateChangedEvent     ] - garage_box_climate_last_update changed from 2016-11-18T10:25:02.279+0800 to 2016-11-18T10:26:00.200+0800
2016-11-18 10:26:05.547 [ItemStateChangedEvent     ] - garage_cellar_climate_uptime changed from 1 д. 16:38 to 1 д. 16:39
2016-11-18 10:26:05.580 [ItemStateChangedEvent     ] - garage_cellar_climate_last_update changed from 2016-11-18T10:25:05.615+0800 to 2016-11-18T10:26:05.555+0800
2016-11-18 10:26:16.713 [ItemStateChangedEvent     ] - garage_room_climate_uptime changed from 1 д. 16:38 to 1 д. 16:39
2016-11-18 10:26:16.748 [ItemStateChangedEvent     ] - garage_room_climate_last_update changed from 2016-11-18T10:25:16.740+0800 to 2016-11-18T10:26:16.726+0800
2016-11-18 10:26:42.865 [ItemStateChangedEvent     ] - astro_sun_local_position_elevation changed from 11.66 to 11.75
2016-11-18 10:26:42.869 [ItemStateChangedEvent     ] - sun_elevation changed from 11.66 to 11.75
2016-11-18 10:26:50.209 [ItemStateChangedEvent     ] - garage_street_climate_temp changed from -24.3 to -24.1
2016-11-18 10:26:50.654 [ItemStateChangedEvent     ] - garage_street_climate_uptime changed from NULL to 20:10
2016-11-18 10:26:50.670 [ItemStateChangedEvent     ] - garage_street_climate_last_update changed from NULL to 2016-11-18T10:26:50.660+0800
2016-11-18 10:26:50.837 [ItemStateChangedEvent     ] - garage_street_climate_press changed from 737.99350242 to 737.962749878
2016-11-18 10:27:00.149 [ItemStateChangedEvent     ] - garage_box_climate_uptime changed from 1 д. 22:39 to 1 д. 22:42
2016-11-18 10:27:00.153 [ItemStateChangedEvent     ] - garage_box_climate_humi changed from 23.7 to 23.6
2016-11-18 10:27:00.176 [ItemStateChangedEvent     ] - garage_box_climate_last_update changed from 2016-11-18T10:26:00.200+0800 to 2016-11-18T10:27:00.164+0800
2016-11-18 10:27:05.426 [ItemStateChangedEvent     ] - garage_cellar_climate_humi changed from 11.8 to 11.1
2016-11-18 10:27:05.530 [ItemStateChangedEvent     ] - garage_cellar_climate_uptime changed from 1 д. 16:39 to 1 д. 16:40
2016-11-18 10:27:05.549 [ItemStateChangedEvent     ] - garage_cellar_climate_last_update changed from 2016-11-18T10:26:05.555+0800 to 2016-11-18T10:27:05.540+0800
2016-11-18 10:27:16.639 [ItemStateChangedEvent     ] - garage_room_climate_temp changed from 23.3 to 23.4
2016-11-18 10:27:16.709 [ItemStateChangedEvent     ] - garage_room_climate_uptime changed from 1 д. 16:39 to 1 д. 16:40
2016-11-18 10:27:16.735 [ItemStateChangedEvent     ] - garage_room_climate_last_update changed from 2016-11-18T10:26:16.726+0800 to 2016-11-18T10:27:16.714+0800
2016-11-18 10:27:42.958 [ItemStateChangedEvent     ] - astro_sun_local_position_elevation changed from 11.75 to 11.83
2016-11-18 10:27:42.993 [ItemStateChangedEvent     ] - sun_elevation changed from 11.75 to 11.83
2016-11-18 10:27:50.233 [ItemStateChangedEvent     ] - garage_street_climate_temp changed from -24.1 to -24.2
2016-11-18 10:27:50.682 [ItemStateChangedEvent     ] - garage_street_climate_uptime changed from 20:10 to 20:11
2016-11-18 10:27:50.697 [ItemStateChangedEvent     ] - garage_street_climate_last_update changed from 2016-11-18T10:26:50.660+0800 to 2016-11-18T10:27:50.686+0800
2016-11-18 10:27:50.842 [ItemStateChangedEvent     ] - garage_street_climate_press changed from 737.962749878 to 737.927496964
2016-11-18 10:28:00.134 [ItemStateChangedEvent     ] - garage_box_climate_uptime changed from 1 д. 22:42 to 1 д. 22:41
2016-11-18 10:28:00.159 [ItemStateChangedEvent     ] - garage_box_climate_last_update changed from 2016-11-18T10:27:00.164+0800 to 2016-11-18T10:28:00.148+0800
2016-11-18 10:28:05.529 [ItemStateChangedEvent     ] - garage_cellar_climate_uptime changed from 1 д. 16:40 to 1 д. 16:41
2016-11-18 10:28:05.562 [ItemStateChangedEvent     ] - garage_cellar_climate_last_update changed from 2016-11-18T10:27:05.540+0800 to 2016-11-18T10:28:05.546+0800
2016-11-18 10:28:16.630 [ItemStateChangedEvent     ] - garage_room_climate_humi changed from 22.2 to 22.3
2016-11-18 10:28:16.744 [ItemStateChangedEvent     ] - garage_room_climate_uptime changed from 1 д. 16:40 to 1 д. 16:41
2016-11-18 10:28:16.770 [ItemStateChangedEvent     ] - garage_room_climate_last_update changed from 2016-11-18T10:27:16.714+0800 to 2016-11-18T10:28:16.756+0800
2016-11-18 10:28:42.836 [ItemStateChangedEvent     ] - astro_sun_local_position_elevation changed from 11.83 to 11.92
2016-11-18 10:28:42.839 [ItemStateChangedEvent     ] - sun_elevation changed from 11.83 to 11.92
2016-11-18 10:28:50.216 [ItemStateChangedEvent     ] - garage_street_climate_temp changed from -24.2 to -24.3
2016-11-18 10:28:50.690 [ItemStateChangedEvent     ] - garage_street_climate_uptime changed from 20:11 to 20:12
2016-11-18 10:28:50.718 [ItemStateChangedEvent     ] - garage_street_climate_last_update changed from 2016-11-18T10:27:50.686+0800 to 2016-11-18T10:28:50.704+0800
2016-11-18 10:28:50.859 [ItemStateChangedEvent     ] - garage_street_climate_press changed from 737.927496964 to 737.90349498
2016-11-18 10:29:00.117 [ItemStateChangedEvent     ] - garage_box_climate_uptime changed from 1 д. 22:41 to 1 д. 22:44
2016-11-18 10:29:00.148 [ItemStateChangedEvent     ] - garage_box_climate_last_update changed from 2016-11-18T10:28:00.148+0800 to 2016-11-18T10:29:00.129+0800
2016-11-18 10:29:05.426 [ItemStateChangedEvent     ] - garage_cellar_climate_humi changed from 11.1 to 11.6
2016-11-18 10:29:05.454 [ItemStateChangedEvent     ] - garage_cellar_climate_temp changed from 10 to 10.1
2016-11-18 10:29:05.544 [ItemStateChangedEvent     ] - garage_cellar_climate_uptime changed from 1 д. 16:41 to 1 д. 16:42
2016-11-18 10:29:05.562 [ItemStateChangedEvent     ] - garage_cellar_climate_last_update changed from 2016-11-18T10:28:05.546+0800 to 2016-11-18T10:29:05.547+0800
2016-11-18 10:29:16.697 [ItemStateChangedEvent     ] - garage_room_climate_uptime changed from 1 д. 16:41 to 1 д. 16:42
2016-11-18 10:29:16.718 [ItemStateChangedEvent     ] - garage_room_climate_last_update changed from 2016-11-18T10:28:16.756+0800 to 2016-11-18T10:29:16.701+0800
2016-11-18 10:29:42.855 [ItemStateChangedEvent     ] - astro_sun_local_position_elevation changed from 11.92 to 12.00
2016-11-18 10:29:42.860 [ItemStateChangedEvent     ] - sun_elevation changed from 11.92 to 12.00
2016-11-18 10:29:50.668 [ItemStateChangedEvent     ] - garage_street_climate_uptime changed from 20:12 to 20:13
2016-11-18 10:29:50.694 [ItemStateChangedEvent     ] - garage_street_climate_last_update changed from 2016-11-18T10:28:50.704+0800 to 2016-11-18T10:29:50.684+0800
2016-11-18 10:29:50.847 [ItemStateChangedEvent     ] - garage_street_climate_press changed from 737.90349498 to 737.865241818

openhab.log

2016-11-18 10:24:11.186 [INFO ] [egram.internal.TelegramActionService] - Bot bot1 loaded from config file
2016-11-18 10:24:27.452 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'router.items'
2016-11-18 10:24:27.820 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'rrd4j.persist'
2016-11-18 10:24:27.911 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'astro.items'
2016-11-18 10:24:28.000 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'climate.items'
2016-11-18 10:24:31.095 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'last_update.rules'
2016-11-18 10:24:33.107 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'garage.sitemap'
2016-11-18 10:24:33.835 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'astro.things'
2016-11-18 10:24:37.995 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2016-11-18 10:24:38.643 [INFO ] [assic.internal.servlet.WebAppServlet] - Started Classic UI at /classicui/app
2016-11-18 10:24:39.063 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /ui
2016-11-18 10:24:39.432 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
2016-11-18 10:24:40.431 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type JS
2016-11-18 10:24:40.443 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type JS
2016-11-18 10:24:40.452 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type JS
2016-11-18 10:24:40.454 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type JS
2016-11-18 10:24:40.480 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2016-11-18 10:24:40.483 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mqtt-loc'
2016-11-18 10:24:40.583 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2016-11-18 10:24:40.866 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mqtt-net'
2016-11-18 10:24:42.328 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro DailyJob at midnight for thing astro:sun:local
2016-11-18 10:24:42.342 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro PositionalJob with interval of 60 seconds for thing astro:sun:local
2016-11-18 10:24:42.723 [INFO ] [ding.astro.handler.AstroThingHandler] - Deleting astro PositionalJob for thing 'astro:sun:local'
2016-11-18 10:24:42.724 [INFO ] [ding.astro.handler.AstroThingHandler] - Deleting astro DailyJob for thing 'astro:sun:local'
2016-11-18 10:24:42.728 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro DailyJob at midnight for thing astro:sun:local
2016-11-18 10:24:42.754 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro PositionalJob with interval of 60 seconds for thing astro:sun:local
2016-11-18 10:24:48.031 [ERROR] [.mqtt.internal.MqttMessageSubscriber] - Error processing MQTT message.
org.openhab.core.transform.TransformationException: An error occured while executing script.
	at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:63)[195:org.openhab.core.compat1x:2.0.0.201611152358]
	at org.openhab.binding.mqtt.internal.MqttMessageSubscriber.processMessage(MqttMessageSubscriber.java:138)[194:org.openhab.binding.mqtt:1.9.0.201611130211]
	at org.openhab.io.transport.mqtt.internal.MqttBrokerConnection.messageArrived(MqttBrokerConnection.java:552)[196:org.openhab.io.transport.mqtt:1.9.0.201611130211]
	at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:336)[196:org.openhab.io.transport.mqtt:1.9.0.201611130211]
	at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:148)[196:org.openhab.io.transport.mqtt:1.9.0.201611130211]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]
2016-11-18 10:24:50.706 [ERROR] [.mqtt.internal.MqttMessageSubscriber] - Error processing MQTT message.
org.openhab.core.transform.TransformationException: An error occured while executing script.
	at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:63)[195:org.openhab.core.compat1x:2.0.0.201611152358]
	at org.openhab.binding.mqtt.internal.MqttMessageSubscriber.processMessage(MqttMessageSubscriber.java:138)[194:org.openhab.binding.mqtt:1.9.0.201611130211]
	at org.openhab.io.transport.mqtt.internal.MqttBrokerConnection.messageArrived(MqttBrokerConnection.java:552)[196:org.openhab.io.transport.mqtt:1.9.0.201611130211]
	at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:336)[196:org.openhab.io.transport.mqtt:1.9.0.201611130211]
	at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:148)[196:org.openhab.io.transport.mqtt:1.9.0.201611130211]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]
2016-11-18 10:25:50.673 [ERROR] [.mqtt.internal.MqttMessageSubscriber] - Error processing MQTT message.
org.openhab.core.transform.TransformationException: An error occured while executing script.
	at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform(TransformationHelper.java:63)[195:org.openhab.core.compat1x:2.0.0.201611152358]
	at org.openhab.binding.mqtt.internal.MqttMessageSubscriber.processMessage(MqttMessageSubscriber.java:138)[194:org.openhab.binding.mqtt:1.9.0.201611130211]
	at org.openhab.io.transport.mqtt.internal.MqttBrokerConnection.messageArrived(MqttBrokerConnection.java:552)[196:org.openhab.io.transport.mqtt:1.9.0.201611130211]
	at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:336)[196:org.openhab.io.transport.mqtt:1.9.0.201611130211]
	at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:148)[196:org.openhab.io.transport.mqtt:1.9.0.201611130211]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]

Sorry, that is not so. I’m very bad with English.
PS I do not know how to insert a piece of log and configuration file.

Thanks!

I’m sorry, I do not know where to look version.
It is very likely that there is?
/var/lib/openhab2/etc/branding.propertis
I have here - 590
Thanks!

The only thing I can see is that the JavaScript assumes that input is in the format of a valid number, and if it’s not, the JavaScript will fail. Since the incoming MQTT message could be a string in any format (including having leading or trailing whitespace, use the unaccepted , for the decimal place instead of the accepted ., etc.), your JavaScript should probably sanity check input to make sure it’s a valid number before using it as one. If it’s not a valid number, perhaps return a special answer like -9999 to indicate that the transformation could not be performed.

Thank you! The problem was my carelessness.

(function(seconds){
    var days = Math.floor(seconds / 86400);
    seconds -= days * 86400;
    var hours = Math.floor(seconds / 3600);
    seconds -= hours * 3600;
    var minutes = Math.floor(seconds / 60);
    seconds -= minutes * 60;

    if (days > 0) { days = days + ' d. '; }
    **if(minutes < 10) { min = min + '0'; }**

    return days + hours + ':' + minutes;
})(input)
**if(minutes < 10) { minutes = '0' + minutes ; }**

Thanks again for your help and your time.

It’s so easy to miss the small details – happens to everyone! Glad you found it!

Hello! I’ll ask again, when openhab2 service launch, in warning log:

08:40:04.963 [INFO ] [egram.internal.TelegramActionService] - Bot bot1 loaded from config file
08:40:17.736 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'router.items'
08:40:18.083 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'astro.items'
08:40:18.159 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'climate.items'
08:40:18.330 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'rrd4j.persist'
08:40:21.418 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'last_update.rules'
08:40:23.032 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'garage.sitemap'
08:40:23.641 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'astro.things'
08:40:27.489 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
08:40:27.919 [INFO ] [assic.internal.servlet.WebAppServlet] - Started Classic UI at /classicui/app
08:40:28.340 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /ui
08:40:28.535 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
**08:40:29.361 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type JS**
**08:40:29.382 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type JS**
**08:40:29.385 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type JS**
**08:40:29.396 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type JS**
08:40:29.444 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
08:40:29.462 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mqtt-loc'
08:40:29.552 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
08:40:29.802 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mqtt-net'
08:40:31.499 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro DailyJob at midnight for thing astro:sun:local
08:40:31.508 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro PositionalJob with interval of 300 seconds for thing astro:sun:local

At work, it does not affect mine, apparently, something did not have time to boot, it’s okay, or I can set up something is not right?

Thanks!

PS Looks like they say here about the same.