Send data to

Python and python framework
Post Reply
Posts: 1
Joined: Saturday 08 September 2018 22:34
Target OS: -
Domoticz version:

Send data to

Post by GieBek » Saturday 08 September 2018 22:54

Hello everyone and I am asking for help.

I have been struggling with this for a long time.
I would love to send readings from the sensors to the website
I managed to send something with Easyesp but I'm not here.

I am asking for a script that will send several readings from the sensors.

Example of Phyton codes from the site. Most descriptions are on the site. Maybe it's easier to write code in LUA or dzVents?

I'm giving up !!! :( :x

And I'm sorry for my English. Google translator helped me.

Spoiler: show
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# by Roman Vishnevsky aka.x0x01 @

import socket

# MAC адрес устройства. Заменить на свой!
DEVICE_MAC = '0123456789012'

# идентификатор устройства, для простоты добавляется 01 (02) к mac устройства

# значения датчиков, тип float/integer
sensor_value_1 = 20
sensor_value_2 = -20.25

# создание сокета
sock = socket.socket()

# обработчик исключений
# подключаемся к сокету
sock.connect(('', 8283))

# пишем в сокет еденичное значение датчика
sock.send("#{}\n#{}#{}\n##".format(DEVICE_MAC, SENSOR_ID_1, sensor_value_1))

# пишем в сокет множественные значение датчиков
# sock.send("#{}\n#{}#{}\n#{}#{}\n##".format(DEVICE_MAC, SENSOR_ID_1, sensor_value_1, SENSOR_ID_2, sensor_value_2))

# читаем ответ
data = sock.recv(1024)
print data
except socket.error, e:
print('ERROR! Exception {}'.format(e))
narodmon.JPG (246.25 KiB) Viewed 182 times

Post Reply

Who is online

Users browsing this forum: elgringo, Google [Bot] and 5 guests