Modify PubSub client in python

#1

Hi,
I have very little experience with python and twisted so I'm sorry if
this is a simple question.
I have a script with an event loop already (not twisted) that reads
data from a serial port. When I get data on the serial port I want to
publish an event to the simple PubSub server. How do I do this? Anyone
have some example code?

0 Likes

#2

Hi Magnus,

I have polished up the demo

https://github.com/oberstet/Autobahn/tree/master/demo/serial2ws

which has an Arduino with 2 Potis and 1 LED conneced over Serial to an
Autobahn server.

The latter exports an RPC method to control the LED and produces PubSub
events for new analog values.

You can use this code and modify it for your needs ...

\Tobias

···

Am 30.01.2012 11:03, schrieb Magnus Johansson:

Hi,
I have very little experience with python and twisted so I'm sorry if
this is a simple question.
I have a script with an event loop already (not twisted) that reads
data from a serial port. When I get data on the serial port I want to
publish an event to the simple PubSub server. How do I do this? Anyone
have some example code?

0 Likes

#3

Tobias

How about decorating the pot reading with "flot"?

http://people.iola.dk/olau/flot/examples/realtime.html

···

On Jan 30, 1:23 pm, Tobias Oberstein <tobias.o...@gmail.com> wrote:

Hi Magnus,

I have polished up the demo

https://github.com/oberstet/Autobahn/tree/master/demo/serial2ws

which has an Arduino with 2 Potis and 1 LED conneced over Serial to an
Autobahn server.

The latter exports an RPC method to control the LED and produces PubSub
events for new analog values.

You can use this code and modify it for your needs ...

\Tobias

Am 30.01.2012 11:03, schrieb Magnus Johansson:

> Hi,
> I have very little experience with python and twisted so I'm sorry if
> this is a simple question.
> I have a script with an event loop already (not twisted) that reads
> data from a serial port. When I get data on the serial port I want to
> publish an event to the simple PubSub server. How do I do this? Anyone
> have some example code?

0 Likes

#4

Thanks for the idea of adding some nice visual bling :wink:

Flot is a mature, powerful general charting lib .. however I found

which is purpose built for _real-time_ charting .. and is better in

this
respect than Flot. IMHO.
Here you go:
\Tobias

···

http://smoothiecharts.org/


Tobias
How about decorating the pot reading with "flot"?
On Jan 30, 1:23 pm, Tobias Oberstein wrote:

Hi Magnus,
I have polished up the demo
which has an Arduino with 2 Potis and 1 LED conneced over Serial to an
Autobahn server.
The latter exports an RPC method to control the LED and produces PubSub
events for new analog values.
You can use this code and modify it for your needs ...
\Tobias
Am 30.01.2012 11:03, schrieb Magnus Johansson:
Hi,
I have very little experience with python and twisted so I'm sorry if
this is a simple question.
I have a script with an event loop already (not twisted) that reads
data from a serial port. When I get data on the serial port I want to
publish an event to the simple PubSub server. How do I do this? Anyone
have some example code?

http://people.iola.dk/olau/flot/examples/realtime.htmltobias...@gmail.comhttps://github.com/oberstet/Autobahn/tree/master/demo/serial2ws

0 Likes

#5

that sucks .. there should have been a screenshot .. got lost.
anyway .. I do a video tomorrow .. code is on github

···

On Jan 31, 12:12 am, Tobias Oberstein <tobias.o...@gmail.com> wrote:

Thanks for the idea of adding some nice visual bling :wink:

Flot is a mature, powerful general charting lib .. however I found

http://smoothiecharts.org/

which is purpose built for _real-time_ charting .. and is better in this
respect than Flot. IMHO.

Here you go:

bla

\Tobias

Am 30.01.2012 17:27, schrieb yOPERO:

> Tobias

> How about decorating the pot reading with "flot"?

>http://people.iola.dk/olau/flot/examples/realtime.html

> On Jan 30, 1:23 pm, Tobias Oberstein<tobias.o...@gmail.com> > > wrote:
>> Hi Magnus,

>> I have polished up the demo

>>https://github.com/oberstet/Autobahn/tree/master/demo/serial2ws

>> which has an Arduino with 2 Potis and 1 LED conneced over Serial to an
>> Autobahn server.

>> The latter exports an RPC method to control the LED and produces PubSub
>> events for new analog values.

>> You can use this code and modify it for your needs ...

>> \Tobias

>> Am 30.01.2012 11:03, schrieb Magnus Johansson:

