Where to send messages about battery charge and signal strength?
-
Everyone a good day.
Where to send messages about battery charge and signal strength? they are not visible in the corresponding fields of MyController.
Explain the topology of sending RSSI system messages and battery level.Who initiates the request for battery charge and signal strength? Or does the sensor send itself at its own discretion? It seemed to me that there are the following tags: In and Out, so this is all the same dialogue on demand?
I am sending data something like this:
reportMsg(getId(), I_SIGNAL_REPORT_RESPONSE, static_cast<uint16_t>(rssi)); .... template<typename T> void reportMsg(const uint8_t & id, const mysensors_internal_t & tag, const T & val) { _sendRoute(build(_msgTmp, GATEWAY_ADDRESS, id, C_SET, tag, false).set(val)); }
but I don't see the data .. something goes wrong. The same story with battery power, I send data from
loop
, without external request. Is it correct?
-
If I send a message with a sensor ID of
NODE_SENSOR_ID
, I get the following duplicate message errors:reportMsg(NODE_SENSOR_ID, I_SIGNAL_REPORT_RESPONSE, static_cast<uint16_t>(rssi));
errors:
951492 !MCO:PRO:RC=1 951525 !MCO:PRO:RC=1 951558 !MCO:PRO:RC=1 .. more ..
-
I don't recognize any of that code. Where did you find it? I don't think I've ever seen a MySensors sketch with a c++ template in it.
Sending battery level is done like this:
sendBatteryLevel(60);
(for a battery level of 60%). Documentation: https://www.mysensors.org/download/sensor_api_20#sending-data
Sending other values can be done in multiple ways. For an example sending wifi rssi and rssi of incoming MySensors message, see https://github.com/mfalkvidd/Arduino-MySensors-ESP8266-RFM69-Gateway/blob/master/Arduino-MySensors-ESP8266-RFM69-Gateway.ino#L106
-
C ++
templates work great, the main thing is not to useclass->virtual
andRTTI
. I writeC ++
fluently, it's easier for me.
Thanks for your reply and sorry for my "bad" english.
-
Do I understand correctly that
if (message.sender == 1)
is a broadcast message? and it is sent to all nodes at once?
-
@Clone-Tv no. Sorry for the confusion. message.sender is the node ID of the sender. For my gateway, I have chosen to only report received rssi for the node with node id 1. Rssi for all other nodes is ignored.
-
@Clone-Tv said in Where to send messages about battery charge and signal strength?:
message.sender
Thanks for the clarification about
message.sender
, but then it is not entirely clear why this is used to receive messages? In essence, this should create a regeneration loop of messages ...Unfortunately, it was not possible to deliver the
RSSI
level as applied to theMyController
interface. The data itself is of course sent and received, but there is no display in the corresponding column. I used theS_SOUND
andV_LEVEL
identifiers.Here's a screenshot of where it should be, but it's not there
-
@Clone-Tv rssi is only defined/meaningful when receiving a message, so it must be measured when receiving. To avoid regeneration loop, do not send from within receive(). Only store the value, then send from within loop() like my sketch does.
I have no experience with mycontroller. This is what it looks like in Domoticz:
Note that the rssi value is recorded as a value of the gateway. It is not recorded as a value of the node.
-
@Clone-Tv If you go to Resources > Nodes and click the view button (far right) you get to the node details.
In the Details window click Edit and see if there is anything in the rssi section. You may have to add here manually..... But I never use this as nrf24 don't send rssi data so it's just my best guess at a way to help you out here!
-
Many thanks to all who answered, regarding MyController I think I will have to look at the source code, in which topic and with what identifier it expects a message about the RSSI evel.
-
@Clone-Tv If you need more hlep then this is the place to ask....
-
Yes, I found
It may be useful for those who might come across this issue later:Code for sending
RSSI
fromloop
function.
It is not necessary to announce (present) theRSSI
sensor.MY_CRITICAL_SECTION { char *buff = new char[18]{}; (void) snprintf(buff, 17, "rssi:%d", rssi); reportMsg(getId(), V_VAR5, buff); delete [] buff; }