openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.56k forks source link

Remote OpenHab Issue with Federated Docker OH3-OH2 Not Properly Updating #9190

Closed jsiemon closed 3 years ago

jsiemon commented 3 years ago

Binding Name

OpenHAB Remote Binding

Expected Behavior

Bi-directional link between OH2 and OH3 Items.

Current Behavior

I have noticed an issue that continues to plague its use in my setup. I am trying to link my OH2 2.5.9 setup with OH3 M3. Both are running in Dockers on the same UnRaid server on the same subnet (br0) with unique IPs and ports set to 8080. OH2 has been working flawlessly for almost 2 yrs now. I have an extensive ISY/Insteon installation that OH2 automates and for which there is no OH3 binding as of today. I am able to link OH3 to OH2 and control OH2 Things/Items from OH3. However any changes made to Items using OH2 are not reflected in my linked Items in OH3. Going the other direction OH3 to OH2 works fine and changes are properly reflected in both OH2 and OH3. My understanding is that the binding is bi-directional, but in my setup it appears to only be OH3 -> OH2, not OH2-> OH3. If I restart OH3 then changes made in OH2 prior to the restart seem to be reflected, but no real time updates seem to happen. This issue seems to affect dimmer type switches mostly. Simple ON/Off switches seem to get updated correctly most of the time.

My Items are created using text based files. For this exercise/example to demonstrate the issue I am using a dimmer for fireplace lighting. The Item declaration is the same for both OH2 and OH3.

Item Definitions and Logs

OH 2 Item:

Dimmer v2A35C71FireplaceLoadLevel "Fireplace Lighting" (Group_HabPanel_Dashboard, PubItems_CMD, gLighting, gFamilyRoom) ["WallSwitch"]

OH3 Item:

Dimmer v2A35C71FireplaceLoadLevel "Fireplace Lighting" (Group_HabPanel_Dashboard, PubItems_CMD, gLighting, gFamilyRoom) ["WallSwitch"]

When Issuing a command from OH2 to adjust the Fireplace Light I see these events in the OH2.events log Turning it OFF from 73% state then turning on to 73% state.

2020-11-29 12:33:10.909 [vent.ItemStateChangedEvent] - v2A35C71FireplaceLoadLevel changed from 73 to 0 2020-11-29 12:33:20.923 [vent.ItemStateChangedEvent] - v2A35C71FireplaceLoadLevel changed from 0 to 73 The corresponding OH2.log entry is