>>> Hi,
>>> I have very little experience with python and twisted so I'm sorry if
>>> this is a simple question.
>>> I have a script with an event loop already (not twisted) that reads
>>> data from a serial port. When I get data on the serial port I want to
>>> publish an event to the simple PubSub server. How do I do this? Anyone
>>> have some example code?

0 Likes

#6

Not to worry my friend, I can see the nice ploting chart moving.

In fact I have seen smothie charts when searching but I was not aware
it was built for real charting, to be honest I choose flot because it
has more examples.

Well I should say we have the bare bones set. Now it's time for
appliying all within "serial2ws" to a real project.

Cheers

yOPERO.

···

On Jan 31, 12:15 am, tgo <tobias.o...@gmail.com> wrote:

that sucks .. there should have been a screenshot .. got lost.
anyway .. I do a video tomorrow .. code is on github

On Jan 31, 12:12 am, Tobias Oberstein <tobias.o...@gmail.com> > wrote:

> Thanks for the idea of adding some nice visual bling :wink:

> Flot is a mature, powerful general charting lib .. however I found

>http://smoothiecharts.org/

> which is purpose built for _real-time_ charting .. and is better in this
> respect than Flot. IMHO.

> Here you go:

> bla

> \Tobias

> Am 30.01.2012 17:27, schrieb yOPERO:

> > Tobias

> > How about decorating the pot reading with "flot"?

> >http://people.iola.dk/olau/flot/examples/realtime.html

> > On Jan 30, 1:23 pm, Tobias Oberstein<tobias.o...@gmail.com> > > > wrote:
> >> Hi Magnus,

> >> I have polished up the demo

> >>https://github.com/oberstet/Autobahn/tree/master/demo/serial2ws

> >> which has an Arduino with 2 Potis and 1 LED conneced over Serial to an
> >> Autobahn server.

> >> The latter exports an RPC method to control the LED and produces PubSub
> >> events for new analog values.

> >> You can use this code and modify it for your needs ...

> >> \Tobias

> >> Am 30.01.2012 11:03, schrieb Magnus Johansson:

> >>> Hi,
> >>> I have very little experience with python and twisted so I'm sorry if
> >>> this is a simple question.
> >>> I have a script with an event loop already (not twisted) that reads
> >>> data from a serial port. When I get data on the serial port I want to
> >>> publish an event to the simple PubSub server. How do I do this? Anyone
> >>> have some example code?

0 Likes

#7

I do confirm it works with public IP.

···

On Jan 31, 12:51 am, yOPERO <yope...@googlemail.com> wrote:

Not to worry my friend, I can see the nice ploting chart moving.

In fact I have seen smothie charts when searching but I was not aware
it was built for real charting, to be honest I choose flot because it
has more examples.

Well I should say we have the bare bones set. Now it's time for
appliying all within "serial2ws" to a real project.

Cheers

yOPERO.

On Jan 31, 12:15 am, tgo <tobias.o...@gmail.com> wrote:

> that sucks .. there should have been a screenshot .. got lost.
> anyway .. I do a video tomorrow .. code is on github

> On Jan 31, 12:12 am, Tobias Oberstein <tobias.o...@gmail.com> > > wrote:

> > Thanks for the idea of adding some nice visual bling :wink:

> > Flot is a mature, powerful general charting lib .. however I found

> >http://smoothiecharts.org/

> > which is purpose built for _real-time_ charting .. and is better in this
> > respect than Flot. IMHO.

> > Here you go:

> > bla

> > \Tobias

> > Am 30.01.2012 17:27, schrieb yOPERO:

> > > Tobias

> > > How about decorating the pot reading with "flot"?

> > >http://people.iola.dk/olau/flot/examples/realtime.html

> > > On Jan 30, 1:23 pm, Tobias Oberstein<tobias.o...@gmail.com> > > > > wrote:
> > >> Hi Magnus,

> > >> I have polished up the demo

> > >>https://github.com/oberstet/Autobahn/tree/master/demo/serial2ws

> > >> which has an Arduino with 2 Potis and 1 LED conneced over Serial to an
> > >> Autobahn server.

> > >> The latter exports an RPC method to control the LED and produces PubSub
> > >> events for new analog values.

> > >> You can use this code and modify it for your needs ...

> > >> \Tobias

> > >> Am 30.01.2012 11:03, schrieb Magnus Johansson:

> > >>> Hi,
> > >>> I have very little experience with python and twisted so I'm sorry if
> > >>> this is a simple question.
> > >>> I have a script with an event loop already (not twisted) that reads
> > >>> data from a serial port. When I get data on the serial port I want to
> > >>> publish an event to the simple PubSub server. How do I do this? Anyone
> > >>> have some example code?

0 Likes