<commit_before>#!/usr/bin/python
#
# used to interface the NinjaCape to openHAB via MQTT
# - reads data from serial port and publishes on MQTT client
# - writes data to serial port from MQTT subscriptions
#
# - uses the Python MQTT client from the Mosquitto project http://mosquitto.org (now in Paho)
#
# https://github.com/perrin7/ninjacape-mqtt-bridge
# perrin7
 
import serial
import paho.mqtt.client as mqtt
import os
import json
import threading
import time

### Settings
serialdev = '/dev/ttyO1'
broker = "127.0.0.1" # mqtt broker
port = 1883 # mqtt broker port

debug = False  ## set this to True for lots of prints

# buffer of data to output to the serial port
outputData = []
 
####  MQTT callbacks<commit_msg>added serial definition for raspberry pi<commit_after>#!/usr/bin/python
#
# used to interface the NinjaCape to openHAB via MQTT
# - reads data from serial port and publishes on MQTT client
# - writes data to serial port from MQTT subscriptions
#
# - uses the Python MQTT client from the Mosquitto project http://mosquitto.org (now in Paho)
#
# https://github.com/perrin7/ninjacape-mqtt-bridge
# perrin7
 
import serial
import paho.mqtt.client as mqtt
import os
import json
import threading
import time

### Settings
serialdev = '/dev/ttyO1' # for BBB
# serialdev = '/dev/ttyAMA0' # for RPi

broker = "127.0.0.1" # mqtt broker
port = 1883 # mqtt broker port

debug = False  ## set this to True for lots of prints

# buffer of data to output to the serial port
outputData = []
 
####  MQTT callbacks
{'fraction_non_alphanumeric': 0.08965062623599208, 'fraction_numerical': 0.017798286090969017, 'mean_word_length': 3.8810289389067525, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5602305', 'n_tokens_mistral': 532, 'n_tokens_neox': 502, 'n_words': 192}