2020-11-29 12:33:10.901 [TRACE] [sy.internal.IsyWebSocketSubscription] - Parsing message: [<?xml version="1.0"?>DOF02A 35 C7 1] 2020-11-29 12:33:10.902 [DEBUG] [sy.internal.IsyWebSocketSubscription] - Node '2A 35 C7 1' got control message 'DOF' action '0' 2020-11-29 12:33:10.903 [DEBUG] [binding.isy.handler.IsyBridgeHandler] - onModelChanged called, control: DOF, action: 0, var event: null 2020-11-29 12:33:10.903 [TRACE] [binding.isy.handler.IsyBridgeHandler] - find thing handler for address: 2A 35 C7 1 2020-11-29 12:33:10.904 [TRACE] [binding.isy.handler.IsyBridgeHandler] - Find thing for address: 2A 35 C7 2020-11-29 12:33:10.904 [TRACE] [binding.isy.handler.IsyBridgeHandler] - address: 2A 35 C7 2020-11-29 12:33:10.904 [DEBUG] [binding.isy.handler.IsyDeviceHandler] - handleUpdate called, control: DOF , action: 0 , node:2A 35 C7 1 2020-11-29 12:33:10.905 [TRACE] [sy.internal.IsyWebSocketSubscription] - Parsing message: [<?xml version="1.0"?>ST02A 35 C7 1] 2020-11-29 12:33:10.906 [DEBUG] [sy.internal.IsyWebSocketSubscription] - Node '2A 35 C7 1' got control message 'ST' action '0' 2020-11-29 12:33:10.906 [DEBUG] [binding.isy.handler.IsyBridgeHandler] - onModelChanged called, control: ST, action: 0, var event: null 2020-11-29 12:33:10.907 [TRACE] [binding.isy.handler.IsyBridgeHandler] - find thing handler for address: 2A 35 C7 1 2020-11-29 12:33:10.907 [TRACE] [binding.isy.handler.IsyBridgeHandler] - Find thing for address: 2A 35 C7 2020-11-29 12:33:10.908 [TRACE] [binding.isy.handler.IsyBridgeHandler] - address: 2A 35 C7 2020-11-29 12:33:10.908 [DEBUG] [binding.isy.handler.IsyDeviceHandler] - handleUpdate called, control: ST , action: 0 , node:2A 35 C7 1 2020-11-29 12:33:10.909 [TRACE] [sy.internal.IsyWebSocketSubscription] - Parsing message: [<?xml version="1.0"?>_13[ 2A 35 C7 1] DOF 0] 2020-11-29 12:33:10.909 [DEBUG] [pdb.internal.MapDBPersistenceService] - store called for v2A35C71FireplaceLoadLevel 2020-11-29 12:33:10.909 [DEBUG] [sy.internal.IsyWebSocketSubscription] - Node 'n/a' got control message '_1' action '3' 2020-11-29 12:33:10.910 [TRACE] [sy.internal.IsyWebSocketSubscription] - Parsing message: [<?xml version="1.0"?>_13[ 2A 35 C7 1] ST 0] 2020-11-29 12:33:10.911 [DEBUG] [pdb.internal.MapDBPersistenceService] - Stored 'v2A35C71FireplaceLoadLevel' with state '0' in mapdb database 2020-11-29 12:33:10.911 [DEBUG] [sy.internal.IsyWebSocketSubscription] - Node 'n/a' got control message '_1' action '3'

2020-11-29 12:33:20.915 [TRACE] [sy.internal.IsyWebSocketSubscription] - Parsing message: [<?xml version="1.0"?>DON02A 35 C7 1] 2020-11-29 12:33:20.917 [DEBUG] [sy.internal.IsyWebSocketSubscription] - Node '2A 35 C7 1' got control message 'DON' action '0' 2020-11-29 12:33:20.917 [DEBUG] [binding.isy.handler.IsyBridgeHandler] - onModelChanged called, control: DON, action: 0, var event: null 2020-11-29 12:33:20.918 [TRACE] [binding.isy.handler.IsyBridgeHandler] - find thing handler for address: 2A 35 C7 1 2020-11-29 12:33:20.918 [TRACE] [binding.isy.handler.IsyBridgeHandler] - Find thing for address: 2A 35 C7 2020-11-29 12:33:20.918 [TRACE] [binding.isy.handler.IsyBridgeHandler] - address: 2A 35 C7 2020-11-29 12:33:20.919 [DEBUG] [binding.isy.handler.IsyDeviceHandler] - handleUpdate called, control: DON , action: 0 , node:2A 35 C7 1 2020-11-29 12:33:20.919 [TRACE] [sy.internal.IsyWebSocketSubscription] - Parsing message: [<?xml version="1.0"?>ST1882A 35 C7 1] 2020-11-29 12:33:20.920 [DEBUG] [sy.internal.IsyWebSocketSubscription] - Node '2A 35 C7 1' got control message 'ST' action '188' 2020-11-29 12:33:20.920 [DEBUG] [binding.isy.handler.IsyBridgeHandler] - onModelChanged called, control: ST, action: 188, var event: null 2020-11-29 12:33:20.921 [TRACE] [binding.isy.handler.IsyBridgeHandler] - find thing handler for address: 2A 35 C7 1 2020-11-29 12:33:20.921 [TRACE] [binding.isy.handler.IsyBridgeHandler] - Find thing for address: 2A 35 C7 2020-11-29 12:33:20.921 [TRACE] [binding.isy.handler.IsyBridgeHandler] - address: 2A 35 C7 2020-11-29 12:33:20.921 [DEBUG] [binding.isy.handler.IsyDeviceHandler] - handleUpdate called, control: ST , action: 188 , node:2A 35 C7 1 2020-11-29 12:33:20.922 [TRACE] [sy.internal.IsyWebSocketSubscription] - Parsing message: [<?xml version="1.0"?>_13[ 2A 35 C7 1] DON 0] 2020-11-29 12:33:20.922 [DEBUG] [sy.internal.IsyWebSocketSubscription] - Node 'n/a' got control message '_1' action '3' 2020-11-29 12:33:20.923 [DEBUG] [pdb.internal.MapDBPersistenceService] - store called for v2A35C71FireplaceLoadLevel 2020-11-29 12:33:20.923 [TRACE] [sy.internal.IsyWebSocketSubscription] - Parsing message: [<?xml version="1.0"?>_13[ 2A 35 C7 1] ST 188] 2020-11-29 12:33:20.924 [DEBUG] [sy.internal.IsyWebSocketSubscription] - Node 'n/a' got control message '_1' action '3' 2020-11-29 12:33:20.924 [DEBUG] [pdb.internal.MapDBPersistenceService] - Stored 'v2A35C71FireplaceLoadLevel' with state '73' in mapdb database The OH3.events.log I’m not seeing an entry it is set to INFO just like the OH2 OH3.Log is

020-11-29 12:33:10.909 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Received event name message date {"topic":"smarthome/items/v2A35C71FireplaceLoadLevel/state","payload":"{\"type\":\"OnOff\",\"value\":\"OFF\"}","type":"ItemStateEvent"} 2020-11-29 12:33:10.910 [DEBUG] [l.handler.RemoteopenhabBridgeHandler] - Unexpected value type OnOff for item v2A35C71FireplaceLoadLevel 2020-11-29 12:33:10.910 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Received event name message date {"topic":"smarthome/items/v2A35C71FireplaceLoadLevel/statechanged","payload":"{\"type\":\"Percent\",\"value\":\"0\",\"oldType\":\"Percent\",\"oldValue\":\"73\"}","type":"ItemStateChangedEvent"} 2020-11-29 12:33:10.910 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Ignored event type ItemStateChangedEvent for topic smarthome/items/v2A35C71FireplaceLoadLevel/statechanged

2020-11-29 12:33:20.923 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Received event name message date {"topic":"smarthome/items/v2A35C71FireplaceLoadLevel/state","payload":"{\"type\":\"Percent\",\"value\":\"73\"}","type":"ItemStateEvent"} 2020-11-29 12:33:20.924 [DEBUG] [l.handler.RemoteopenhabBridgeHandler] - updateState remoteopenhab:server:openhab25x:v2A35C71FireplaceLoadLevel with 73 2020-11-29 12:33:20.924 [TRACE] [internal.events.ThreadedEventHandler] - inspect event: org.osgi.service.event.Event [topic=openhab] {topic=openhab/items/v2A35C71FireplaceLoadLevel/state, source=remoteopenhab:server:openhab25x:v2A35C71FireplaceLoadLevel, type=ItemStateEvent, payload={"type":"Percent","value":"73"}, timestamp=1606671200924} 2020-11-29 12:33:20.924 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Received event name message date {"topic":"smarthome/items/v2A35C71FireplaceLoadLevel/statechanged","payload":"{\"type\":\"Percent\",\"value\":\"73\",\"oldType\":\"Percent\",\"oldValue\":\"0\"}","type":"ItemStateChangedEvent"} 2020-11-29 12:33:20.924 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Ignored event type ItemStateChangedEvent for topic smarthome/items/v2A35C71FireplaceLoadLevel/statechanged 2020-11-29 12:33:20.925 [TRACE] [ab.core.internal.items.ExpireManager] - Received '73' for item v2A35C71FireplaceLoadLevel

Just to put a final point on this, if I change the state of the Fireplace Light from OH3 I do get an event in the OH3events.log as shown below, and the light dims as expected.

2020-11-29 12:58:47.127 [ome.event.ItemCommandEvent] - Item 'v2A35C71FireplaceLoadLevel' received command 20 2020-11-29 12:58:47.156 [vent.ItemStateChangedEvent] - Item 'v2A35C71FireplaceLoadLevel' changed from 73 to 20

