Logo! Timer configuration from OpenHAB 3.2

Hi,
In my Logo! program, I’m using some Timer functions and want to configure them from an OpenHAB page.
I can define the days, the activation and deactivation times but I’m facing an issue when trying to disable an activation/deactivation time.
To check the time enabled flag, I check the time value from the Logo! is different -1 as it seems to be the value returned in this case. But when I want to disable a time, I send a command with the value -1 but the time is not disabled and the value stays unchanged.
I would really appreciate help.
Thanks

Maybe some details about that. Is that part something to do with openHAB? Who’s sending what to who, and how, and what do you get instead of what you expected?

Hi rossko57,
Here are some more details:
.things file

Thing datetime    VW32            "Pool: Prog 1 - Step 2 - Activation time" @ "Pool"      [ block="VW32", type="time", force=false ]

.items file

DateTime    pool_prog1_step2_on                 "Pool: Prog1 - Step 2 - Time ON [%1$tH:%1$tM]"      ( gPoolProg1Step2Time )         { channel="plclogo:datetime:plc_pool:VW32:time", stateDescription=""[pattern="%1$tH:%1$tM"] }
Number      pool_prog1_step2_on_status          "Pool: Prog1 - Step 2 - Time ON status"             ( gPoolProg1Step2Time )         { channel="plclogo:datetime:plc_pool:VW32:value" }
Switch      pool_prog1_step2_on_enabled         "Pool: Prog1 - Step 2 - Time ON enabled"            ( gPoolProg1Step2Time )         { channel="plclogo:datetime:plc_pool:VW32:value"[profile="transform:JS", function="plclogo_getTimeStatus.js"] }

A script line used to try to disable the time on:

items.getItem('pool_prog1_step2_on_status').sendCommand(-1);

I also tried with a postUpdate:

items.getItem('pool_prog1_step2_on_status').postUpdate(-1);

The status item is well set to -1 but in the Logo! PLC, the status of the time is still ‘enabled’ with the previously defined time (thus no change).
If I set force to ‘true’ in the thing, the status is set back to the previous time as a value.

Hope this clarifies my request

If you want the binding to do something, you must use command.

Hmm. I don’t suppose the binding likes you trying to define a time as -1, but thats the end of my knowledge about Logo!
Brief discussion of manipulating timers here, but no mention of ‘disable’

Thanks for your answers.
Effectively, command is the right way to proceed but after all the tests I made, postUpdate was just one more test.
I found few discussions about plclogo and the thread you mention is for openHAB 2 and I think a lot of improvements have been done in version 3.

I made some more tests with another timer configured as follow:
.things

Thing datetime    VW51            "Pool: Prog 2 - Step 2 - Activation time" @ "Pool"      [ block="VW51", type="time", force=false ]
Thing memory      VW51M           "Pool: Prog 2 - Step 2 - Activation time" @ "Pool"      [ block="VW51", threshold=0, force=false ]

.items

DateTime pool_prog2_step2_on                 "Pool: Prog2 - Step 2 - Time ON [%1$tH:%1$tM]"      ( gPoolProg2Step2Time )         { channel="plclogo:datetime:plc_pool:VW51:time", stateDescription=""[pattern="%1$tH:%1$tM"] }
Number      pool_prog2_step2_on_status          "Pool: Prog2 - Step 2 - Time ON status"             ( gPoolProg2Step2Time )         { channel="plclogo:memory:plc_pool:VW51M:value" }
Switch      pool_prog2_step2_on_enabled         "Pool: Prog2 - Step 2 - Time ON enabled"            ( gPoolProg2Step2Time )         { channel="plclogo:memory:plc_pool:VW51M:value"[profile="transform:JS", function="plclogo_getTimeStatus.js"] }

If I try to send the commands:

items.getItem('pool_prog2_step2_on_status').sendCommand(1797);

and

items.getItem('pool_prog2_step2_on_status').sendCommand(-1);

it doesn’t work (same behavior as previously) but if I comment the DateTime item pool_prog2_step2_on then it works.
Maybe is it difficult to have two items pointing to the same Logo! memory location with different formats (DateTime and Number)?
Working with one item should be possible but it will require more complex script code (currently managed by the binding) :frowning:

So far as I can make out, the actual exchange between openHAB and Logo is carried out in a BCD coded block. The date/time channels just facilitate converting the BCD to OH internal datetime format. The number channel allows you see raw data in BCD I think? The implication is that you would need to command it with BCD too. If the binding even supports commands to that channel.

Yes, I can read and send command with the raw data. It’s a little more work but I think today I dont’ have another solution. Maybe in the future, the binding will provide a way to enable/disable a timer.
I’ll let you know when done and integrated in my application.

I don’t really understand the concept. A datetime is a datetime,it doesn’t have enabled or disabled properties. Maybe you need your Logo timer program to have an on/off channel.

The Logo! stores the time in BCD as a Word. If the value is -1 (FFFF) that means the timer is disabled. If different, that means the timer is enabled and the BCD value can be converted to DateTime. One value from the Logo! has thus two meanings: enabled/disabled and time value (if enabled).