Fatek binding

Please look into your events.log if you have change published by binding.

Pleas add such items (if you don’t have):

Number plc_second "PLC second [%d s]"  { fatekplc="plc:R4128" }
Number plc_minute "PLC minute [%d m]"  { fatekplc="plc:R4129" }
Number plc_1mscnt "PLC 1ms count [%d]" { fatekplc="plc:+R4151" }

Contnet of R4151 is increased by 1 every 1mS by PLC.

Refresh option is time to sleep between each read, so we need some time to read data from PLC, and this time depends on how many items you have, your network, system performance and so on.

And next look into events.log, I have for refresh=100

2016-11-26 17:35:59.971 [ItemStateChangedEvent     ] - plc_second changed from 58 to 59
2016-11-26 17:35:59.971 [ItemStateChangedEvent     ] - plc_1mscnt changed from 18339 to 18446
2016-11-26 17:36:00.091 [ItemStateChangedEvent     ] - plc_1mscnt changed from 18446 to 18561
2016-11-26 17:36:00.211 [ItemStateChangedEvent     ] - plc_1mscnt changed from 18561 to 18680
2016-11-26 17:36:00.311 [ItemStateChangedEvent     ] - plc_1mscnt changed from 18680 to 18786
2016-11-26 17:36:00.431 [ItemStateChangedEvent     ] - plc_1mscnt changed from 18786 to 18900
2016-11-26 17:36:00.531 [ItemStateChangedEvent     ] - plc_1mscnt changed from 18900 to 19006
2016-11-26 17:36:00.641 [ItemStateChangedEvent     ] - plc_1mscnt changed from 19006 to 19120
2016-11-26 17:36:00.793 [ItemStateChangedEvent     ] - plc_1mscnt changed from 19120 to 19269
2016-11-26 17:36:00.903 [ItemStateChangedEvent     ] - plc_second changed from 59 to 0
2016-11-26 17:36:00.903 [ItemStateChangedEvent     ] - plc_minute changed from 35 to 36
2016-11-26 17:36:00.913 [ItemStateChangedEvent     ] - plc_1mscnt changed from 19269 to 19380
2016-11-26 17:36:01.013 [ItemStateChangedEvent     ] - plc_1mscnt changed from 19380 to 19489
2016-11-26 17:36:01.123 [ItemStateChangedEvent     ] - plc_1mscnt changed from 19489 to 19602
2016-11-26 17:36:01.233 [ItemStateChangedEvent     ] - plc_1mscnt changed from 19602 to 19708
2016-11-26 17:36:01.343 [ItemStateChangedEvent     ] - plc_1mscnt changed from 19708 to 19821
2016-11-26 17:36:01.471 [ItemStateChangedEvent     ] - plc_1mscnt changed from 19821 to 19943
2016-11-26 17:36:01.581 [ItemStateChangedEvent     ] - plc_1mscnt changed from 19943 to 20057
2016-11-26 17:36:01.701 [ItemStateChangedEvent     ] - plc_1mscnt changed from 20057 to 20171
2016-11-26 17:36:01.821 [ItemStateChangedEvent     ] - plc_1mscnt changed from 20171 to 20292
2016-11-26 17:36:01.942 [ItemStateChangedEvent     ] - plc_second changed from 0 to 1

As you see each pool take little more than 100ms.