lolodomo commented 3 years ago

Do you encounter this problem only for items managed by the unofficial Isy binding ? What other bindings ?

Can you tell me what Isy thing type and what channel your item is linked to ?

The strange thing in your logs is that you received an ItemStateEvent event with OFF rather than 0. I think it could be due the way the binding is implemented. It updates the channel state with an OnOffType state even when the channel is not a Switch. https://github.com/HentschelT/openhab2-addons/blob/master/addons/binding/org.openhab.binding.isy/src/main/java/org/openhab/binding/isy/handler/IsyDeviceHandler.java#L76

The problem could be due to this unusual way to update the channel state and could explain why I never encountered it and can't reproduce it in practice.

My idea is to consider ItemStateChangedEvent in addition to ItemStateEvent to cover these cases. I just have to be sure that it will not produce regression.

jsiemon commented 3 years ago

The issue occurs only with my Dimmers. It is not only the OFF/ON state but any changes made to the state of the Dimmer after it is initially set. So if I set the Dimmer initially to 73% and then change it to 25% using OH2, OH3 is not updated to 25%. If I set it to OFF (0%) using OH2 It is also not updated in OH3. However, if I use OH3 to initaie the changes to the Dimmer from 73% to 25% or OFF(0%) then it does seem to work, with changes reflected in OH3 and OH2. The Dimmer seems to be the only effected Thing/Item. Simple contacts, set points and switches ( all ISY) seem to work fine. When changes are made to these items using OH2 the changes seem to be reflected in OH3 in my tests.

On 12/02/2020 3:08 AM lolodomo <notifications@github.com> wrote:

Do you encounter this problem only for items managed by the unofficial Isy binding ? What other bindings ?

Can you tell me what Isy thing type and what channel your item is linked to ?

The strange thing in your logs is that you received an ItemStateEvent event with OFF rather than 0. I think it could be due the way the binding is implemented. It updates the channel state with an OnOffType state even when the channel is not a Switch.
https://github.com/HentschelT/openhab2-addons/blob/master/addons/binding/org.openhab.binding.isy/src/main/java/org/openhab/binding/isy/handler/IsyDeviceHandler.java#L76

The problem could be due to this unusual way to update the channel state and could explain why I never encountered it and can't reproduce it in practice.
My idea is to consider ItemStateChangedEvent in addition to ItemStateEvent. I just have to be sure that it will not produce regression.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/openhab/openhab-addons/issues/9190#issuecomment-737065513 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTLT3ISGGK2ICZPD5KM6JTSSXYY3ANCNFSM4UIGOGIA .
lolodomo commented 3 years ago

Is it only with Isy binding or not ? What thing type and what channel?

Please provide the remote openHAB logs when changing from 73 to 25 from within OH2.

I have dimmers with the Z-wave binding and I did not notice your problem.

My feeling is more something specific to the Isy binding that is uncommon in the way to update channels state.

jsiemon commented 3 years ago

Yes. It is only the ISY binding because for me that is the only binding that is not available for OH3 and for which I need Remote OpenHAB. As shown below the Thing is a DIMMER. and Channel is Load Level. I will generate some logs for both OH3 and OH2 that show changes when going from approximately 73% to approximately 25% to confirm my observation. Thanks for your continued help.

2A.35.C7.1 Fireplace

Light Dimmer Controls dimmable loads


Status: ONLINE

Channels

Load Level

isy:dimmer:c12b6000:2A_35_C7:loadlevel Dimmer

Linked Items Fireplace Lighting (v2A35C71FireplaceLoadLevel) edit delete


On 12/02/2020 11:19 AM lolodomo <notifications@github.com> wrote:

Is it only with Isy binding or not ?
What thing type and what channel?

Please provide the remote openHAB logs when changing from 73 to 25 from within OH2.

I have dimmers with the Z-wave binding and I did not notice your problem.

My feeling us more something specific to the Isy binding that us unusual

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/openhab/openhab-addons/issues/9190#issuecomment-737336677 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTLT3IVTVEQRDVOPATG2OLSSZSI3ANCNFSM4UIGOGIA .
jsiemon commented 3 years ago

