Where does Blynk keep it's logs? RPi / Python

Before creating the topic

  1. Search forum for similar topics
  2. Check http://docs.blynk.cc and http://help.blynk.cc/
  3. Add details :
    • Hardware model + communication type. For example: Arduino UNO with Ethernet Shield
    • Smartphone OS (iOS or Android) + version
    • Blynk server or local server
    • Blynk Library version
    • Add your sketch code. :point_up:Code should be formatted as example below.

Simply paste your code between ``` If you don’t format your code, your topic can be deleted by moderators.


void loop()

I am running RPi with Buster, the Blynk Python Library (V0.2.0) and MQTT (Python paho-mqtt) and am doing some testing on it’s stability.
Although I have had this running for a year or so, recently my “production” installation has become a bit unstable.
The Python programme on the RPi seems to be running OK, but the client on my phone (Moto E5 Android) says that the server was last seen at XX.XX but it comes up with a red icon and the App doesn’t send messages to the Python programme.
Restarting the Python programme on the RPi fixes the problem temporarily.

So I am trying to do some checking on what I am doing wrong! I have been running some test files for the last couple of days - and of course it is behaving perfectly !!!

One thing I would like is to check the logs that Blynk creates on the RPi - it may just show something up (but I have my doubts) - where does Blynk keep it’s logs?

I assume that the Android App doesn’t have logs? Or does it?

What else can I check? Is there any way I can interrogate the Blynk server in the cloud to see what it thinks is happening?

Any constructive suggestions gratefully accepted
Thanks
Bruce

Are you running local server on this Pi, or using the Blynk cloud server?
If the latter then I don’t think there will be any local logs.

With Arduino/ESP based projects, disconnections are usually down to bad coding. I’m afraid I don’t know anything about micro python, but if you share your code then somebody might be able to give some insight.
Don’t forget to put triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

I do a lot of stuff with MQTT and Blynk, but run Node-Red on my Pi and use the Blynk plug-in for Node-Red. My devices are ESP8266 based and simply run MQTT code on these devices.

Pete.

Hi Pete, I am using the Blynk cloud server, that way I can avoid opening up ports on my home router.

Like you I use a little Node-Red, but really only for displaying results on a web page. I have read your posts about your system(s) and it is very impressive. Persoanlly I am trying to just use MQ to exchange data and do as much as I can with Python on various RPis. I commonly use RPiZeros for local control and have an RPi3 as my main server (Web, MQTT, etc) although I am using a separate RPi3B+ for Blynk currently.

I was hoping that the local Blynk Python library would have put something on the local machine - pity if it doesn’t.

I am not sure it will help, but the current version of my test code (which seems to be working fine!) is attached. It is basically as simple and srtipped out as I can make it and is almost identical to one of the examples on the Blynk git pages.

import BlynkLib, time, datetime
import paho.mqtt.client as mqtt                     # sudo pip3 install paho-mqtt

BLYNK_AUTH = 'XXXXX'     # Blynk code
blynk = BlynkLib.Blynk(BLYNK_AUTH)                  # Initialize Blynk

mqttc=mqtt.Client()                                 # set alias as mqttc
mqttc.connect("192.168.1.203", 1883,60)             #sub Q on 203, port 1883, 60 sec keep alive 

# These functions are called asynchonously by Blynk --------------------
@blynk.VIRTUAL_WRITE(1)                             # Register Virtual Pin
def my_write_handler(value):                        # Heating
    if int(value[0])==1:
        stringon = (datetime.datetime.now().strftime("%a-%d-%H-%M-%S")+" ON  Heating ")
        print(stringon)                             # Print update
        mqttc.connect("192.168.1.203", 1883,60)     # connect server, port, keepalive
        mqttc.publish("hello/world", stringon ,1)     # Publish to MQ try QOS 1
        mqttc.disconnect()                          # disconnect
    else:
        stringoff = (datetime.datetime.now().strftime("%a-%d-%H-%M-%S")+" OFF  Heating ")
        print(stringoff)
        mqttc.connect("192.168.1.203", 1883,60)     # connect server, port, keepalive
        mqttc.publish("hello/world", stringoff ,1)  # Publish to MQ try QOS 1
        mqttc.disconnect()                          # disconnect

#-----------------------------------------------------------------------
@blynk.VIRTUAL_WRITE(2)                            #Register Virtual Pins
def my_write_handler(value):                       # Front light
    if int(value[0])==1:
        print(datetime.datetime.now().strftime("%a-%d-%H-%M-%S")+' ON  Front light')
    else:
        print(datetime.datetime.now().strftime("%a-%d-%H-%M-%S")+' OFF Front light')

#-----------------------------------------------------------------------
@blynk.VIRTUAL_WRITE(3)                            #Register Virtual Pins
def my_write_handler(value):                       # Spare
    if int(value[0])==1:
        print(datetime.datetime.now().strftime("%a-%d-%H-%M-%S")+' ON  GREEN')
    else:
        print(datetime.datetime.now().strftime("%a-%d-%H-%M-%S")+' OFF GREEN')
         
# --- Start of MAIN programme  -----------------------------------------    
while True: 
    blynk.run()                                     # Start Blynk (this call should never return)
    mqttc.loop()

Hi Bruce,
I see you’ve also responded in another topic about MQTT and Blynk, so I’ll just respond here to avoid duplication.

As you’re probably aware, a new version of Blynk is in the pipeline, and it might make MQTT direct integration easier. But to be honest the current Blynk contrib for Node-Red is fantastic and allows you to easily do Blynk to MQTT to Blynk messaging without any real effort at all.

I’d originally thought that I’d use RPIs as devices with sensors and controls, but for me that are far too cumbersome for that role and take far too long to boot. I find it much easier to use dedicated ESP based devices programmed in C++.

As far as the Python implementation of Blynk is concerned, I think it was originally a bit of a ‘hobby project’ and the v2 implementation wasn’t 100% backwards compatible with v1. I think it’s still largely a beta project.

Pete.

Is there a date for the release of the new version of Blynk?
If not I am thinking of either using a different language © on the RPi
Or maybe re-platform - maybe to a Wemos D1 Mini…

Still running tests on Python / Blynk / PahoMQTT and still getting failures after a few hours :frowning:

No, there’s no release date for the new version of Blynk. It was announced in the spring with imminent beta release, but no sign of the beta trials yet.

For me, the Wemos D1 Mini, programmed with C++ is the best option…

Pete.