mysprinkler for mysensor and home assistant not working together



  • first of all i must admit that i'm quite a noob. so please forgive if my questions seem stupid.

    i built the irrigation system board, and it seems to work electronically. i also built a serial gateway with the same 3.3v arduino pro mini that i used for the irrigation controller.

    the serial gateway is connected to the usb (with a serial - rs232 converter which also powers the arduino and the nrf2401 with 3.3v). i added the gateway to configuration.yaml

    mysensors:
      gateways:
        - device: '/dev/ttyUSB0'
          baud_rate: 38400
          persistence_file: 'home/homeassistant/mysensors.json'
      optimistic: false
      persistence: true
      retain: true
      version: '2.0'
    

    the sensor.yaml has this added:

      - platform: mysensors
        port: "/dev/ttyUSB0"
    

    the serial debug of the irrigation controller looks like that:

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    4 TSM:INIT
    4 TSF:WUR:MS=0
    12 TSM:INIT:TSP OK
    14 TSF:SID:OK,ID=2
    16 TSM:FPAR
    86 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    946 TSF:MSG:READ,0-0-2,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    952 TSF:MSG:FPAR OK,ID=0,D=1
    2095 TSM:FPAR:OK
    2095 TSM:ID
    2097 TSM:ID:OK
    2099 TSM:UPL
    2107 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2162 TSF:MSG:READ,0-0-2,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2168 TSF:MSG:PONG RECV,HP=1
    2170 TSM:UPL:OK
    2172 TSM:READY:ID=2,PAR=0,DIS=1
    2179 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    2240 TSF:MSG:READ,0-0-2,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    2250 TSF:MSG:SEND,2-2-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
    2265 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    2400 TSF:MSG:READ,0-0-2,s=255,c=3,t=6,pt=0,l=1,sg=0:M
    2410 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=11,pt=0,l=11,sg=0,ft=0,st=OK:MySprinkler
    2426 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:2.2
    2437 TSF:MSG:SEND,2-2-0-0,s=0,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    2447 TSF:MSG:SEND,2-2-0-0,s=1,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    2490 TSF:MSG:SEND,2-2-0-0,s=2,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    2535 TSF:MSG:SEND,2-2-0-0,s=3,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    2584 TSF:MSG:SEND,2-2-0-0,s=4,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    2590 MCO:REG:REQ
    2609 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    2756 TSF:MSG:READ,0-0-2,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    2762 MCO:PIM:NODE REG=1
    2764 MCO:BGN:STP
    Initialising...
    Turning All Valves Off...
    Checking EEPROM for stored date:
    Retreiving last run time from EEPROM...
    Sensor Presentation Complete
    Ready...
    3389 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=1,pt=0,l=0,sg=0,ft=0,st=OK:
    Requesting time from Gateway:
    3467 TSF:MSG:READ,0-0-2,s=255,c=3,t=1,pt=0,l=10,sg=0:1515859257
    Time value received and updated...
    Clock updated....
    Sensor's time currently set to: 04:00pm
    1/13/2018
    Saturday 
    Calling for Valve 1 Data...
    4403 TSF:MSG:SEND,2-2-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
    4462 TSF:MSG:SEND,2-2-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
    4526 TSF:MSG:SEND,2-2-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
    4587 TSF:MSG:SEND,2-2-0-0,s=1,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:```
    

    there seems to be some communication between the hub and the sensor which is ok. but i don't see any mysensor sensors in home assistant and i don't understand what the log errors below mean, or how to get rid of them.

    Jan 13 14:01:13 hassbian hass[2451]: 2018-01-13 14:01:13 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=6,pt=0,l=1,sg=0,ft=0,st=OK:M#0
    Jan 13 14:01:14 hassbian hass[2451]: 2018-01-13 14:01:14 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSF:MSG:READ,2-2-0,s=255,c=3,t=11,pt=0,l=11,sg=0:MySprinkler#0
    Jan 13 14:01:14 hassbian hass[2451]: 2018-01-13 14:01:14 DEBUG (Thread-13) [homeassistant.components.mysensors] Node update: node 2 child 255#0
    Jan 13 14:01:14 hassbian hass[2451]: 2018-01-13 14:01:14 DEBUG (Thread-13) [homeassistant.components.mysensors] Not a child update for node 2#0
    Jan 13 14:01:14 hassbian hass[2451]: 2018-01-13 14:01:14 DEBUG (Thread-13) [mysensors] Handle queue with call <bound method SerialGateway.logic of SerialGateway>(('2;255;3;0;11;MySprinkler\n',), {}) took 0.200 seconds#0
    Jan 13 14:01:14 hassbian hass[2451]: 2018-01-13 14:01:14 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSF:MSG:READ,2-2-0,s=255,c=3,t=12,pt=0,l=3,sg=0:2.2#0
    Jan 13 14:01:14 hassbian hass[2451]: 2018-01-13 14:01:14 DEBUG (Thread-13) [homeassistant.components.mysensors] Node update: node 2 child 255#0
    Jan 13 14:01:14 hassbian hass[2451]: 2018-01-13 14:01:14 DEBUG (Thread-13) [homeassistant.components.mysensors] Not a child update for node 2#0
    Jan 13 14:01:14 hassbian hass[2451]: 2018-01-13 14:01:14 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSF:MSG:READ,2-2-0,s=0,c=0,t=3,pt=0,l=0,sg=0:#0
    Jan 13 14:01:14 hassbian hass[2451]: #033[33m2018-01-13 14:01:14 WARNING (Thread-13) [mysensors] child_id 0 already exists in children of node 2, cannot add child#0
    Jan 13 14:01:14 hassbian hass[2451]: 2018-01-13 14:01:14 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSF:MSG:READ,2-2-0,s=1,c=0,t=3,pt=0,l=0,sg=0:#0
    Jan 13 14:01:14 hassbian hass[2451]: #033[33m2018-01-13 14:01:14 WARNING (Thread-13) [mysensors] child_id 1 already exists in children of node 2, cannot add child#0
    Jan 13 14:01:14 hassbian hass[2451]: 2018-01-13 14:01:14 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSF:MSG:READ,2-2-0,s=2,c=0,t=3,pt=0,l=0,sg=0:#0
    Jan 13 14:01:14 hassbian hass[2451]: #033[33m2018-01-13 14:01:14 WARNING (Thread-13) [mysensors] child_id 2 already exists in children of node 2, cannot add child#0
    Jan 13 14:01:14 hassbian hass[2451]: 2018-01-13 14:01:14 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSF:MSG:READ,2-2-0,s=3,c=0,t=3,pt=0,l=0,sg=0:#0
    Jan 13 14:01:14 hassbian hass[2451]: #033[33m2018-01-13 14:01:14 WARNING (Thread-13) [mysensors] child_id 3 already exists in children of node 2, cannot add child#0
    Jan 13 14:01:14 hassbian hass[2451]: 2018-01-13 14:01:14 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSF:MSG:READ,2-2-0,s=4,c=0,t=3,pt=0,l=0,sg=0:#0
    Jan 13 14:01:14 hassbian hass[2451]: #033[33m2018-01-13 14:01:14 WARNING (Thread-13) [mysensors] child_id 4 already exists in children of node 2, cannot add child#0
    Jan 13 14:01:14 hassbian hass[2451]: 2018-01-13 14:01:14 DEBUG (Thread-13) [mysensors] n:0 c:255 t:3 s:9 p:TSF:MSG:READ,2-2-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2#0```
    

    this is my
    /home/homeassistant/mysensors.json

    {"2": {"sketch_version": "2.2", "battery_level": 0, "protocol_version": "2.1.1", "sketch_name": "MySprinkler", "children": {"0": {"id": 0, "description": "", "type": 3, "values": {}}, "1": {"id": 1, "description": "", "type": 3, "values": {}}, "2": {"id": 2, "description": "", "type": 3, "values": {}}, "3": {"id": 3, "description": "", "type": 3, "values": {}}, "4": {"id": 4, "description": "", "type": 3, "values": {}}}, "sensor_id": 2, "type": 17}}
    

  • Plugin Developer

    You need to send initial values for each device. That's what's missing.

    Also remove the mysensors sensor platform from your configuration yaml. That's not needed.



  • @martinhjelmare said in mysprinkler for mysensor and home assistant not working together:

    You need to send initial values for each device. That's what's missing.

    Also remove the mysensors sensor platform from your configuration yaml. That's not needed.

    thanks martin. i read that, but i have no idea how to send those initial values?
    is this something that i have to implement in the sensor's code?

    https://home-assistant.io/components/mysensors/#presentation says:

    Send at least one initial value per V_TYPE. In version 2.0 of MySensors this has to be done in the loop function.

    is it something like that?

        Serial.println("Sending initial value");
        send(msg.set(state?RELAY_ON:RELAY_OFF));
    

    if that is the case, i assume it's missing in the irrigation controller's code. correct?


  • Plugin Developer

    @johannes-schoeller

    Yes, something like that.

    I'm not familiar with the irrigation controller code. But your log is missing the output about sending values, so I assume it's missing from the sketch.



  • thanks that did work. basically it worked the very next day w/o changing anything. it just did send initial values. so problem solved.

    but i have another issue. now that everything is working so far, and i see the switch automatically added in my home assistant dashboard, i can use them and click them. this is seen by the sensor and it acts appropriately.

    but how the irrigation controller is meant to be used is: it ASKS the hub for data. this data is a) time (works!) and b) duration to activate each zone on button press.

    so it has 4 irrigation zones, each of them ca be assigned 2 values, one is how long it's turned on when activated alone, and one how long it's turned on when you run all zones, one after the other.

    but i don't know how to set those values in home assistant so i can send them back to the sensor.

    this is what the sensor looks like in home assistant:

    0_1515951958517_Capture.JPG



  • @martinhjelmare said in mysprinkler for mysensor and home assistant not working together:

    Also remove the mysensors sensor platform from your configuration yaml. That's not needed.

    you mean this form configuration.yaml:

    mysensors:
      gateways:
        - device: '/dev/ttyUSB0'
          baud_rate: 38400
          persistence_file: 'home/homeassistant/mysensors.json'
      optimistic: false
      persistence: true
      retain: true
      version: '2.0'
    

    or this from sensors.yaml:

    - platform: mysensors
        port: "/dev/ttyUSB0"
    

    EDIT: got is sorted out myself. NOT the configuration part is wrong, but the sensors.yaml part is too much. i removed it, and it works fine. thank you!!



  • i investigated further and now i know that the sensor is requesting VAR_1 to VAR_3 and afaik this is not working with home assistant.
    any ideas how to circumvent this? i need to set the value in HA and then the sensor is requesting it. how would this be accomplished in HA?


  • Plugin Developer

    @johannes-schoeller

    Currently you can hack it by adding those value types and values to the JSON persistence file, keeping the structure. It's not a real solution, but should work. They will get represented as sensor entities in home assistant. If you want to avoid entity_id clashes the V_VAR1 and V_VAR3 should be placed on different children.

    I have on the roadmap to add an option for inital values in the mysensors home assistant config section.



  • @johannes-schoeller
    hi im currently struggling with the same problem, i dont suppose you found a solution? i tried to do what martinhjelmare said but obviously i did it wrong. any help would be apreciated anyone. at the moment i have the mysprinkler for mysensor showing in home assistant and if i try start one of the relays it just goes to next relay but doesnt start. it shows on the display 0 sec and i cant find how to set how to put in time for the relays as im a noob lol. cheers



  • @darren-herd said in mysprinkler for mysensor and home assistant not working together:

    @johannes-schoeller
    hi im currently struggling with the same problem, i dont suppose you found a solution? i tried to do what martinhjelmare said but obviously i did it wrong. any help would be apreciated anyone. at the moment i have the mysprinkler for mysensor showing in home assistant and if i try start one of the relays it just goes to next relay but doesnt start. it shows on the display 0 sec and i cant find how to set how to put in time for the relays as im a noob lol. cheers

    i wish i would. i now 3d printed a case for it, got it all working so far, but can't make it announce the sensors in HA. no idea, why it worked before, and what's not working now ...


 

344
Online

7.8k
Users

8.7k
Topics

93.0k
Posts