lolodomo: I have attached some logs below for my OH2 and OH3 installs. I am puzzled because this time changing the level from 73 to 34 using OH2 was reflected in both OH2 and OH3 HOWEVER, when I turned the light OFF using OH2 the change was not reflected in OH3. It seems the problem is very specific to the OFF State and that I am wrong about a simple level change not being reflected in Both OH2 and OH3.

OH2 Log

2020-12-02 13:04:18.141 [DEBUG] [pdb.internal.MapDBPersistenceService] - store called for v2A35C71FireplaceLoadLevel 2020-12-02 13:04:18.142 [DEBUG] [pdb.internal.MapDBPersistenceService] - Stored 'v2A35C71FireplaceLoadLevel' with state '0' in mapdb database 2020-12-02 13:04:20.814 [DEBUG] [pdb.internal.MapDBPersistenceService] - store called for v2A35C71FireplaceLoadLevel 2020-12-02 13:04:20.815 [DEBUG] [pdb.internal.MapDBPersistenceService] - Stored 'v2A35C71FireplaceLoadLevel' with state '73' in mapdb database 2020-12-02 13:04:29.806 [DEBUG] [pdb.internal.MapDBPersistenceService] - store called for v2A35C71FireplaceLoadLevel 2020-12-02 13:04:29.808 [DEBUG] [pdb.internal.MapDBPersistenceService] - Stored 'v2A35C71FireplaceLoadLevel' with state '34' in mapdb database

2020-12-02 13:09:06.162 [DEBUG] [pdb.internal.MapDBPersistenceService] - store called for v2A35C71FireplaceLoadLevel 2020-12-02 13:09:06.163 [DEBUG] [pdb.internal.MapDBPersistenceService] - Stored 'v2A35C71FireplaceLoadLevel' with state '0' in mapdb database OH3 Log

