Closed gnalbandian closed 8 years ago
Shouldn't we add this lines to MySensorsBindingConstans.java?
public final static String CHANNEL_VAR1 = "v_var1";
public final static String CHANNEL_VAR2 = "v_var2";
public final static String CHANNEL_VAR3 = "v_var3";
public final static String CHANNEL_VAR4 = "v_var4";
public final static String CHANNEL_VAR5 = "v_var5";
put(MYSENSORS_SUBTYPE_V_VAR1, CHANNEL_VAR1);
put(MYSENSORS_SUBTYPE_V_VAR2, CHANNEL_VAR2);
put(MYSENSORS_SUBTYPE_V_VAR3, CHANNEL_VAR3);
put(MYSENSORS_SUBTYPE_V_VAR4, CHANNEL_VAR4);
put(MYSENSORS_SUBTYPE_V_VAR5, CHANNEL_VAR5);
I am not sure how the ThingTypeUID definition would be for these cases. Thanks, regards.
Adding the variables V_VAR1, V_VAR2 ... is no problem!
Currently it is not possible to answer an request send to the OH2 binding due to a limitation of the API. I'm not able to get the value of an item.
Here is the answer of the core developer: https://groups.google.com/forum/#!topic/openhab2/QbmaSwC59l0
So we need to save the value by ourself, which is harder as it sounds, as all items are handled by the same handler and the handler handles all types of data (decimal, string, percentage ...).
Thanks for the answer TimO. No luck for now then. Regards.
Made a pull request just now for HVAC device, where i added the V_VAR1 to V_VAR5 as i needed them for my Thermostat
@gnalbandian Could you provide an example?
1) How does the request look? 2) What answer do you expect?
It is easier for me to implement if I have a example to test with.
Hi TimO. I have implement a heartbeat message for my nodes, so as to see (over time) is they are alive or they had died due to battery drain or whatever.
This heartbeat or beacon, is send to the gateway every couple of minutes. This interval is defined by a Setpoint item in OpenHAB and requested by the nodes everytime they boot up. I called that interval "Heart Rate"
msg[HeartRate].setType(V_VAR1);
gw.request(msg[HeartRate].sensor,msg[HeartRate].type);
So, what I need, is the binding to detect this request and trigger a rule in OH2 such as the following:
rule "Heart Rate request"
when
Item HeartRate received command
then
if (receivedCommand == "REQUEST")
{
logInfo( "Heart Rate", "Heart Rate request")
sendCommand(HeartRate, (Heart_Rate_Setpoint.state as DecimalType).intValue));
}
end
Let me know if you need some extra details. I have this feature working fine, but without the ability to request the heart rate value at boot up. What I do, is everytime I manually change the Heart rate with OH2 setpoint, I send to all the nodes the new value.
Regards!
To speak in SerialAPI should it look like this?
Node sends a request for V_VAR_1 like: 0;0;2;0;24;
OH should respond with: 105;2;1;0;24;1000 (where 1000 is the value of the item)
I currently don't have a hardware node that sends requests so I will teach my MockGateway.
mmm not quiet right.
Suppose our node has id=1, heartbeat sensor id=252, with variable type V_VAR1. The serial message request received at the gateway would look like this:
1;252;2;0;24;
And the answer from the controller would look like this:
1;252;1;0;24;1000
Let me know if there is anyway in which I can help you. Regards.
Thanks for the heads up. So the debug output of the implementation looks like this:
2016-03-29 12:51:02.553 [DEBUG] [o.b.m.protocol.MySensorsReader:51 ] - 1;252;2;0;24;
2016-03-29 12:51:02.554 [DEBUG] [o.b.m.handler.MySensorsHandler:249 ] - Reqeust received!
2016-03-29 12:51:02.554 [DEBUG] [o.b.m.protocol.MySensorsWriter:77 ] - Sending to MySensors: 1;252;1;0;24;1000
2016-03-29 12:51:02.557 [INFO ] [smarthome.event.ItemStateEvent:43 ] - thermo01 updated to 1000
This is what you need?
Exactly. Thanks TimO. Looking forward to test this. Just a litle spelling correction. "Request received!"
Regards!
Shouldn't this be closed? I'm successfully updating sensors using VAR_1 and got here because I had another unrelated issue. (Nb: Using postUpdate instead of sendCommand) Got biased this was my issue.
Yes @glmnet , I suppose it is working as requested! :)
Hello.
I am dealing with a sensor that requests a numeric value from OH2. Unfortunatelly, the only item type I can use to link the channel from where the node makes its request, is a dimmer type because all the other variables are read only.
Is there any reason for this? Why wouldn't be possible for a node to ask for a temperature for example? I have found that when I set the type as temperature or other numeric tipe variables, the payload sent out has '0' where it should have the desired value.
Another thing I noticed, is the lack of variables V_VAR1, V_VAR2...that are defined at MySensors variable types. Is there any reason to avoid this type of variables.
Once again, I appreciate very much the effort you have put in this binding. It really works greats. Hope we can add the mentioned features. Regards. Gonzalo