Tellstick Duo and Linux - How to monitor Nexa Magnet Switch

Moderator: Telldus

Post Reply
Duo2015
Posts: 1
Joined: Fri Mar 17, 2023 9:45 am

Tellstick Duo and Linux - How to monitor Nexa Magnet Switch

Post by Duo2015 »

Hi!

I bought Tellstick Duo and have tested it on my Mac and Linux (Debian) server. I have a few Nexa devices, one LMST-606 magnet switch and two these what you plug into power socket and plug a device and you can turn it on or off by Nexa remote or Tellstick.

I made a PHP-script so when Tellstick Duo is connected to my Linux computer, for example I can turn my lights on by going to address:

http://server.ip/control.php?device=1&mode=1

And that executes 'tdtool -n 1' and it works.

Next I want make monitor.php which receives data from that Magnet switch, logs it and decides everything what to do. In Mac I can see switch log using TelldusCenter and Telldus Live. But I don't want use Telldus Live and my Mac for this.

I need a script that monitors that switch 24/7. I can't make 24/7 running script in PHP, and I have no experience about other programming languages. I think I need Python to do this.

On my Mac I have set switch open code for device 2 and switch close for device 3. I know how to add these in Linux. So I need a script that monitors and when switch send some signal: if it's device 2 then 'curl http://server.ip/monitor.php?device=2' and if it's device 3 then 'curl http://server.ip/monitor.php?device=3'.

I think this would be easy, but I have no experience about Python. So I need help how to run it 24/7 etc. It doesn't need to be Python, it just needs to work in Linux.

Sorry for bad english, but I hope somebody helps me. :)
Post Reply