2020-12-02 13:04:18.141 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Received event name message date {"topic":"smarthome/items/v2A35C71FireplaceLoadLevel/state","payload":"{\"type\":\"OnOff\",\"value\":\"OFF\"}","type":"ItemStateEvent"} 2020-12-02 13:04:18.142 [DEBUG] [l.handler.RemoteopenhabBridgeHandler] - Unexpected value type OnOff for item v2A35C71FireplaceLoadLevel 2020-12-02 13:04:18.142 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Received event name message date {"topic":"smarthome/items/v2A35C71FireplaceLoadLevel/statechanged","payload":"{\"type\":\"Percent\",\"value\":\"0\",\"oldType\":\"Percent\",\"oldValue\":\"32\"}","type":"ItemStateChangedEvent"} 2020-12-02 13:04:18.143 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Ignored event type ItemStateChangedEvent for topic smarthome/items/v2A35C71FireplaceLoadLevel/statechanged 2020-12-02 13:04:20.813 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Received event name message date {"topic":"smarthome/items/v2A35C71FireplaceLoadLevel/state","payload":"{\"type\":\"Percent\",\"value\":\"73\"}","type":"ItemStateEvent"} 2020-12-02 13:04:20.814 [TRACE] [internal.events.ThreadedEventHandler] - inspect event: org.osgi.service.event.Event [topic=openhab] {topic=openhab/items/v2A35C71FireplaceLoadLevel/state, source=remoteopenhab:server:openhab25x:v2A35C71FireplaceLoadLevel, type=ItemStateEvent, payload={"type":"Percent","value":"73"}, timestamp=1606932260814} 2020-12-02 13:04:20.814 [DEBUG] [l.handler.RemoteopenhabBridgeHandler] - updateState remoteopenhab:server:openhab25x:v2A35C71FireplaceLoadLevel with 73 2020-12-02 13:04:20.815 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Received event name message date {"topic":"smarthome/items/v2A35C71FireplaceLoadLevel/statechanged","payload":"{\"type\":\"Percent\",\"value\":\"73\",\"oldType\":\"Percent\",\"oldValue\":\"0\"}","type":"ItemStateChangedEvent"} 2020-12-02 13:04:20.815 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Ignored event type ItemStateChangedEvent for topic smarthome/items/v2A35C71FireplaceLoadLevel/statechanged 2020-12-02 13:04:20.816 [TRACE] [ab.core.internal.items.ExpireManager] - Received '73' for item v2A35C71FireplaceLoadLevel 2020-12-02 13:04:20.816 [TRACE] [internal.events.ThreadedEventHandler] - inspect event: org.osgi.service.event.Event [topic=openhab] {topic=openhab/items/v2A35C71FireplaceLoadLevel/statechanged, type=ItemStateChangedEvent, payload={"type":"Percent","value":"73","oldType":"Percent","oldValue":"32"}, timestamp=1606932260815} 2020-12-02 13:04:29.806 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Received event name message date {"topic":"smarthome/items/v2A35C71FireplaceLoadLevel/state","payload":"{\"type\":\"Percent\",\"value\":\"34\"}","type":"ItemStateEvent"} 2020-12-02 13:04:29.807 [DEBUG] [l.handler.RemoteopenhabBridgeHandler] - updateState remoteopenhab:server:openhab25x:v2A35C71FireplaceLoadLevel with 34 2020-12-02 13:04:29.807 [TRACE] [internal.events.ThreadedEventHandler] - inspect event: org.osgi.service.event.Event [topic=openhab] {topic=openhab/items/v2A35C71FireplaceLoadLevel/state, source=remoteopenhab:server:openhab25x:v2A35C71FireplaceLoadLevel, type=ItemStateEvent, payload={"type":"Percent","value":"34"}, timestamp=1606932269807} 2020-12-02 13:04:29.807 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Received event name message date {"topic":"smarthome/items/v2A35C71FireplaceLoadLevel/statechanged","payload":"{\"type\":\"Percent\",\"value\":\"34\",\"oldType\":\"Percent\",\"oldValue\":\"73\"}","type":"ItemStateChangedEvent"} 2020-12-02 13:04:29.808 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Ignored event type ItemStateChangedEvent for topic smarthome/items/v2A35C71FireplaceLoadLevel/statechanged 2020-12-02 13:04:29.809 [TRACE] [ab.core.internal.items.ExpireManager] - Received '34' for item v2A35C71FireplaceLoadLevel 2020-12-02 13:04:29.810 [TRACE] [internal.events.ThreadedEventHandler] - inspect event: org.osgi.service.event.Event [topic=openhab] {topic=openhab/items/v2A35C71FireplaceLoadLevel/statechanged, type=ItemStateChangedEvent, payload={"type":"Percent","value":"34","oldType":"Percent","oldValue":"73"}, timestamp=1606932269808}

2020-12-02 13:09:06.162 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Received event name message date {"topic":"smarthome/items/v2A35C71FireplaceLoadLevel/state","payload":"{\"type\":\"OnOff\",\"value\":\"OFF\"}","type":"ItemStateEvent"} 2020-12-02 13:09:06.162 [DEBUG] [l.handler.RemoteopenhabBridgeHandler] - Unexpected value type OnOff for item v2A35C71FireplaceLoadLevel 2020-12-02 13:09:06.163 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Received event name message date {"topic":"smarthome/items/v2A35C71FireplaceLoadLevel/statechanged","payload":"{\"type\":\"Percent\",\"value\":\"0\",\"oldType\":\"Percent\",\"oldValue\":\"84\"}","type":"ItemStateChangedEvent"} 2020-12-02 13:09:06.163 [TRACE] [nternal.rest.RemoteopenhabRestClient] - Ignored event type ItemStateChangedEvent for topic smarthome/items/v2A35C71FireplaceLoadLevel/statechanged

On 12/02/2020 12:50 PM jsiemon <jsiemon@comcast.net> wrote:

Yes.  It is only the ISY binding because for me that is the only binding that is not available for OH3 and for which I need Remote OpenHAB. As shown below the Thing is a DIMMER. and Channel is Load Level. I will generate some logs for both OH3 and OH2  that show changes when going from approximately 73% to approximately 25% to confirm my observation. Thanks for your continued help.

