Active Topics

 


Reply
Thread Tools
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espaņa
#21
I also found another app in Jolla Store which works well with Tasmota/Sonoff; that app is 'd1webclient' by jsm.

With a few minor changes made in the UI, it is very usable. With this app, you can combine all functions to its 'main page', so no need to see the full Tasmota UI every time, quite handy I thought. Functions can be added to the cover; example: I can turn off my desk lamp from the cover - very handy indeed if you have one particular function you use regularly.
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
 

The Following 2 Users Say Thank You to Markkyboy For This Useful Post:
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espaņa
#22
I need some help with the following;

I'm making a webview app for tasmota, it has 2 preset cover actions; 1 for toggling power of my 'sonoff basic' and the other for my main desk lamp via 'sonoff RF bridge'.

When I press either of my cover action buttons, I get the desired result (light off or on; power off or on), the first press of either button returns the http response data and displays it on the cover, but pressing either of the cover actions after the initial press, the response message is not displayed - why is this response text not repeatable?, what do i need to do so that each time a cover action is pressed, I get the response text displayed.

I think Timer may have something to do with the problem, or does it?,

Here's my code so far;

Code:
        CoverAction {
            iconSource: "image://theme/icon-cover-location"
            onTriggered: getData();

            function getData(url) {
                var xhttp = new XMLHttpRequest();
                var url = "http://192.168.1.201/cm?cmnd=rfkey1"

                xhttp.onreadystatechange=function() {
                    if (xhttp.readyState == XMLHttpRequest.DONE) {
                        console.log(xhttp.responseText);
                        mainText.text = xhttp.responseText;
                    }
                };
                xhttp.open("GET", url);
                xhttp.send();
            }
        }
    }
    Label {
        text: ""
        id: mainText
        x: Theme.paddingMedium
        horizontalAlignment: Text.AlignHCenter
        font.pixelSize: Theme.fontSizeExtraSmall
        width: parent.width -x*2
        anchors {
            bottom: cover.bottom
            bottomMargin: Theme.paddingLarge*4
            horizontalCenter: parent.horizontalCenter
        }
        Timer {
            interval: 5000; running: true;
            onTriggered: mainText.opacity = 0.0;
        }
    }
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
 

The Following 2 Users Say Thank You to Markkyboy For This Useful Post:
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espaņa
#23
Originally Posted by Markkyboy View Post
I need some help with the following;

I'm making a webview app for tasmota, it has 2 preset cover actions; 1 for toggling power of my 'sonoff basic' and the other for my main desk lamp via 'sonoff RF bridge'.

When I press either of my cover action buttons, I get the desired result (light off or on; power off or on), the first press of either button returns the http response data and displays it on the cover, but pressing either of the cover actions after the initial press, the response message is not displayed - why is this response text not repeatable?, what do i need to do so that each time a cover action is pressed, I get the response text displayed.

I think Timer may have something to do with the problem, or does it?,

Here's my code so far;

Code:
        CoverAction {
            iconSource: "image://theme/icon-cover-location"
            onTriggered: getData();

            function getData(url) {
                var xhttp = new XMLHttpRequest();
                var url = "http://192.168.1.201/cm?cmnd=rfkey1"

                xhttp.onreadystatechange=function() {
                    if (xhttp.readyState == XMLHttpRequest.DONE) {
                        console.log(xhttp.responseText);
                        mainText.text = xhttp.responseText;
                    }
                };
                xhttp.open("GET", url);
                xhttp.send();
            }
        }
    }
    Label {
        text: ""
        id: mainText
        x: Theme.paddingMedium
        horizontalAlignment: Text.AlignHCenter
        font.pixelSize: Theme.fontSizeExtraSmall
        width: parent.width -x*2
        anchors {
            bottom: cover.bottom
            bottomMargin: Theme.paddingLarge*4
            horizontalCenter: parent.horizontalCenter
        }
        Timer {
            interval: 5000; running: true;
            onTriggered: mainText.opacity = 0.0;
        }
    }
Hmmm, okay, no responses then, I guess that means nobody knows the answer..?, fair enough!, back to the drawing board :/
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
 

The Following User Says Thank You to Markkyboy For This Useful Post:
coderus's Avatar
Posts: 6,436 | Thanked: 12,701 times | Joined on Nov 2011 @ Ängelholm, Sweden
#24
your timer hides label after 5 seconds
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following 2 Users Say Thank You to coderus For This Useful Post:
Posts: 284 | Thanked: 661 times | Joined on Aug 2013 @ Finland
#25
What @coderus said and to explain further the opacity is never set back to 1.0 so it will never return to be visible.
 

The Following 2 Users Say Thank You to Thoke For This Useful Post:
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espaņa
#26
Originally Posted by coderus View Post
your timer hides label after 5 seconds
correct, that's what I want it to do and when a cover action is pressed again, I want the test to appear and fade away again, but I cannot work out how to make the text re-appear on the next press.
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
 

The Following User Says Thank You to Markkyboy For This Useful Post:
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espaņa
#27
Originally Posted by Thoke View Post
What @coderus said and to explain further the opacity is never set back to 1.0 so it will never return to be visible.
Yep, I already know that is the problem, which is why I am asking for a resolution, I don't know how to make the text visible again when the cover action is pressed again.
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
 

The Following 3 Users Say Thank You to Markkyboy For This Useful Post:
coderus's Avatar
Posts: 6,436 | Thanked: 12,701 times | Joined on Nov 2011 @ Ängelholm, Sweden
#28
set text, set opacity to 1, start timer
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following 3 Users Say Thank You to coderus For This Useful Post:
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espaņa
#29
Originally Posted by coderus View Post
set text, set opacity to 1, start timer
Thanks, could you give me an idea of syntax?, how to lay it out?, I'm looking for examples but not finding much related.
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
 

The Following User Says Thank You to Markkyboy For This Useful Post:
coderus's Avatar
Posts: 6,436 | Thanked: 12,701 times | Joined on Nov 2011 @ Ängelholm, Sweden
#30
assign id for your TImer, remove running: true, after mainText.text = line add mainText.opacity = 1.0 and yourTImerId.start()
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following 3 Users Say Thank You to coderus For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 17:26.