ehooo / django_mqtt Goto Github PK
View Code? Open in Web Editor NEWDjango mqtt publisher
License: BSD 3-Clause "New" or "Revised" License
Django mqtt publisher
License: BSD 3-Clause "New" or "Revised" License
Thanks for your reference @ehooo but I facing issues for commands in windows because you only given UNIX commands here but I needed Windows Commands
Hi Team,
I'm using Django 2.2.6 and Python 3.7
I'm facing this issue please resolve it.
Thanks.
class ACL(models.Model):
File "/home/enigma/Desktop/project_iot/backend/venv/src/django-mqtt/django_mqtt/models.py", line 202, in ACL
topic = models.ForeignKey(Topic) # There is many of acc options by topic
TypeError: init() missing 1 required positional argument: 'on_delete'
I can't add the certificates. I encountered two errors
Select a valid choice. VerifyMode.CERT_REQUIRED is not one of the available choices.
Select a valid choice. _SSLMethod.PROTOCOL_TLSv1 is not one of the available choices.
I am facing some difficulty to integrate MQTT in Django ORM it showing error, I don't know how to solve the problem, So please help me. I am giving you the snippet of my code.
import paho.mqtt.client as mqtt
import json
import time
from django.conf import settings
#from .models import Emp
#from MQTT.views import get_detail
MQTT_DEFAULT_USER = '50000025'
MQTT_DEFAULT_PASSWORD = 'Test@1234'
def on_connect(client, userdata, flags, rc):
print("on_connect")
client.subscribe('sh/k',qos=1)
def on_message(client, userdata, message):
print("This is on_message function !!!!")
data=message.payload.decode()
print(data)
data=json.loads(data)
print('-----------------------------')
ret=get_detail(data)
if message.payload:
client.publish("s/us",ret)
print("...done...")
def on_log(client, userdata, level, buf): # this is call back function
print("Logs :"+buf)
client = mqtt.Client('rahul')
client.username_pw_set(MQTT_DEFAULT_USER, MQTT_DEFAULT_PASSWORD )
client.on_message = on_message
client.on_connect = on_connect
client.on_log = on_log
client.connect('192.168.02.125', port=1883)
from django.shortcuts import render
from .models import Emp
import json
def get_detail(data):
data=Emp.objects.filter(name=data.name)[0]
data=json.dumps(data)
return data
from django.db import models
class Emp(models.Model):
name=models.CharField(max_length=50)
address=models.CharField(max_length=50)
salary=models.DecimalField(max_digits=10,decimal_places=2)
class Meta:
db_table='emp'
These are the file which is containing my Django project, I want to do the operation on that data which is provided an MQTT publisher client and send the data means publish one topic with the response data. how to do.
Hi,
I am using Django 3.1.1 and Python 3.7.
When I try to delete a topic, I get this Error:
unhashable type: 'Topic'
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/django_mqtt/topic/3/delete/
Django Version: 3.1.1
Exception Type: TypeError
Exception Value: unhashable type: 'Topic'
It would be great if you could provide a few clearer examples of how you use the MQTT connection in a Django app.
I'm specifically wanting to do the following two tasks but am unsure how:
Many thanks in advance.
Create test splited
On Mosquitto auth get the user from the settings
Create Dockerfile allowing create images with different python and django versions
I see this popular project uses the GPL license. Often in Python land I've learned this isn't always intentional, and sometimes a mistake.
Is your intention that any project that uses this library should be open sourced as GPL?
Basically, an commercial usage of this library in a private project is now forbidden and risks lawsuit.
If that wasn't your intention, could you please change the license to LGPL? (or BSD). Using the LGPL would still enforce authors to contribute any changes to this library, but no longer enforces any project that uses this library to become GPL too.
fixed!
Hi,
Could anyone give me a tip on getting setup? Do I need Linux to run this or is Windows 10 Ok?
I would like to try this but very new to MQTT and mostly newb to Django but I understand some of the steps and work flow.
How user for publish data con MQTT server ?
Is this all on the same machine? To run the MQTT broker through Django and also a client application?
Thank you for any help this seems like a cool project.
Mysql 5.6
I'm running Django 1.11.5 and would like to connect to a MQTT broker using your library. I see in the requirements.txt
you've limited the Django version to v1.9.1. Is there a specific reason for this?
Line 1 in d61bdc9
django_mqtt/django_mqtt/models.py
Line 197 in fc373cc
How to install it on Django?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.