2A.35.C7.1 Fireplace

Light Dimmer
Controls dimmable loads

---------------------------------------------
Status: ONLINE

Channels

Load Level

isy:dimmer:c12b6000:2A_35_C7:loadlevel
Dimmer

Linked Items
Fireplace Lighting (v2A35C71FireplaceLoadLevel)
edit delete

---------------------------------------------

    > >         On 12/02/2020 11:19 AM lolodomo <notifications@github.com> wrote:
    Is it only with Isy binding or not ?
    What thing type and what channel?

    Please provide the remote openHAB logs when changing from 73 to 25 from within OH2.

    I have dimmers with the Z-wave binding and I did not notice your problem.

    My feeling us more something specific to the Isy binding that us unusual

    —
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHub https://github.com/openhab/openhab-addons/issues/9190#issuecomment-737336677 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTLT3IVTVEQRDVOPATG2OLSSZSI3ANCNFSM4UIGOGIA .

> 
lolodomo commented 3 years ago

@kaikreuzer : here I need your knowledge about the core framework. Imagine you have a thing channel with item type set to Dimmer.

<channel-type id="loadLevel">
        <item-type>Dimmer</item-type>
        <label>Load Level</label>
        <description>Increase/decrease the load level</description>
        <category>DimmableLoad</category>
        <state min="0" max="100" pattern="%d %%" />
    </channel-type>

Of course, this is expected to send a percent command or even an ON/OFF command to this item. No problem.

But is it normal that the binding updates this channel state not always with a PercentType state but sometimes with an OnOffType state ? In case it is correct, can you tell me what is the sequence of events (ItemStateEvent and ItemStateChangedEvent) that will be produced on the event bus when the binding sets the channel state to OFF (while the previous state was 73%) ? I am expecting to always receive a PercentType as ItemStateEvent and ItemStateChangedEvent if the value changed ? Is it correct ? I am asking even if apprently the answer is no.

lolodomo commented 3 years ago

I studied what happens if I handle ItemStateChangedEvent in addition to ItemStateEvent. As expected, in standard cases, it means the item is updated twice by the binding (one for each event) and if you have a rule with a trigger "received update" on this item, you rule will be run twice rather than once with the current implementation. This was the reason to ignore ItemStateChangedEvent. Unfortunately, it looks like my current solution could lead to missed state changes with bindings that I would consider as badly implemented. I don't know exactly what to do. I would like to have the opinion of an expert of the core framework to tell me if a binding like the Isy binding is really badly implemented or not. My current idea would be to add a configuration setting to the remote OH binding channel to let the user decide if he wants to consider ItemStateChangedEvent for this item. By default, if would be false. This could be set to true for Isy dimmer channels.

lolodomo commented 3 years ago

Another solution could be to cache/save the last channel state in the remote OH binding and to update the channel state when receiving an ItemStateChangedEvent event only if the state is different. I prefer that solution. This should work with the Isy binding and normally should change nothing for any bindings triggering ItemStateEvent and ItemStateChangedEvent with the same state data.

lolodomo commented 3 years ago

I love the solution I found :)

jsiemon commented 3 years ago

I'm not sure that ISY/Insteon binding is poorly implemented as you suggest,. The DIMMER hardware is multifunctional so the way the binding is implemented may be necessary to catch all of the possible ways the hardware is used. I don't know, just a thought. Nevertheless, your proposed solution seems to be a reasonable solution. Will this create any issues with persistence through restarts? Let me know when you are ready to test this approach and thanks again for your effort.

On 12/05/2020 7:26 AM lolodomo <notifications@github.com> wrote:

Another solution could be to cache/save the last channel state in the remote OH binding and to update the channel state when receiving an ItemStateChangedEvent event only if the state is different.
I prefer that solution.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/openhab/openhab-addons/issues/9190#issuecomment-739244433 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTLT3KK57DKH3TWNLHNTSLSTIRHPANCNFSM4UIGOGIA .
lolodomo commented 3 years ago

No link with persistence management.