Send a text to node



  • I have about 20 mysensors’s node, who send their values to HA, through a USB gateway.
    This way is OK.

    But now, I need to send infos from HA to my nodes (for LCD displaying, etc.)
    I tried with notify.mysensors, but I cannot get it to work : there is no sevice called like that.
    And it seems to be abandonned :

    https://www.home-assistant.io/integrations/notify.mysensors/
    https://forum.mysensors.org/topic/10488/homeassistant-mysensors-notify-does-nothing-alternatives/7

    Does someone have a workaround or knows how to integrate the that service in HA ?



  • I'm using node red for this purpose. This makes it easy to send data to nodes, without even following the integration guidelines for HA.

    Does your sketch fulfill the requirements from this page? https://www.home-assistant.io/integrations/notify.mysensors/



  • @Poupoune1974 I don't know about HA, but in MyController it is easy to forward a payload received from one node to another for display. I use it with a weather forecasting node that sends to the controller and then the value is sent to a node in the bedroom to display on oled screen.



  • @electrik said in Send a text to node:

    Does your sketch fulfill the requirements from this page? https://www.home-assistant.io/integrations/notify.mysensors/

    The problem is that I have no notify.mysensors service in HA :

    sc1.png

    I tried to use the sketch from your page, but could not receive any V_TEXT message.

    @skywatch HA might not be the ideal controller to work with mysensors. I ordered an ethernet gateway. Once delivered (6 weeks) I'll hope it will better communicate with mysensors.



  • @Poupoune1974
    I also don't have this service but expected it to show up with this sketch. So that didn't show up, after the sketch presented itself to the gateway?
    I don't think another gateway will make a difference.



  • @electrik When I replace in the sketch :

    request(CHILD_ID, V_TEXT);
    

    With

    request(CHILD_ID, V_TEMP);
    

    I could receive a message from HA. Very strange.

    With another gateway, an ethernet one, I'd like to do use MQTT communication both ways.



  • What do the logs say?



  • Serial monitor :

    30439 TSF:MSG:SEND,66-66-0-0,s=1,c=2,t=47,pt=0,l=0,sg=0,ft=0,st=OK:
    Sending initial value
    32448 TSF:MSG:SEND,66-66-0-0,s=1,c=1,t=47,pt=0,l=1,sg=0,ft=0,st=OK:-
    Requesting initial value from controller
    32456 TSF:MSG:SEND,66-66-0-0,s=1,c=2,t=47,pt=0,l=0,sg=0,ft=0,st=OK:
    Sending initial value
    34464 TSF:MSG:SEND,66-66-0-0,s=1,c=1,t=47,pt=0,l=1,sg=0,ft=0,st=OK:-
    Requesting initial value from controller
    34473 TSF:MSG:SEND,66-66-0-0,s=1,c=2,t=47,pt=0,l=0,sg=0,ft=0,st=OK:
    Sending initial value
    36483 TSF:MSG:SEND,66-66-0-0,s=1,c=1,t=47,pt=0,l=1,sg=0,ft=0,st=OK:-
    Requesting initial value from controller
    36493 TSF:MSG:SEND,66-66-0-0,s=1,c=2,t=47,pt=0,l=0,sg=0,ft=0,st=OK:
    

    And in HA

    2020-04-17 08:42:48 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:137717498 TSF:MSG:READ,66-66-0,s=1,c=1,t=47,pt=0,l=1,sg=0:-
    2020-04-17 08:42:48 WARNING (MainThread) [mysensors] Not a valid message: Not valid message sub-type: 47 for dictionary value @ data['sub_type']
    2020-04-17 08:42:48 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:137717507 TSF:MSG:READ,66-66-0,s=1,c=2,t=47,pt=0,l=0,sg=0:
    2020-04-17 08:42:48 WARNING (MainThread) [mysensors] Not a valid message: Not valid message sub-type: 47 for dictionary value @ data['sub_type']
    2020-04-17 08:42:50 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:137719517 TSF:MSG:READ,66-66-0,s=1,c=1,t=47,pt=0,l=1,sg=0:-
    2020-04-17 08:42:50 WARNING (MainThread) [mysensors] Not a valid message: Not valid message sub-type: 47 for dictionary value @ data['sub_type']
    2020-04-17 08:42:50 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:137719526 TSF:MSG:READ,66-66-0,s=1,c=2,t=47,pt=0,l=0,sg=0:
    2020-04-17 08:42:50 WARNING (MainThread) [mysensors] Not a valid message: Not valid message sub-type: 47 for dictionary value @ data['sub_type']
    


  • I guess you are right and this is not working on HA...



  • I wonder - have you specified a protocol version for the MySensors integration in configuration.yaml? Because your HA log hints that you are using an older protocol which doesn't support V_TEXT. It is only available with 2.0 and higher and IIRC the notify service was also introduced with 2.0. The MySensors integration in HA defaults to 1.4 if no version is specified.

    mysensors:
      [...]
      version: '2.3'
    

    For the record - I just set this up myself and it worked fine. I'm using Home Assistant 0.107.7 (Docker) and MySensors 2.3.2

    Relevant code in my sketch:

    #define CHILD_ID_TXT 98
    MyMessage msgTxt(CHILD_ID_TXT, V_TEXT);
    void setup()
    {
    	send(msgTxt.set("#"));
    	wait(1000);
    	request(CHILD_ID_TXT, V_TEXT);
    }
    void presentation()
    {
    	present(CHILD_ID_TXT, S_INFO);
    }
    void receive(const MyMessage &msg)
    {
    	Serial.print("Received a message: ");
    	Serial.println(msg.getString());
    }
    

    This is the HA log after uploading the new sketch to the node:

    DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 179;98;0;0;36;
    DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 179 child 98
    DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/179/98/1/+/+, qos: 0
    DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/179/98/2/+/+, qos: 0
    DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/179/+/4/+/+, qos: 0
    DEBUG (SyncWorker_5) [mysensors.persistence] Saving sensors to persistence file /config/mysensors.json
    [...]
    DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 179;98;1;0;47;#
    DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 179 child 98
    INFO (MainThread) [homeassistant.components.notify] Setting up notify.mysensors
    INFO (MainThread) [homeassistant.components.mysensors] Adding new devices: [<MySensorsNotificationDevice DevNode 179 98>]
    INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.mysensors
    INFO (MainThread) [homeassistant.components.mysensors] Adding new devices: [<Entity DevNode 179 98: None>]
    DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: DevNode 179 98: value_type 47, value = #
    DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 179;98;2;0;47;
    DEBUG (MainThread) [mysensors.gateway_mqtt] Publishing 179;98;1;0;47;#
    

    Serial output on the node:

    8812 TSF:MSG:READ,0-0-179,s=98,c=1,t=47,pt=0,l=1,sg=0:#
    Received a message: #
    

    The notify.mysensors service appeared right after presenting the new V_TEXT/S_INFO child. Sending custom messages from there works aswell.
    mys-notify-ha.jpg

    Serial output:

    413829 TSF:MSG:READ,0-0-179,s=98,c=1,t=47,pt=0,l=11,sg=0:TestMessage
    Received a message: TestMessage
    


  • Oh yeeeess !

      version: '2.3'  
    

    did the trick ! Incredible ! I still have no notify.mysensors in the services, but it doesn't matter, I can now send infos to my nodes :

    2020-04-17 18:01:35 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: Citerne 1: value_type 47, value = -
    

    Thank you so much !



  • And after a node reboot, the notify.mysensors service appears too :

    TSF:MSG:SEND,232-232-0-0,s=1,c=1,t=47,pt=0,l=12,sg=0,ft=0,st=OK:It works !!!
    

Log in to reply
 

Suggested Topics

  • 1
  • 5
  • 2
  • 5
  • 1
  • 3

49
Online

11.4k
Users

11.1k
Topics

112.6k
Posts