Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
syntacrscS

syntacrsc

@syntacrsc
About
Posts
11
Topics
2
Shares
0
Groups
0
Followers
0
Following
1

Posts

Recent Best Controversial

  • OH3 - MySensors Binding
    syntacrscS syntacrsc

    @Chacha
    Same here, I use MySensors to control rollershutters, pool pump, HVAC and solar panels.

    Maybe we should collect some volunteers for a bounty to give to @TimO to enhance his beautiful mySensors binding to work with the recent OH 3.1.0 version??
    @Peter-Loeffler
    I used to use plain MQTT before I found the mySensors binding and don't really want go back to it.

    I'd be willing to throw 100 USD into the bounty pot to enhance MySensors to work with the recent version of OH3...
    (I'd do it myself if I'd know how to ;-) )

    OpenHAB

  • OH3 - MySensors Binding
    syntacrscS syntacrsc

    P.S.:
    Prior to upgrading from OH 3.0.2 to OH 3.1.0 everything worked fine...

    OpenHAB

  • OH3 - MySensors Binding
    syntacrscS syntacrsc

    Hi all.

    Did anyone upgrade to OH 3.1.0 stable and managed to get the MySensors Binding 3.1.0 running yet?
    Sind I've upgraded to OH 3.1.0 I'm getting the following error messages in the log when starting the openhab service:

    I'm using a MySensors Ethernet Gateway (no MQTT, although that souldn't really make a difference) and a raspberry pi 4b+ as OH 3 server.

    2021-07-04 10:37:43.376 [ERROR] [Events.Framework                    ] - FrameworkEvent ERROR
    org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.mysensors [237]
      Unresolved requirement: Import-Package: org.apache.commons.lang; version="[2.6.0,3.0.0)"
    	at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.16.200.jar:?]
    	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1845) ~[org.eclipse.osgi-3.16.200.jar:?]
    	at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136) ~[org.eclipse.osgi-3.16.200.jar:?]
    	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1838) ~[org.eclipse.osgi-3.16.200.jar:?]
    	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1781) ~[org.eclipse.osgi-3.16.200.jar:?]
    	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1743) ~[org.eclipse.osgi-3.16.200.jar:?]
    	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1665) ~[org.eclipse.osgi-3.16.200.jar:?]
    	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) ~[org.eclipse.osgi-3.16.200.jar:?]
    	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) [org.eclipse.osgi-3.16.200.jar:?]
    	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345) [org.eclipse.osgi-3.16.200.jar:?]
    

    and then a little further down the log:

    2021-07-04 10:38:04.300 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.mysensors-3.1.0.jar
    org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.mysensors [237]
      Unresolved requirement: Import-Package: org.apache.commons.lang; version="[2.6.0,3.0.0)"
    	at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.16.200.jar:?]
    	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:440) ~[org.eclipse.osgi-3.16.200.jar:?]
    	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.8]
    	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.8]
    	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [bundleFile:3.6.8]
    	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [bundleFile:3.6.8]
    	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.8]
    	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.8]
    

    Any help is highly appreciated!

    Thanks and kind regards,
    Ralph...

    OpenHAB

  • OH3 - MySensors Binding
    syntacrscS syntacrsc

    @TimO
    Thanks a lot for the updated version of the openHAB Binding (jar file) for openHAB 3.
    It seems to be working well on OH 3- just perfomed some initial testing on my OH3 (3.0.0) test system.

    Also I feel it might be a good idea adding a link to the new 3.1.0 jar file to the "official" Install Instruction on https://www.mysensors.org/controller/openhab - don't you agree?

    OpenHAB

  • OpenHAB MySensors binding 2.5: V_VAR1 and String values
    syntacrscS syntacrsc

    Dividing the value sent by the node to the controller by 100 did not help at all - still no way to send any value other than 0 or 1 back from the node to the controller.
    Sending a 10 causes the error "Value must be between 0 and 100".

    No clue how to fix that - any help is highly appreciated!

    The issue with the mapping within the item label not working on paper UI seems to be related to paper UI - apparently it does not support that type of mapping.
    Showing the item value in HABpanel the mapping seems to be working fine.

    OpenHAB openhab

  • OpenHAB MySensors binding 2.5: V_VAR1 and String values
    syntacrscS syntacrsc

    Thanks for pointing me into that direction - that seems like a feasable way to achieve what I'm looking for.

    What I'm experiencing now though is when the node sends e.g. value 10 I get error:

    java.lang.IllegalArgumentException: Value must be between 0 and 100
    

    (see below for more log detail)
    I changed the MySensors code on the node to divide the reason-code by 100 (e.g. 10 / 100) before sending it back the controller - that seems to be working (weird though).

    send(Jalousien[IncomingMessage.sensor - 1].MessageCommandReason.set(Jalousien[IncomingMessage.sensor - 1].CommandReason / 100.0, 0), false);
    

    Next problem I'm facing is with the mapping. Even though I've "Map Transformation" installed the mapping as you suggested it does not really work for me.
    Here's what I've tried so far (first entry should be exactly as you suggested):

    Items:

    Number          BueroRalphJalousieReason1                   "Variant1 [MAP(blinds.map):%s]" { channel="mysensors:cover:gateway:BueroRalphJalousie:var5" }
    String          BueroRalphJalousieReason2                   "Variant2 [MAP(blinds.map):%s]" { channel="mysensors:cover:gateway:BueroRalphJalousie:var5" }
    String          BueroRalphJalousieReason3                   "Variant3 [%s]"     (grp_Jalousien_SuedOstSeite_Reason) { channel="mysensors:cover:gateway:BueroRalphJalousie:var5" [profile="transform:MAP", function="blinds.map"]  } 
    

    Mapping file blinds.map:

    NULL=initial
    0=initial
    10=Closed for Sunset
    11=Closed for Sun Protection
    12=Closed for Sleeping
    13=Closed for Alexa Command
    14=Closed for User Command
    15=Closed for Security
    16=Closed for Privacy
    17=Closed for Migraine
    18=Closed due to schedule
    
    30=Open for Sunrise
    31=Open Ended Sun Protection
    32=Open for Wakeup
    33=Open for Alexa Command
    34=Open for User Command
    35=Open for Security
    36=Open for No Privacy
    37=Open for end of Migraine 
    38=Open due to schedule
    
    initial = 0
    Closed for Sunset = 10
    Closed for Sun Protection = 11
    Closed for Sleeping = 12
    Closed for Alexa Command = 13
    Closed for User Command = 14
    Closed for Securitry = 15
    Closed for Privacy = 16
    Closed for Migraine = 17
    Closed due to schedule = 18
    
    Open for Sunrise = 30
    Open Sun Protection Ended = 31
    Open for Wakeup = 32
    Open for Alexa Command = 34
    Open for User Command = 35
    Open for Securitry = 36
    Open for No Privacy = 37 
    open end of Migraine = 38 
    open due to schedule = 39
    
    

    Result in Paper UI:
    cover.JPG

    The only transformation working seems to be when applying the mapping to the channel (variant 3) - am I missing anything here?

    Thanks and kind regards,
    Ralph...

    Finally here's the detail on the error I'm getting realted to "Value must be between 0 and 100":

    2020-06-05 12:50:00.755 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 7;4;2;0;28;
    2020-06-05 12:50:00.787 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 7;4;1;0;28;10
    2020-06-05 12:50:00.791 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 7 found in gateway
    2020-06-05 12:50:00.795 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 4 found in node 7
    2020-06-05 12:50:00.799 [DEBUG] [ensors.handler.MySensorsThingHandler] - Updating channel: var5(V_VAR5) value to: 10
    2020-06-05 12:50:00.804 [ERROR] [nternal.event.MySensorsEventRegister] - Event broadcasting throw an exception
    java.lang.IllegalArgumentException: Value must be between 0 and 100
    	at org.eclipse.smarthome.core.library.types.PercentType.validateValue(PercentType.java:57) ~[?:?]
    	at org.eclipse.smarthome.core.library.types.PercentType.<init>(PercentType.java:52) ~[?:?]
    	at org.eclipse.smarthome.core.library.types.DecimalType.as(DecimalType.java:152) ~[?:?]
    	at org.eclipse.smarthome.core.internal.items.ItemStateConverterImpl.convertToAcceptedState(ItemStateConverterImpl.java:64) ~[?:?]
    	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.sendUpdate(ProfileCallbackImpl.java:134) ~[?:?]
    	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onStateUpdateFromHandler(SystemDefaultProfile.java:53) ~[?:?]
    	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.lambda$9(CommunicationManager.java:467) ~[?:?]
    	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.lambda$11(CommunicationManager.java:487) ~[?:?]
    	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_252]
    	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.handleCallFromHandler(CommunicationManager.java:483) ~[?:?]
    	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.stateUpdated(CommunicationManager.java:465) ~[?:?]
    	at org.eclipse.smarthome.core.thing.internal.ThingManagerImpl$1.stateUpdated(ThingManagerImpl.java:168) ~[?:?]
    	at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.updateState(BaseThingHandler.java:245) ~[?:?]
    	at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.updateState(BaseThingHandler.java:264) ~[?:?]
    	at org.openhab.binding.mysensors.handler.MySensorsThingHandler.handleChildUpdateEvent(MySensorsThingHandler.java:305) ~[?:?]
    	at org.openhab.binding.mysensors.handler.MySensorsThingHandler.sensorUpdateEvent(MySensorsThingHandler.java:221) ~[?:?]
    	at org.openhab.binding.mysensors.internal.event.MySensorsEventRegister.lambda$4(MySensorsEventRegister.java:130) ~[?:?]
    	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_252]
    	at org.openhab.binding.mysensors.internal.event.MySensorsEventRegister.notifyNodeUpdateEvent(MySensorsEventRegister.java:126) ~[?:?]
    	at org.openhab.binding.mysensors.internal.gateway.MySensorsGateway.handleSetReqMessage(MySensorsGateway.java:564) ~[?:?]
    	at org.openhab.binding.mysensors.internal.gateway.MySensorsGateway.handleIncomingMessage(MySensorsGateway.java:462) ~[?:?]
    	at org.openhab.binding.mysensors.internal.gateway.MySensorsGateway.messageReceived(MySensorsGateway.java:375) ~[?:?]
    	at org.openhab.binding.mysensors.internal.event.MySensorsEventRegister.lambda$1(MySensorsEventRegister.java:87) ~[?:?]
    	at java.lang.Iterable.forEach(Iterable.java:75) [?:1.8.0_252]
    	at org.openhab.binding.mysensors.internal.event.MySensorsEventRegister.notifyMessageReceived(MySensorsEventRegister.java:83) [bundleFile:?]
    	at org.openhab.binding.mysensors.internal.protocol.MySensorsAbstractConnection$MySensorsReader.run(MySensorsAbstractConnection.java:362) [bundleFile:?]
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_252]
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_252]
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
    	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
    

    To me the implementation of V_VAR handling in the openHAB mySensors binding seems odd - values for V_VAR1 thru V_VAR5 appear to be handled like percentage types where a 10 means 0.10.

    I will try to send 0.10 instead of 10 from the node to the controller and my guess is that it will work then.

    OpenHAB openhab

  • OpenHAB MySensors binding 2.5: V_VAR1 and String values
    syntacrscS syntacrsc

    Hello MySensors community.

    I'm using OpenHAB MySensors binding 2.5 and would like to have my node (window cover controller) send a string on one of the V_VAR channels e.g. V_VAR5 back to the controller.
    Intention:
    Basically whenever I send a command to the node from the controller I intend to send a "reason" (or mode) to the node along with the command itself e.g. "Closed for sun protection" or "Closed for sleeping" or "Opened due to sunrise"...
    This reason should be kept on the node and send beck to the controller on request e.g. after a restart of the controller (as a response to a message of type = C_REQ).
    This way I could restart the controller and have it not only request cover positions but also the reason (or mode) that brought them into that position.

    Problem:
    My problem with that is that apparently the OpenHAB MySensor binding does only support numeric values being transported from the nodes to the controller via V_VAR1 - V_VAR5 channels even though the Serial API of MySensors does allow string values for V_VAR1 to V_VAR5.

    Is there a solution to that problem, should the binding be changed?
    How else could I achive what I'm trying to do?

    Here's the log entry of the request I'm sending from OpenHAB rule to the node:

    2020-06-03 21:04:00.518 [DEBUG] [rsAbstractConnection$MySensorsWriter] - Sending to MySensors: 7;4;2;0;28;
    

    And the log entries (errors) caused by the nodes response (the node sends the string "initial"):

    2020-06-03 21:04:00.548 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 7;4;1;0;28;initial
    2020-06-03 21:04:00.551 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Node 7 found in gateway
    2020-06-03 21:04:00.553 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 4 found in node 7
    2020-06-03 21:04:00.560 [ERROR] [nternal.event.MySensorsEventRegister] - Event broadcasting throw an exception
    java.lang.NumberFormatException: null
    	at java.math.BigDecimal.<init>(BigDecimal.java:497) ~[?:1.8.0_252]
    	at java.math.BigDecimal.<init>(BigDecimal.java:383) ~[?:1.8.0_252]
    	at java.math.BigDecimal.<init>(BigDecimal.java:809) ~[?:1.8.0_252]
    	at org.eclipse.smarthome.core.library.types.DecimalType.<init>(DecimalType.java:56) ~[?:?]
    	at org.openhab.binding.mysensors.converter.MySensorsDecimalTypeConverter.fromString(MySensorsDecimalTypeConverter.java:31) ~[?:?]
    	at org.openhab.binding.mysensors.converter.MySensorsTypeConverter.stateFromChannel(MySensorsTypeConverter.java:37) ~[?:?]
    	at org.openhab.binding.mysensors.handler.MySensorsThingHandler.handleChildUpdateEvent(MySensorsThingHandler.java:301) ~[?:?]
    	at org.openhab.binding.mysensors.handler.MySensorsThingHandler.sensorUpdateEvent(MySensorsThingHandler.java:221) ~[?:?]
    	at org.openhab.binding.mysensors.internal.event.MySensorsEventRegister.lambda$4(MySensorsEventRegister.java:130) ~[?:?]
    	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_252]
    	at org.openhab.binding.mysensors.internal.event.MySensorsEventRegister.notifyNodeUpdateEvent(MySensorsEventRegister.java:126) ~[?:?]
    	at org.openhab.binding.mysensors.internal.gateway.MySensorsGateway.handleSetReqMessage(MySensorsGateway.java:564) ~[?:?]
    	at org.openhab.binding.mysensors.internal.gateway.MySensorsGateway.handleIncomingMessage(MySensorsGateway.java:462) ~[?:?]
    	at org.openhab.binding.mysensors.internal.gateway.MySensorsGateway.messageReceived(MySensorsGateway.java:375) ~[?:?]
    	at org.openhab.binding.mysensors.internal.event.MySensorsEventRegister.lambda$1(MySensorsEventRegister.java:87) ~[?:?]
    	at java.lang.Iterable.forEach(Iterable.java:75) [?:1.8.0_252]
    	at org.openhab.binding.mysensors.internal.event.MySensorsEventRegister.notifyMessageReceived(MySensorsEventRegister.java:83) [bundleFile:?]
    	at org.openhab.binding.mysensors.internal.protocol.MySensorsAbstractConnection$MySensorsReader.run(MySensorsAbstractConnection.java:362) [bundleFile:?]
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_252]
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_252]
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
    	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
    

    Any help is highly appreciated.

    Thanks and kind regards,
    Ralph...

    OpenHAB openhab

  • openHAB 2.5 binding and V_VARx
    syntacrscS syntacrsc

    Solved it by changing the definition (typeId) of both V_VAR1 and V_VAR2 in the binding file for S_Cover (.XML file in folder /usr/share/openhab -> org.openhab.binding.mysensors-2.5.0-SNAPSHOT.jar -> ESH-INF/thing/S_Cover.xml) from "var1-channel" resp. "var2-channel" to "cover-channel" (see XML excerpt below).
    This allows me to setup two additional rollershutter items to control the tilt of the cover blade (V_VAR1 = single tilt and V_VAR2 = tripple tilt at a time) and to send back the position of the tilt blades stored in the node to openHAB.

    Items:

    Rollershutter   BueroRalphJalousieAufAb                      "Auf/ab"   { channel="mysensors:cover:gateway:BueroRalphJalousie:cover", 
    Rollershutter   BueroRalphJalousieTilt                           "Tilt"         { channel="mysensors:cover:gateway:BueroRalphJalousie:var1" } 
    Rollershutter   BueroRalphJalousieTilt3X                       "3x Tilt"    { channel="mysensors:cover:gateway:BueroRalphJalousie:var2" }  
    

    **Binding .XML file in folder /usr/share/openhab -> org.openhab.binding.mysensors-2.5.0-SNAPSHOT.jar -> ESH-INF/thing/S_Cover.xml
    I changed from:

    <channel id="var1" typeId="var1-channel" />
    <channel id="var2" typeId="var2-channel" />**
    

    to

    <channel id="var1" typeId="cover-channel" />
    <channel id="var2" typeId="cover-channel" />
    

    like this:

    <thing:thing-descriptions bindingId="mysensors"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
    	xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
    
    	<thing-type id="cover">
    		<supported-bridge-type-refs>
    			<bridge-type-ref id="bridge-ser" />
    			<bridge-type-ref id="bridge-eth" />
                <bridge-type-ref id="bridge-mqtt" />
    		</supported-bridge-type-refs>
    
    		<label>RollerShutter</label>
    		<description>RollerShutter</description>
    
    		<channels>
    			<channel id="cover" typeId="cover-channel" />
    			<channel id="var1" typeId="cover-channel" />
    			<channel id="var2" typeId="cover-channel" />
    			<channel id="var3" typeId="var3-channel" />
    			<channel id="var4" typeId="var4-channel" />
    			<channel id="var5" typeId="var5-channel" />
    			<channel id="battery" typeId="battery-channel" />
    			<channel id="lastupdate" typeId="lastupdate-channel" />
    		</channels>
    
    		<config-description>
    			<parameter name="nodeId" typ...
    

    mySensors code (excerpt):

    //     Prepare Messages:
    			Jalousien[i - 1].MessageStatusAufAb.setSensor(Jalousien[i - 1].RaumNummer);		//ChildID
    			Jalousien[i - 1].MessageStatusAufAb.setType(V_PERCENTAGE);						//UpDown-Position
    			Jalousien[i - 1].MessageStatusTilt.setSensor(Jalousien[i - 1].RaumNummer);		//ChildID
    			Jalousien[i - 1].MessageStatusTilt.setType(V_VAR1);								//Tilt-Position
    			Jalousien[i - 1].MessageStatusTilt3X.setSensor(Jalousien[i - 1].RaumNummer);	//ChildID
    			Jalousien[i - 1].MessageStatusTilt3X.setType(V_VAR2);							//Tilt3x-Position
    ...
    ...
    //	Neuen Zustand an Controller melden / Send cover and tilt positions back to controller:	
    	send(Jalousien[i - 1].MessageStatusTilt.set((Jalousien[i - 1].StatusTilt / Jalousien[i - 1].TiltSchritte), 2), false);
    	send(Jalousien[i - 1].MessageStatusTilt3X.set((Jalousien[i - 1].StatusTilt / Jalousien[i - 1].TiltSchritte), 2), false);
    	send(Jalousien[i - 1].MessageStatusAufAb.set(Jalousien[i - 1].StatusAufAb, 0), false);
    
    

    Make sure to send the V_PERCENTAGE last since V_VAR1 and V_VAR2 for some unknown reason (and as far as I feel totally unnecessarily) still updates V_PERCENTAGE!

    Result:
    VAR_issue2.jpg

    OpenHAB

  • openHAB 2.5 binding and V_VARx
    syntacrscS syntacrsc

    It's getting more and more wierd:
    Just changed the mySensors code to send a fixed value e.g. 0.14 on V_VAR4

    send(Jalousien[i - 1].MessageStatusTilt.set(float(0.14), 2), false);
    

    Result in openHAB is that the rollershutter value shows as 14 and the item connected to channel VAR4 shows as 0.14 (see screen shot).
    Apprently all the VAR channels are connected to the cover channel in the openHAB mySensors binding.
    That doesn't seem correct to me.
    ??
    VAR_issue.jpg

    OpenHAB

  • openHAB 2.5 binding and V_VARx
    syntacrscS syntacrsc

    I missed to append the log excerpt with the error message:

    2020-05-26 10:21:35.268 [DEBUG] [rs.internal.gateway.MySensorsGateway] - Child 4 found in node 7
    2020-05-26 10:21:35.273 [DEBUG] [ensors.handler.MySensorsThingHandler] - **Updating channel: var4(V_VAR4) value to: 3**
    2020-05-26 10:21:35.277 [ERROR] [nternal.event.MySensorsEventRegister] - Event broadcasting throw an exception
    java.lang.IllegalArgumentException: **Value must be between 0 and 100**
    	at org.eclipse.smarthome.core.library.types.PercentType.validateValue(PercentType.java:57) ~[?:?]
    	at org.eclipse.smarthome.core.library.types.PercentType.<init>(PercentType.java:52) ~[?:?]
    	at org.eclipse.smarthome.core.library.types.DecimalType.as(DecimalType.java:152) ~[?:?]
    	at org.eclipse.smarthome.core.internal.items.ItemStateConverterImpl.convertToAcceptedState(ItemStateConverterImpl.java:64) ~[?:?]
    	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.sendUpdate(ProfileCallbackImpl.java:134) ~[?:?]
    	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onStateUpdateFromHandler(SystemDefaultProfile.java:53) ~[?:?]
    	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.lambda$9(CommunicationManager.java:467) ~[?:?]
    	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.lambda$11(CommunicationManager.java:487) ~[?:?]
    	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_252]
    	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.handleCallFromHandler(CommunicationManager.java:483) ~[?:?]
    	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.stateUpdated(CommunicationManager.java:465) ~[?:?]
    	at org.eclipse.smarthome.core.thing.internal.ThingManagerImpl$1.stateUpdated(ThingManagerImpl.java:168) ~[?:?]
    	at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.updateState(BaseThingHandler.java:245) ~[?:?]
    	at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.updateState(BaseThingHandler.java:264) ~[?:?]
    	at org.openhab.binding.mysensors.handler.MySensorsThingHandler.handleChildUpdateEvent(MySensorsThingHandler.java:305) ~[?:?]
    	at org.openhab.binding.mysensors.handler.MySensorsThingHandler.sensorUpdateEvent(MySensorsThingHandler.java:221) ~[?:?]
    	at org.openhab.binding.mysensors.internal.event.MySensorsEventRegister.lambda$4(MySensorsEventRegister.java:130) ~[?:?]
    	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_252]
    	at org.openhab.binding.mysensors.internal.event.MySensorsEventRegister.notifyNodeUpdateEvent(MySensorsEventRegister.java:126) ~[?:?]
    	at org.openhab.binding.mysensors.internal.gateway.MySensorsGateway.handleSetReqMessage(MySensorsGateway.java:564) ~[?:?]
    	at org.openhab.binding.mysensors.internal.gateway.MySensorsGateway.handleIncomingMessage(MySensorsGateway.java:462) ~[?:?]
    	at org.openhab.binding.mysensors.internal.gateway.MySensorsGateway.messageReceived(MySensorsGateway.java:375) ~[?:?]
    	at org.openhab.binding.mysensors.internal.event.MySensorsEventRegister.lambda$1(MySensorsEventRegister.java:87) ~[?:?]
    	at java.lang.Iterable.forEach(Iterable.java:75) [?:1.8.0_252]
    	at org.openhab.binding.mysensors.internal.event.MySensorsEventRegister.notifyMessageReceived(MySensorsEventRegister.java:83) [bundleFile:?]
    	at org.openhab.binding.mysensors.internal.protocol.MySensorsAbstractConnection$MySensorsReader.run(MySensorsAbstractConnection.java:362) [bundleFile:?]
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_252]
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_252]
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
    	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
    
    
    OpenHAB

  • openHAB 2.5 binding and V_VARx
    syntacrscS syntacrsc

    Hello.

    I hope someone can help me with an issue I'm facing while using mySensors binding for rolling shutters and using V_VAR channels.

    My Setup:
    Software:
    openHAB 2.5.5 stable release
    MySensors openHAB binding 2.5.0.202002161928
    Hardware:
    MySensors Ethernet gateway
    Rollershutters with functions UP/DOWN and TILT UP/TILT DOWN (7 TILT positions, like horizontal blinds) (no KNX!)

    The plan:
    Whenever openHAB starts I want openHAB to request the status of my rollershutter positions (UP or DOWN) and blind positions (1/7, 2/7 ... 7/7).
    Whenever the rollershutter position or blind position changes the node is supposed to send the new status to the controller/openHAB.

    Implementation:
    On the mySensors node I keep variables for rollershutter positions (0% = open to 100% = closed) and tilt-position (1/7 = min tilt to 7/7 fully tilt).
    The node sends both positions either when a command has been executed to change them (UP/DOWN or TILT-UP/TILT-DOWN) or when the controller requests them (via request command = message type = C_REQ).
    I've implemented an openHAB rule which priodically (for testing purposes every minute) requests the positions of the rollershutters and blind-position from the node, the node responds with both positions using V_VAR3 (rollershutter position) and V_VAR4 (tilt position).
    These requests cprrectly arrive at the node and the node responds with its position-values.

    Problem:
    When replying with the rollershutter position to the openhab rule request with e.g. 100 I get error "value must be between 0 and 100.
    When replying with the tilt position to the openhab rule request with e.g. 1 (for 1/7) or 0.14 (for 1/7th) the openHAB log shows error "value must be between 0 and 100.
    Whenever the node sends values 0 or 1 openhab accepts the values!

    What I tried so far:
    I assumed openHAB expects a percent value hence requiring a value between 0 and 1 (even though it says it must be between 0 and 100) so I tried to adjust my mySensors code to send decimals bt. 0 and 1 to represent values bt. 0 and 100 (percent) - no luck though!
    The log only shows 1.0 or 0.0 being received from node eventhough the node sends float(shutter position) / 100.0 for rollershutter position or float(tilt position) / 7.0 for tilt position.
    I've tried different formatting in the items file ([%.2f], [%d], none and many others) - no help!

    Is it possible that there is a bug in the binding implementation of V_VAR1 to V_VAR4 ?
    It seems to only accept values 0 and 1 for the V_VAR channels.
    Is it me? Am I missing anything here?

    Any help is highly appreciated!

    Thanks,
    Ralph...

    Things:

    Bridge mysensors:bridge-eth:gateway @ "Wohnzimmer" [  ipAddress="10.0.0.11",
                                           tcpPort=5003, 
                                           startupCheckEnabled=true, 
                                           imperial=false,
                                           sendDelay=200, 
                                           networkSanCheckSendHeartbeat=false, 
                                           networkSanCheckInterval=3,
                                           networkSanCheckSendHeartbeatFailAttempts=10,
                                           networkSanCheckEnabled=true,
                                           networkSanCheckConnectionFailAttempts=3 ]
    
    {
        cover BueroRalphJalousie                                        "Jalousie"                                  @ "Büro Ralph"          [ nodeId=7,    childId=4,     requestAck=false ]
    }
    

    Items:

    Rollershutter   BueroRalphJalousieAufAb      "Auf/ab"                      { channel="mysensors:cover:gateway:BueroRalphJalousie:cover" }
    Number BueroRalphJalousieStatusAufAb     "Status Auf/ab [%d]"   { channel="mysensors:cover:gateway:BueroRalphJalousie:var3" }
    Number BueroRalphJalousieStatusTilt          "Status Tilt [%.2f]"       { channel="mysensors:cover:gateway:BueroRalphJalousie:var4" }                                                 
    

    Rule:

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Stati von Node erfragen:
    rule HoleUnbekannteStati
    when 
        Time cron "0 0/1 * 1/1 * ? *"   //alle 1 Minuten   
    then 
    //  Jalousiesteuerung - UG:  
        if ( BueroRalphJalousieStatusAufAb.state == NULL 
            || BueroRalphJalousieStatusTilt.state == NULL  ) 
        {  
    //      make the node send in positions for rollershutters and blinds (yes it sends both even though only one (V_VAR3) is being requested!):
            sendCommand(mySMsg01, "7;4;2;0;26");  //erfrage Jalousie-AufAb-Status Buero Ralph von Node 7, Child 4, 2=request, 0 = kein acknowlege, 26 = V_VAR3 
            if ( DebugLogger.state == ON )  
            {  
                logInfo( "Jalousien.Rules.HoleUnbekannteStati", "Jalousie-Stati Buero Ralph werden von Node erfragt")
            }
        }    
    end 
    
    

    mySensors code (excerpt):

    void receive(const MyMessage &IncomingMessage)
    {
    //	Eingehende Anfrage:
    	if (IncomingMessage.destination == MY_NODE_ID
    		&& IncomingMessage.getCommand() == C_REQ )		//Wert fuer ein Child wird abgefragt!
    	{
    		for (byte i = 1; i <= AnzahlRaeume; i++) {
    			if (i == IncomingMessage.sensor)
    			{
    				if (IncomingMessage.type == V_VAR3
    					|| IncomingMessage.type == V_VAR4)
    				{
    					send(Jalousien[i - 1].MessageStatusAufAb.set(Jalousien[i - 1].StatusAufAb, 1), false);
    					send(Jalousien[i - 1].MessageStatusTilt.set(Jalousien[i - 1].StatusTilt, 1), false);
    				}
    			}
    		}
    	}
    }
    

    mySensors code (full copy):

    #include <Arduino.h>
    
    //#define MY_DEBUG
    #define MY_RADIO_RF24
    #define MY_NODE_ID 7
    #define MY_REPEATER_FEATURE
    
    #include <MySensors.h>
    #define MY_RF24_PA_LEVEL RF24_PA_HIGH
    
    //#define ACTIVE_LOW // comment out this line if your relays are active high
    
    #ifdef ACTIVE_LOW
    #define BitShiftRelaisNummer ~(1U << (RelaisNummer-1))
    #define AlleRelaisAus 0xFFFF
    #else
    #define BitShiftRelaisNummer (1U << (RelaisNummer-1))
    #define AlleRelaisAus 0U
    #endif
    
    int RelaisNummer;
    
    #define AnzahlRaeume 8  // Anzahl der Raeume
    
    //Setup Shift Register:
    const int clockPin		  = 4;
    const int outputEnablePin = 6;
    const int dataPin 	      = 7;
    const int latchPin		  = 8;
    
    typedef enum
    {
    	V_TILT_UP  = 90, V_TILT_DOWN  = 91, V_TILT_UP3 = 92, V_TILT_DOWN3 = 93,
    } custom_mysensors_data_t;
    
    typedef struct Jalousie
    {
    	uint8_t RaumNummer;
    	char *RaumName;
    	int RelaisNummerAuf;
    	int RelaisNummerAb;
    	int Fahrzeit;
    	int TiltSchritte;
    	int Command;
    	uint8_t StatusAufAb;	// (0=UP, 100=DOWN, 99=unknown), StatusTilt (0=UP)
    	uint8_t StatusTilt;		// (0=OPEN, 7=CLOSE, 9=unknown), StatusTilt (0=UP)
    	MyMessage MessageStatusAufAb;
    	MyMessage MessageStatusTilt;
    } JalousieTyp;
    
    JalousieTyp Jalousien[AnzahlRaeume] = //RaumNummer, RaumName, RalaisNummer Funktion "AUF", RelaisNummer Funktion "AB", Fahrzeit in Sek., TiltSchritte, Command, StatusAufAb (0=UP, 100=DOWN, 99=unknown), StatusTilt (0=UP, 100=DOWN, 99=unknown)
    {
    	{ 1, "Büro Christine", 		 1,  2, 45, 7, 0, 99, 0 },
    	{ 2, "Spielzimmer", 		 3,  4, 65, 7, 0, 99, 0 },
    	{ 3, "Nebenküche",			 5,  6, 45, 7, 0, 99, 0 },
    	{ 4, "Büro Ralph",			 7,  8, 45, 7, 0, 99, 0 },
    	{ 5, "Esszimmer",			 9, 10, 65, 7, 0, 99, 0 },
    	{ 6, "Wohnzimmer Terrasse",	11, 12, 65, 7, 0, 99, 0 },
    	{ 7, "Wohnzimmer Garten", 	13, 14, 65, 7, 0, 99, 0 },
    	{ 8, "Küche",				15, 16, 65, 7, 0, 99, 0 }
    };
    
    
    ////////////////////////////////////////////////////////////////////////////////
    void setup()
    {
    #ifdef DEBUG_ON
    	Serial.println();
    	Serial.println("SETUP - BEGIN");
    #endif
    
    //  BitShiftRegister vorbereiten:
    	pinMode(latchPin, OUTPUT);
    	pinMode(clockPin, OUTPUT);
    	pinMode(dataPin, OUTPUT);
    	pinMode(outputEnablePin, OUTPUT);
    	digitalWrite(outputEnablePin, LOW);
    
    //  BitShiftRegister auf "alles aus" schalten:
    	digitalWrite(latchPin, LOW); 							//DatenPipeline fuer BitShiftRegister "lahm" legen
    	shiftOut(dataPin, clockPin, MSBFIRST, AlleRelaisAus); 	//DatenPipeline in das BitShiftRegister laden:
    	shiftOut(dataPin, clockPin, MSBFIRST, AlleRelaisAus);
    	digitalWrite(latchPin, HIGH);  							//neue Daten im BitShiftRegister aktivieren:
    
    //  Jalousie-Messages vorbereiten:
    #ifdef DEBUG_ON
    	Serial.println();
    	Serial.println("RaumNummer, RelaisName, RelaisNr-AUF, RelaisNr-AB, Fahrzeit, Command, StatusAufAb, StatusTilt");
    #endif
    	for (byte i = 1; i <= AnzahlRaeume; i++) {
    		Jalousien[i - 1].MessageStatusAufAb.setSensor(Jalousien[i - 1].RaumNummer);	//ChildID
    		Jalousien[i - 1].MessageStatusAufAb.setType(V_VAR3);
    
    		Jalousien[i - 1].MessageStatusTilt.setSensor(Jalousien[i - 1].RaumNummer); 	//ChildID
    		Jalousien[i - 1].MessageStatusTilt.setType(V_VAR4);
    
    #ifdef DEBUG_ON
    		Serial.println(Jalousien[i - 1].RaumNummer + ", " + Jalousien[i - 1].RaumName, + ", " + Jalousien[i - 1].RelaisNummerAuf + ", " + Jalousien[i - 1].RelaisNummerAb + ", " + Jalousien[i - 1].Fahrzeit + ", " + Jalousien[i - 1].Command + ", " + Jalousien[i - 1].StatusAuf + ", " + Jalousien[i - 1].StatusAb);
    #endif
    	}
    
    #ifdef MY_DEBUG
    	Serial.println();
    	Serial.println("SETUP - END");
    #endif
    }
    
    //////////////////////////////////////////////////////////////////////////////////////
    void presentation()
    {
    
    #ifdef MY_DEBUG
    	Serial.println();
    	Serial.println("PRESENTATION - BEGIN");
    #endif
    
    	sendSketchInfo("Jalousie-Controller EG", "1.1");
    	for (byte i = 1; i <= AnzahlRaeume; i++) {
    		present(Jalousien[i - 1].RaumNummer, S_COVER, Jalousien[i - 1].RaumName, false);  //Jalousie
    	}
    
    #ifdef MY_DEBUG
    	Serial.println();
    	Serial.println("PRESENTATION - END");
    #endif
    }
    
    //////////////////////////////////////////////////////////////////////////////
    void JalousieBewegen(int RaumNummer, uint8_t Command)
    {
    	const int DauerTilt   = 150;
    	const int DauerFahren = 1100;
    	int Signaldauer 	  = DauerTilt;
    	int cycles 	 	      = 1;
    
    #ifdef MY_DEBUG
    	Serial.println();
    	Serial.println("JalousieFahren - BEGIN");
    	Serial.print("Command: ");
    	Serial.println(Command);
    #endif
    
    //  RelaisNummer (Funktion also AUF- oder AB-Relais) ermitteln und Signaldauer (Fahren oder TILT) festlegen:
    	switch (Command) {
    	case V_UP:
    		RelaisNummer = Jalousien[RaumNummer - 1].RelaisNummerAuf;
    		Signaldauer = DauerFahren;
    		Jalousien[RaumNummer - 1].StatusAufAb = 0;
    		Jalousien[RaumNummer - 1].StatusTilt = 0;
    		break;
    	case V_DOWN:
    		RelaisNummer = Jalousien[RaumNummer - 1].RelaisNummerAb;
    		Signaldauer = DauerFahren;
    		Jalousien[RaumNummer - 1].StatusAufAb = 100;
    		Jalousien[RaumNummer - 1].StatusTilt = Jalousien[RaumNummer - 1].TiltSchritte;
    		break;
    	case V_STOP:
    		RelaisNummer = Jalousien[RaumNummer - 1].RelaisNummerAuf;
    		Jalousien[RaumNummer - 1].StatusAufAb = 99;
    		break;
    	case V_PERCENTAGE:
    		// Hole Prozentsatz (0-100 oder STOP):
    		// to be implemented
    		RelaisNummer = 0;
    		break;
    	case V_TILT_UP:     //90 TILT-UP
    		RelaisNummer = Jalousien[RaumNummer - 1].RelaisNummerAuf;
    		if (Jalousien[RaumNummer - 1].StatusTilt >= cycles)
    		{
    			Jalousien[RaumNummer - 1].StatusTilt = Jalousien[RaumNummer - 1].StatusTilt - cycles;
    		}
    		break;
    	case V_TILT_DOWN:  //"91 TILT-DOWN"
    		RelaisNummer = Jalousien[RaumNummer - 1].RelaisNummerAb;
    		if (Jalousien[RaumNummer - 1].StatusTilt <= ( Jalousien[RaumNummer - 1].TiltSchritte - cycles ))
    		{
    			Jalousien[RaumNummer - 1].StatusTilt = Jalousien[RaumNummer - 1].StatusTilt + 1;
    		}
    		break;
    	case V_TILT_UP3:   //"92 TILT-UP3"
    		RelaisNummer = Jalousien[RaumNummer - 1].RelaisNummerAuf;
    		cycles       = 3;
    		if (Jalousien[RaumNummer - 1].StatusTilt >= cycles)
    		{
    			Jalousien[RaumNummer - 1].StatusTilt = Jalousien[RaumNummer - 1].StatusTilt - cycles;
    		}
    		break;
    	case V_TILT_DOWN3: //"93 TILT-DOWN3"
    		RelaisNummer = Jalousien[RaumNummer - 1].RelaisNummerAb;
    		cycles       = 3;
    		if (Jalousien[RaumNummer - 1].StatusTilt <= (Jalousien[RaumNummer - 1].TiltSchritte - cycles))
    		{
    			Jalousien[RaumNummer - 1].StatusTilt = Jalousien[RaumNummer - 1].StatusTilt + cycles;
    		}
    		break;
    	};
    
    #ifdef MY_DEBUG
    	Serial.print("Raumnummer: ");
    	Serial.println(RaumNummer);
    	Serial.print("JalousieRelaisNummer: ");
    	Serial.println(RelaisNummer);
    	Serial.print("BitShift-Relais-Nummer: ");
    	Serial.println(BitShiftRelaisNummer);
    #endif
    
    //  Relais (FunktionsNummer) fuer Signaldauer schalten:
    	if (RelaisNummer != 0)
    	{
    		for (int i = 1; i <= cycles; i++)
    		{
    //  		Relais einschalten:
    #ifdef MY_DEBUG
    			Serial.println("Schaltet ein");
    #endif
    			digitalWrite(latchPin, LOW);  											//DatenPipeline fuer BitShiftRegister "lahm" legen
    			shiftOut(dataPin, clockPin, MSBFIRST, highByte(BitShiftRelaisNummer)); 	//DatenPipeline in das BitShiftRegister laden
    			shiftOut(dataPin, clockPin, MSBFIRST, lowByte(BitShiftRelaisNummer));
    			digitalWrite(latchPin, HIGH);  											//neue Daten im BitShiftRegister aktivieren
    
    	//      Relais "gedrueckt" lassen:
    #ifdef MY_DEBUG
    			Serial.print("wartet ");
    			Serial.print(Signaldauer);
    			Serial.println(" ms");
    #endif
    			wait(Signaldauer);
    
    	//  	Relais ausschalten:
    #ifdef MY_DEBUG
    			Serial.println("Schaltet aus");
    #endif
    			digitalWrite(latchPin, LOW); 							//DatenPipeline fuer BitShiftRegister "lahm" legen
    			shiftOut(dataPin, clockPin, MSBFIRST, AlleRelaisAus);	//DatenPipeline in das BitShiftRegister laden
    			shiftOut(dataPin, clockPin, MSBFIRST, AlleRelaisAus);   //doppelt???
    			digitalWrite(latchPin, HIGH);  							//neue Daten im BitShiftRegister aktivieren
    
    			if (cycles > 1) {
    				wait(750);
    			}
    		}
    	}
    
    //	Neuen Zustand an Controller melden:
    	send(Jalousien[RaumNummer - 1].MessageStatusAufAb.set(Jalousien[RaumNummer - 1].StatusAufAb, 1), false);
    	send(Jalousien[RaumNummer - 1].MessageStatusTilt.set(Jalousien[RaumNummer - 1].StatusTilt, 1), false);
    
    #ifdef MY_DEBUG
    	Serial.println("JalousieFahren - END");
    #endif
    }
    
    /////////////////////////////////////////////////////////////////////////////////////////////////////
    void loop()
    {
    
    #ifdef MY_DEBUG
    	Serial.println();
    	Serial.println("LOOP - BEGIN");
    #endif
    
    	for (byte i = 1; i <= AnzahlRaeume; i++)
    	{
    #ifdef MY_DEBUG
    		Serial.print('RaumNummer / Kommando: ');
    		Serial.print('  ');
    		Serial.print(i);
    		Serial.print(' / ');
    		Serial.println(Jalousien[i-1].Command);
    #endif
    		if (Jalousien[i - 1].Command != 0)
    		{
    			JalousieBewegen(Jalousien[i - 1].RaumNummer, Jalousien[i - 1].Command); 	//RaumNummer, Kommando
    			Jalousien[i - 1].Command = 0;
    		}
    	}
    #ifdef MY_DEBUG
    	Serial.println();
    	Serial.println("LOOP - END");
    	wait(4000);
    #endif
    }
    
    
    ////////////////////////////////////////////////////////////////////////////////
    void receive(const MyMessage &IncomingMessage)
    {
    	String Payload;
    
    	Payload = IncomingMessage.getString();
    
    #ifdef MY_DEBUG
    	Serial.println();
    	Serial.println("RECEIVE - BEGIN");
    	Serial.println();
    	Serial.println("Nachricht empfangen");
    	Serial.print("f�r Sensor: ");
    	Serial.println(IncomingMessage.sensor);
    	Serial.print("Typ: ");
    	Serial.println(IncomingMessage.type);
    	Serial.print("Sender: ");
    	Serial.println(IncomingMessage.sender);
    	Serial.print("Command: ");
    	Serial.println(IncomingMessage.getCommand() + "(1 = SET, 2 = REQUEST)");
    	Serial.print("IsAcknowledge: ");
    	Serial.println(IncomingMessage.isAck());
    	Serial.print("Payload als String: ");
    	Serial.println(Payload);
    	Serial.print("Message data: ");
    	Serial.println(IncomingMessage.data);
    #endif
    
    //	Eingehendes Kommando:
    	if (IncomingMessage.destination == MY_NODE_ID
    		&& IncomingMessage.getCommand() == C_SET )	//Wert fuer ein Child soll gesetzt werden!
    	{
    		Jalousien[IncomingMessage.sensor - 1].Command = IncomingMessage.type;
    		//  �ndere Command f�r % AUF/AB auf jeweils 0%, 100% bzw. STOP:
    		if ( IncomingMessage.type == V_PERCENTAGE and Payload == "0") {
    			Jalousien[IncomingMessage.sensor - 1].Command = V_UP;		//29
    		};
    		if ( IncomingMessage.type == V_PERCENTAGE and Payload == "100") {
    			Jalousien[IncomingMessage.sensor - 1].Command = V_DOWN;		//30
    		};
    		if ( IncomingMessage.type == V_PERCENTAGE and Payload == "STOP") {
    			Jalousien[IncomingMessage.sensor - 1].Command = V_STOP;		//31
    		};
    
    		//�ndere Command f�r TILT-AUF/TILT-AB jeweils mit 0%, 100% und STOP:
    		if ( IncomingMessage.type == V_VAR1 and ( Payload == "0" || Payload == "UP" ) )
    		{
    			Jalousien[IncomingMessage.sensor - 1].Command = V_TILT_UP;		//90 TILT-UP
    		};
    		if ( IncomingMessage.type == V_VAR1 and ( Payload == "100" || Payload == "DOWN" ) )
    		{
    			Jalousien[IncomingMessage.sensor - 1].Command = V_TILT_DOWN;	//91 TILT-DOWN
    		};
    		if ( IncomingMessage.type == V_VAR1 and Payload == "STOP") {
    			Jalousien[IncomingMessage.sensor - 1].Command = V_STOP;			//31
    		};
    
    		//�ndere Command f�r 3xTILT-AUF/3xTILT-AB jeweils mit 0%, 100% und STOP:
    		if ( IncomingMessage.type == V_VAR2 and ( Payload == "0" || Payload == "UP" ) )
    		{
    			Jalousien[IncomingMessage.sensor - 1].Command = V_TILT_UP3;		//92 3xTILT-UP
    		};
    		if ( IncomingMessage.type == V_VAR2 and ( Payload == "100"  || Payload == "DOWN" ) )
    		{
    			Jalousien[IncomingMessage.sensor - 1].Command = V_TILT_DOWN3;	//93 3xTILT-DOWN
    		};
    		if ( IncomingMessage.type == V_VAR2 and Payload == "STOP")
    		{
    			Jalousien[IncomingMessage.sensor - 1].Command = V_STOP;			//31
    		};
    
    #ifdef MY_DEBUG
    	Serial.print("Aus Message-Type abgeleitetes Jalousie-Kommando: ");
    	Serial.println(Jalousien[IncomingMessage.sensor - 1].Command);
    	Serial.println();
    #endif
    
    	}
    
    //	Eingehende Anfrage:
    	if (IncomingMessage.destination == MY_NODE_ID
    		&& IncomingMessage.getCommand() == C_REQ )		//Wert fuer ein Child wird abgefragt!
    	{
    		for (byte i = 1; i <= AnzahlRaeume; i++) {
    			if (i == IncomingMessage.sensor)
    			{
    				if (IncomingMessage.type == V_VAR3
    					|| IncomingMessage.type == V_VAR4)
    				{
    					send(Jalousien[i - 1].MessageStatusAufAb.set(Jalousien[i - 1].StatusAufAb, 1), false);
    					send(Jalousien[i - 1].MessageStatusTilt.set(Jalousien[i - 1].StatusTilt, 1), false);
    				}
    			}
    		}
    	}
    
    #ifdef MY_DEBUG
    	Serial.println("RECEIVE - END");
    #endif
    }
    
    
    OpenHAB
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular