Project

General

Profile

shell script - sainsmart relayboard

Added by wurmi over 2 years ago

hey @all,

i am pretty new at the domotiga forum so please be gentle if i ask some silly questions.

I want to set up a home automation system for my house. The SW runs on a raspberry pi 3 with domotiyii and smartvisu.
> this 2 systems are running well and i have, so far, no trouble with them (for now ;-)

Now the main question:
I want to use a sainsmart relayboard with a builtin TCP/IP webserver to switch the relay(s). Unfortunately there isn't a driver for the sainsmart board which works with pretty simple http requests
(e.g. 192.168.0.50/3000/00 > relay 1 on
192.168.0.50/3000/01 > relay 1 off)

Now i wrote a script with arguments, so that domotiga toggle the relays for my "impulse switches" (in german Stromstoßschalter)
(e.g. relay_toggle.sh 1 >> means that relay 1 is on for 0.5 sec and then off)
(enclosed you can find my script >on the console it works without any errors)

Unfortunately it is not possible (for me) to switch on the relay. I am not sure if domotiga SW execute the script.

May someone can help a newbie with this starting problems.

I am not a native english speaker, so please excuse any missunderstandings.

regards
wurmi


Replies (5)

RE: shell script - sainsmart relayboard - Added by wurmi over 2 years ago

Hey again,

it worked, but i have tried something else. I will try it with a python script with arguments.
I hope that will work for me.

Maybe i come back to the support forum with new questions.

regards
wurmi

RE: shell script - sainsmart relayboard - Added by wurmi over 2 years ago

Hey again,

now i have read many instructions and forum entries and my script is working (for now) > i made a python script to send requests to the relay board.
Now i have another issue:

My script toggle a relay > that works fine
I created a device which executes a shell script.
The problem is, that domotiga (or it seems to be) executes the script constantly (different time laps)

The interface runs the interval every 100 seconds.

May i did something wrong in the configuration of the device.

If somebody have a hint or anything else, i would appreciate it.

Many thanks in advance for your help on this topic.

regards

wurmi

RE: shell script - sainsmart relayboard - Added by wurmi over 2 years ago

Hey again,

I solved the issue with an event/action but i think it isn't very gentle.
But it works for now.

Now i ran into the next challenge. I want to activate it via smartvisu.

I can't figure out the right syntax in the basic.switch line at the smartvisu page.

Is there a kind of how to with a switch? I couldn't find a instruction for the switch, but i think
I made something wrong at the device configuration (keyword: the return for <_switch>;)

Many thanks in advance

Regards
Wurmi

RE: shell script - sainsmart relayboard - Added by rdnzl over 2 years ago

I guess that domotiga is polling your script to get the status, just query the arguments for the script for 'on' or 'off' only if they are there run your action in your script to toggle, otherwise just return the current state.

RE: shell script - sainsmart relayboard - Added by wurmi over 2 years ago

Thanks for the hint.

I will try to return the right values/states. But for now my setup works fine > including the connection with smartvisu.

regards
wurmi

    (1-5/5)