So there is something wrong in my case, because with refresh set to 100ms I get:
2016-11-27 20:19:24.303 [ItemStateChangedEvent ] - plc_second changed from 0 to 2
2016-11-27 20:19:25.706 [ItemStateChangedEvent ] - plc_1mscnt changed from 26184 to 27692
2016-11-27 20:19:25.799 [ItemStateChangedEvent ] - plc_second changed from 2 to 3
2016-11-27 20:19:27.231 [ItemStateChangedEvent ] - plc_1mscnt changed from 27692 to 29222
2016-11-27 20:19:27.324 [ItemStateChangedEvent ] - plc_second changed from 3 to 5
2016-11-27 20:19:28.755 [ItemStateChangedEvent ] - plc_1mscnt changed from 29222 to 30744
2016-11-27 20:19:28.848 [ItemStateChangedEvent ] - plc_second changed from 5 to 7
2016-11-27 20:19:30.280 [ItemStateChangedEvent ] - plc_1mscnt changed from 30744 to 32273
2016-11-27 20:19:30.383 [ItemStateChangedEvent ] - plc_second changed from 7 to 8
2016-11-27 20:19:31.791 [ItemStateChangedEvent ] - plc_1mscnt changed from 32273 to 33782
2016-11-27 20:19:31.886 [ItemStateChangedEvent ] - plc_second changed from 8 to 10
2016-11-27 20:19:33.313 [ItemStateChangedEvent ] - plc_1mscnt changed from 33782 to 35304
2016-11-27 20:19:33.407 [ItemStateChangedEvent ] - plc_second changed from 10 to 11
2016-11-27 20:19:34.819 [ItemStateChangedEvent ] - plc_1mscnt changed from 35304 to 36813
2016-11-27 20:19:34.999 [ItemStateChangedEvent ] - plc_second changed from 11 to 13
2016-11-27 20:19:36.601 [ItemStateChangedEvent ] - plc_1mscnt changed from 36813 to 38593
2016-11-27 20:19:36.701 [ItemStateChangedEvent ] - plc_second changed from 13 to 14
2016-11-27 20:19:38.135 [ItemStateChangedEvent ] - plc_1mscnt changed from 38593 to 40122
2016-11-27 20:19:38.241 [ItemStateChangedEvent ] - plc_second changed from 14 to 16

So I get 15 times worse performance than it should be, so around 1200 to 1600 ms. You get ~115ms.

What’s the reason? It was far more better before :-/

To see some more details you can set log level to TRACE for com.gitgub.s4u.jfatek
in OH2 console:

log:set TRACE com.gitgub.s4u.jfatek

I see in openhab.log:

2016-11-27 21:23:32.922 [TRACE] [com.github.s4u.jfatek.io.FatekWriter] - write:
        -> ^B0A4803R04128R04129R0415132^C
2016-11-27 21:23:32.932 [TRACE] [com.github.s4u.jfatek.io.FatekReader] - read:
        <- ^B0A48000200017026061^C
2016-11-27 21:23:32.932 [DEBUG] [com.github.s4u.jfatek.FatekCommand  ] - Process command ID: 0x48 work time: 10 ms
2016-11-27 21:23:33.032 [TRACE] [com.github.s4u.jfatek.io.FatekWriter] - write:
        -> ^B0A4803R04128R04129R0415132^C
2016-11-27 21:23:33.052 [TRACE] [com.github.s4u.jfatek.io.FatekReader] - read:
        <- ^B0A4800020001702D06F^C
2016-11-27 21:23:33.052 [DEBUG] [com.github.s4u.jfatek.FatekCommand  ] - Process command ID: 0x48 work time: 20 ms

How many items do you have in your configuration.?
In my test OH2 I have only 3 items.

In standard configuration I have about 40-50 items. I’m testing it now. I’ve made clean install of latest OH2 snapshot and put there only these 3 “number” items. With this configuration I’m getting about 215ms. Still too much I guess. I run it on Pine64.
I need some time for tests.

So…
I’ve made some measurements.

Clean installation on Pine64 for 3 Number items as you specified above gives me ~177ms
Additional 20 items (so 23 items in total) gives me ~320ms
Additional 20 items (so 43 in total) gives ~430ms
Additional 11 items with JS transformation (just: Math.round((input/100)*10)/10) (so 54 in total) gives ~1100ms

This is HUGE performance decrease.
Removing items doesn’t unload them, only restart works.
I have this feeling that it was far more effective before.
Any hints?

Hi @slawekjaranowski. I hope you’re doing well! Do you still develop the Fatek binding? I would ask if this is possible to enhance it with possibility to make connections via serial (USB). Also I would like to ask if you have any plans to adjust it to openhab2 “thing” based concept. Cheers!

2 Likes

Hi,
I am really need your helps,
I have this fatek plc:

And I dont understand how to add my plc to openHAB.
The plc connect to the intenet and i can see the ip on the fatek app,I installed the fatek binding but i cant see nothing in the openHUB.
If someone can explaine me how to add the plc it will be great.
Ty

@Dor pleas start new topic …
Please let we know what you did yourself.
if possible show us your config files:

  • services/fatekplc.cfg
  • items/*.items
  • sitemaps/*.sitemap

Ty!