Avatar for JohanWinas

JohanWinas

Member since Sep 2020 • Last active Apr 2021
  • 7 conversations
  • 22 comments

Most recent activity

  • in General
    Avatar for JohanWinas

    So a bit more testing done.
    I changed my js code so that is dont print anything to the console by it self. So when connecting with the IDE it's silent.
    I run EspruinoHub stock, line 423 is active in connect.js.
    It starts, finds the devices, updates the mqtt with all the data.
    I have enabled all the mqtt options so there is a stream of messages at /ble/# that i subscribe to.
    I open the IDE from EspruinoHub, and I can connect to my device. Press enter a few times and I can see the packets on the console from start.sh.
    Press disconnect.
    After som time the console states "Connection [] IDLE"
    But there is no stream of messages on the MQTT, all silent.
    The clock is ticking over on the console output from start.sh, but the list of devices does not update.
    And reloading the IDE and pressing connect does not show any devices to connect to.

    [MQTT] Connected
    [Discover] Re-sending presence status of known devices
    [Discover] Noble StateChange: poweredOn
    [Config] Config config.json loaded
    [MQTT] Connecting...
    [HTTPProxy] config.http_proxy=false, not enabling Bleno/Proxy
    [HTTP] Server is listening on http://localhost:1888
    [Config] Config config.json loaded
    [MQTT] Connecting...
    [HTTPProxy] config.http_proxy=false, not enabling Bleno/Proxy
    [HTTP] Server is listening on http://localhost:1888
    [HTTP] www directory found at /home/pi/EspruinoHub/www. Web server at http://localhost:1888
    [History] history_path value is empty, thus not providing history.
    [MQTT] Connected
    [Discover] Re-sending presence status of known devices
    [Discover] Noble StateChange: poweredOn
    [Discover] Starting scan...
    [Discover] Scanning started.
    [HTTP] Serving /home/pi/EspruinoHub/www/ide.html
    [HTTP] Serving /home/pi/EspruinoHub/www/paho-mqtt.js
    [HTTP] Wed Apr 14 2021 20:55:27 GMT+0100 (British Summer Time) Connection accepted.
    [HTTP] Websocket MQTT connected
    [Discover] Scanning stopped.
    [Connect] d2:fd:13:f9:3d:32: Connecting...
    [Connect] Connected.
    [Connect] d2:fd:13:f9:3d:32: Getting Service...
    [Connect] d2:fd:13:f9:3d:32: found service: 6e400001b5a3f393e0a9e50e24dcca9e
    [Connect] d2:fd:13:f9:3d:32: found characteristic: 6e400003b5a3f393e0a9e50e24dcca9e
    [Connect] d2:fd:13:f9:3d:32: startNotifications complete
    [Connect] serviceQueue jobs 1
    Starting job from Queue
    [Connect] d2:fd:13:f9:3d:32: Getting Service...
    [Connect] d2:fd:13:f9:3d:32: found characteristic: 6e400002b5a3f393e0a9e50e24dcca9e
    [Connect] d2:fd:13:f9:3d:32: Written 1 bytes
    [Connect] d2:fd:13:f9:3d:32: Written 19 bytes
    [Connect] d2:fd:13:f9:3d:32: Written 19 bytes
    [Connect] d2:fd:13:f9:3d:32: Written 16 bytes
    [Connect] d2:fd:13:f9:3d:32: Written 1 bytes
    [Connect] d2:fd:13:f9:3d:32: Written 1 bytes
    [Connect] d2:fd:13:f9:3d:32: Written 1 bytes
    [Connect] d2:fd:13:f9:3d:32: Written 1 bytes
    [Connect] d2:fd:13:f9:3d:32: Disconnecting due to lack of use (after 20 secs)
    [Connect] d2:fd:13:f9:3d:32: Disconnecting.
    [Connect] d2:fd:13:f9:3d:32: Disconnected
    [Connect] Connections remaining: []
    [Connect] Disconnected by device
    [HTTP] Websocket MQTT closed (WebSocket)
    [HTTP] Websocket MQTT closed (MQTT)
    [HTTP] Serving /home/pi/EspruinoHub/www/rssi.html
    [HTTP] Serving /home/pi/EspruinoHub/www/tinydash.css
    [HTTP] Serving /home/pi/EspruinoHub/www/tinydash.js
    [HTTP] Serving /home/pi/EspruinoHub/www/paho-mqtt.js
    [HTTP] Wed Apr 14 2021 20:56:12 GMT+0100 (British Summer Time) Connection accepted.
    [HTTP] Websocket MQTT connected
    [HTTP] Websocket MQTT closed (WebSocket)
    [HTTP] Websocket MQTT closed (MQTT)
    [HTTP] Serving /home/pi/EspruinoHub/www/ide.html
    [HTTP] Serving /home/pi/EspruinoHub/www/paho-mqtt.js
    [HTTP] Wed Apr 14 2021 21:00:02 GMT+0100 (British Summer Time) Connection accepted.
    [HTTP] Websocket MQTT connected
    
    Wed Apr 14 2021 21:00:56 GMT+0100 (British Summer Time)
    
    08:66:98:c2:97:36 - ? (RSSI -69)
    1c:47:96:28:4e:d5 - ? (RSSI -76)
    3b:90:3a:9d:b2:3d - ? (RSSI -70)
    48:a3:04:51:65:3a - ? (RSSI -44)
    5c:b4:40:88:b2:a0 - ? (RSSI -70)
    68:7b:52:1b:85:cf - ? (RSSI -72)
      fe9f => {"Google":{"type":"Buffer","data":[2,100,114,85,55,65,101,114,117,82,89,73,0,0,1,120,209,248,23,164]}}
    6a:f0:dc:31:39:a3 - ? (RSSI -53)
    c8:d0:83:ba:9d:e1 - ? (RSSI -69)
    d2:fd:13:f9:3d:32 - CTx1 (RSSI -68)
    [CONNECT] Connections [] IDLE
    
  • in General
    Avatar for JohanWinas

    I tried with the "connection.setUsed()" commented out, but that made no difference.

    Will rewire my lab setup later tonight and se what happens if I make it silent.

  • in General
    Avatar for JohanWinas

    Yes it is always printing data to the console :-)

    The module polls a device over a serial port, but I need to modify the code to not print any errors when I lift the TX pin on the device. Normally it would print an error every time it timeouts.

    I have previously tried using the tx function in EspruinoHub to write data to a device via mqtt, I'm guessing that function will be effected by this to?? Never got it to work...

  • in General
    Avatar for JohanWinas

    I just installed EspruinoHub on a Raspberry Pi 4 with node-red and an external BLE dongle with an external antenna. hciconfig shows the dongle ok.
    The config for EspruinoHub points mqtt to a separate machine that only runs a mosquitto.
    The web pages works fine, I can see advertisement etc etc. Ok.
    Using an mqtt sub app I can see the /ble/# messages. Ok.
    I start the webIDE, and it shows me the Espruino devices. Ok.
    Click on a device and it connects and I can interact with the device. Ok.
    Looking at the /ble/# topic on the mqtt server I get all devices messages before starting the webIDE, when the webIDE starts I only get the connected device messages. Ok.
    I then click the disconnect icon, and the webIDE says disconnected :mac:. Ok.
    But, looking att the /ble/# subscription I'm still getting the console messages from that device.
    To get espruinoHub back to it's original state I need to stop and start it.
    To me it looks like the disconnect is missed when the webIDE closes.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for JohanWinas

    Sometimes one has to ask the question to realise the simple answer... It's an electricity meter I'm talking to as well, and yes the easy way is to just hard code the query :-)
    But it might be good to check the CRC on the reply.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for JohanWinas

    How did you sort out the CRC calculation??

    Thats the only part that can be a bit tricky for a simple modbus implementation, I can build the packet by hand and parse the response my self.

    I often get devices scattered all over the place that has a RS485 port with modbus, often its just a few bytes of data that I want from it. But running a hardwire etc etc to this makes it a lot of work. A small BLE device that polls data and sends it as BLE manufacture data would be perfect to just get the status and monitor the device values. WiFi is often hard to get working, and BLE actually has longer range in real life :-) Being able to reprogram the device wireless makes it just perfect.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for JohanWinas

    I'm thinking of using a MDBT42Q module to poll data from a Modbus device over RS485.

    My hardware will use the MAX13487 that implements auto tx/rx switch, I have used this in many designs before and it works just fine with modbus. So no need for TX control pin.

    I found this, https://github.com/makejs/modbusTCP-Espruino, but cant make out if its just a clone of modbus-serial or if it's actually for Espruino.. anyone?

Actions