maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   Sonoff basic switch with SailfishOS (https://talk.maemo.org/showthread.php?t=100644)

Markkyboy 2019-01-28 13:07

Sonoff basic switch with SailfishOS
 
Hi all,

I currently have a Sonoff basic wifi switch (should have got the RF version, doh!) which uses an Android app called eWelink. So far, so good, at least for me as my first introduction to the I.O.T. (internet of things) and it runs nicely under SFOS 3.0.1.11 pending occasional network problems created by my ageing Netgear router.

For a later date, I'm looking at flashing the Sonoff Basic with either ESPEasy or Tasmota, I now have a USB TTL converter and some jumper cables, so I'm pretty much set to get on with it, just need to 'take the plunge!'.

I wondered if anyone else was successfully using any type of Sonoff switch with their SFOS device, if so, are you happy with the standard eWelink application?, perhaps you have flashed a different firmware to your switch?

Regards,

coderus 2019-01-28 15:01

Re: Sonoff basic switch with SailfishOS
 
flash Sonoff-Tasmota asap and use with local mqtt broker. i have home-assistant running on my home automation server.

Halftux 2019-01-28 15:51

Re: Sonoff basic switch with SailfishOS
 
Don't use original software, it is calling home to china.

When you know c/c++ it is easy to program and also easy to write software for maemo or sailfish. I have some at home running my own code which I can control with N900 or Jolla. But they are not connected to the internet only local wlan.

For home automation server I would also recommend tasmota.

Markkyboy 2019-01-28 16:40

Re: Sonoff basic switch with SailfishOS
 
Quote:

Originally Posted by Halftux (Post 1553239)
Don't use original software, it is calling home to china.

When you know c/c++ it is easy to program and also easy to write software for maemo or sailfish. I have some at home running my own code which I can control with N900 or Jolla. But they are not connected to the internet only local wlan.

For home automation server I would also recommend tasmota.

Yeah, calling home is not what I want but is kind of what I expect from free apps/software/etc. I much prefer the idea of operating within my local lan.

I checked out espeasy as an alternative to tasmota, the flashing seems a lot simpler for espeasy but tasmota mostly has my attention out of all choices.

I'm also pleased to read that the switch can be used with Jolla, this was key really to me going ahead and flashing. Looks like it was a good idea to ask, the more info the better. As some of you know, I've learned a little about writing code, but will no doubt be asking questions to those with experience.

I best get flashing then!, .....oo-er missus!

coderus 2019-01-28 16:52

Re: Sonoff basic switch with SailfishOS
 
Tasmota host own webpage which can be accessed by sailfish browser.
https://imgur.com/download/1LVVXbT
It is also have REST protocol for controlling modules, which can be used: https://github.com/arendst/Sonoff-Ta...i/Commands#web

Markkyboy 2019-01-29 18:02

Re: Sonoff basic switch with SailfishOS
 
Quote:

Originally Posted by coderus (Post 1553247)
Tasmota host own webpage which can be accessed by sailfish browser.
https://imgur.com/download/1LVVXbT
It is also have REST protocol for controlling modules, which can be used: https://github.com/arendst/Sonoff-Ta...i/Commands#web

This is a lot harder than I thought it would be. Took several attempts to flash the sonoff with tasmota and now, despite all the reading of so many pages, I am stuck on the wifi config page (192.168.4.1) and I keep coming back to that page. As per usual, I don't fully understand what I'm doing, but then a few hours ago, I knew nothing about any of it!

How the fk do I get past the WiFi Configuration Page!?

coderus 2019-01-29 19:48

Re: Sonoff basic switch with SailfishOS
 
i just edited my_user_config.h with actual ssid and password of my home wlan access point, no problems here.

Markkyboy 2019-01-29 19:52

Re: Sonoff basic switch with SailfishOS
 
Quote:

Originally Posted by coderus (Post 1553300)
i just edited my_user_config.h with actual ssid and password of my home wlan access point, no problems here.

Okay, I think I need to do something similar. I'm running out of patience for now. Will try flashing again tomorrow.

The sonoff does not show in my router, the only webpage I can get is the wifi configuration page, when I close that, the access point disappears. I have no idea what the actual IP of my device is.......too much information from so many different pages, as per usual, there are always hunks of info missing, hence page hopping trying to understand it all.

my_user_config tab in Arduino was one thing I had problems with, but got round it, I still feel I have missed out something. Feeling cold and hungry not helping, so b*ll*cks to it all for now...tomorrow is another day!

coderus 2019-01-29 20:02

Re: Sonoff basic switch with SailfishOS
 
The only page you should read is tasmota wiki, and there is a guide for beginners: https://github.com/arendst/Sonoff-Ta...Firmware-Build

pasko 2019-01-31 11:45

Re: Sonoff basic switch with SailfishOS
 
Hi.
I just found this thread and I can't believe I didn't find it before!. Already finished an Arduino project to control my Daikin AC from outside my home lan and I even had to solder my own circuit to power the led....
I have an energy monitor sending frames to an emoncms-based server.
I also have a 4-port usb-controlled power switch ( Gembird Energenie ) ....
And all this is becoming a mess...
I think it is time to redesign every bit of my home's network...
Best Regards.

Halftux 2019-01-31 20:02

Re: Sonoff basic switch with SailfishOS
 
Quote:

Originally Posted by pasko (Post 1553344)
Hi.
I just found this thread and I can't believe I didn't find it before!.

For the sonoff you could also upgrade the flash memory from 1mb to 4mb. I used the following chip.

winbond 25Q32FVSIG [3V 32M-Bit(4MB) Serial (SPI) Flash Memory].

But this could be for you more of interest and is more professional with an arduino inside. They have no wifi on board but a lan port.

https://www.controllino.biz/

https://www.industrialshields.com/ btw from spain.

Tested already controllino maxi and industrial shield mduino 58, 57R+ and ardbox. They are all great but you need to make your own code and apps.

pasko 2019-02-01 08:11

Re: Sonoff basic switch with SailfishOS
 
Quote:

Originally Posted by Halftux (Post 1553367)
For the sonoff you could also upgrade the flash memory from 1mb to 4mb. I used the following chip.

winbond 25Q32FVSIG [3V 32M-Bit(4MB) Serial (SPI) Flash Memory].

But this could be for you more of interest and is more professional with an arduino inside. They have no wifi on board but a lan port.

https://www.controllino.biz/

https://www.industrialshields.com/ btw from spain.

Tested already controllino maxi and industrial shield mduino 58, 57R+ and ardbox. They are all great but you need to make your own code and apps.

Hi.

Thank you very much for the info & the links.

Best Regards.

Markkyboy 2019-02-16 16:51

Re: Sonoff basic switch with SailfishOS
 
Finally, I got it all working, not sure where I went wrong initially, but now I have the tasmota web interface. No more crawling under tables on cold tiles to turn the power off.

Be nice if the web interface was.....a little less bland, but I understand that customising takes up valuable memory/space on the switch. Also, seeing as I'm only using a basic sonoff switch, it would be nice not to see all other buttons except 'Toggle', as that's all I can use anyway.

Thanks for input & hints guys.

EDIT: Initially, the tasmota web interface was slow, I blamed this on my ageing router. In the end, I checked out the Firmware Upgrade button, pursed my lips and clicked it.....within a few painless minutes, my tasmota fw was updated OTA from 5.4.1 to 6.4.1 and now the web interface is pretty quick (sorry Netgear DG384GT, you're forgiven!).

I think I will take a look at customising the web interface UI and reduce all other buttons except for 'Toggle' to a hidden menu......sounds like a challenge!

I also noticed a Home Automation app in Openrepos for SFOS (Home Assistant) that appears to be compatible with tasmota https://openrepos.net/content/aa13q/...sistant-client

coderus 2019-02-16 20:23

Re: Sonoff basic switch with SailfishOS
 
In Configuration -> Configure module you can choose your model (Sonoff Basic), and after restart it will only show available buttons in ui.

Markkyboy 2019-02-16 22:02

Re: Sonoff basic switch with SailfishOS
 
Quote:

Originally Posted by coderus (Post 1554081)
In Configuration -> Configure module you can choose your model (Sonoff Basic), and after restart it will only show available buttons in ui.

It was already set on that, but thanks for input though :)

Markkyboy 2019-02-18 11:48

Re: Sonoff basic switch with SailfishOS
 
1 Attachment(s)
Well, I kinda succeeded in altering the buttons on the Tasmota UI, not quite what I was after, but it is a start!

I'm not sure where the fine dotted black lines have come from on the 'Toggle' button, but at least the UI can be altered, even if only a little.

I used Atom to create the custom firmware, as per a hint from coderus. My only gripe with Atom is it causes 100% CPU usage. My system is not short on resources, yet it still takes around 30 minutes to compile the 520kb firmware.bin file.

Markkyboy 2019-02-21 15:02

Re: Sonoff basic switch with SailfishOS
 
3 Attachment(s)
Okay, after a short crash course in basic CSS style formatting and extensive fiddling with Tasmota's 'xrdv_01_webserver.ino' file via Atom, I finally got what I was after initially, narrower buttons and a black background, yay!...and for fun, I also made an SFOS style launcher icon to start Tasmota.

Also, I can now pinch-to-zoom the UI - handy for tired eyes late at night!

If anyone is remotely interested in this subject, leave a comment and I'll upload my current 'firmware.bin' for use with a Tasmota converted 'Sonoff Basic Switch'.

My file size when built: 520kb

Original UI on the left, my custom UI on the right - much better, no? ;)

pasko 2019-03-05 18:27

Re: Sonoff basic switch with SailfishOS
 
1 Attachment(s)
Quote:

Originally Posted by Markkyboy (Post 1554244)
Okay, after a short crash course in basic CSS style formatting and extensive fiddling with Tasmota's 'xrdv_01_webserver.ino' file via Atom, I finally got what I was after initially, narrower buttons and a black background, yay!...and for fun, I also made an SFOS style launcher icon to start Tasmota.

Also, I can now pinch-to-zoom the UI - handy for tired eyes late at night!

If anyone is remotely interested in this subject, leave a comment and I'll upload my current 'firmware.bin' for use with a Tasmota converted 'Sonoff Basic Switch'.

My file size when built: 520kb

Original UI on the left, my custom UI on the right - much better, no? ;)

Hi.

Yeah, much nicer UI....
I have also finally received a pair ofsonoff modules (a basic one & S20) and have already started to tinker.
I'm surprised about all the features already included in standard firmware.
Many thanks for the information.

Regards.

Markkyboy 2019-03-07 09:32

Re: Sonoff basic switch with SailfishOS
 
Cool, I'm pleased someone else is interested. That's an odd looking ip address on your screenshot - normally, I've only seen 'sonoff-11730' (example) when setting up the wifi portion of the switch, but hey, looks like you have it all working anyway.

I've ordered a Sonoff RF bridge, as I have at least 4 RF (433mhz) controlled items (lamps, roller shutter, etc), ordered it from bang_good China but it looks like it is coming from the UK, I guess bang_good has a drop ship agent in UK, still seems to be taking forever to get here though........flasher at the ready!, what pleases me more, is that fact that despite how shitty Sailfish Browser is, we can still use it with Tasmota.

I've had a stab at making a Tasmota SailfishOS app using WebView, so far so good, but I've come across plenty of problems I have no idea how to solve, for example, when setting a Timer in Sonoff Basic with Tasmota, I tap on the digits to adjust/choose the hours or minutes of the timer, but nothing happens, in the normal web version, it opens a new page with the options listed, no biggie, I'll work it out, but really, i just enjoy the journey of discovery and learning with as little help as possible.

Yeah, the Sonoff development file contains lots of data to play with, much of which I don't understand (yet), but just as with my Jolla1 when I got, I wanted a black theme and there wasn't one, so with a bit of help, I made one. This applied to the Tasmota UI, my first thought being "wow, that's ****ing bland!, time to fiddle!" ;)

still fiddling, always fiddling, if it can be hacked, then hack it!

pasko 2019-03-16 08:48

Re: Sonoff basic switch with SailfishOS
 
Quote:

Originally Posted by Markkyboy (Post 1554940)
Cool, I'm pleased someone else is interested. That's an odd looking ip address on your screenshot - normally, I've only seen 'sonoff-11730' (example) when setting up the wifi portion of the switch, but hey, looks like you have it all working anyway.

I've ordered a Sonoff RF bridge, as I have at least 4 RF (433mhz) controlled items (lamps, roller shutter, etc), ordered it from bang_good China but it looks like it is coming from the UK, I guess bang_good has a drop ship agent in UK, still seems to be taking forever to get here though........flasher at the ready!, what pleases me more, is that fact that despite how shitty Sailfish Browser is, we can still use it with Tasmota.

I've had a stab at making a Tasmota SailfishOS app using WebView, so far so good, but I've come across plenty of problems I have no idea how to solve, for example, when setting a Timer in Sonoff Basic with Tasmota, I tap on the digits to adjust/choose the hours or minutes of the timer, but nothing happens, in the normal web version, it opens a new page with the options listed, no biggie, I'll work it out, but really, i just enjoy the journey of discovery and learning with as little help as possible.

Yeah, the Sonoff development file contains lots of data to play with, much of which I don't understand (yet), but just as with my Jolla1 when I got, I wanted a black theme and there wasn't one, so with a bit of help, I made one. This applied to the Tasmota UI, my first thought being "wow, that's ****ing bland!, time to fiddle!" ;)

still fiddling, always fiddling, if it can be hacked, then hack it!

Hi.

Hahaha. The same that happened to you with your black theme happened to me with the serial USB adapter: I bought one a few years ago to access the boot messages of a faulty Nokia N9 and never used it again.... untill now. :)
The weird hostname in my case may come from the fact that I'm not using the regular 192.168.X.Y addressing schema at home, but I really don't know.
The devices took some time to arrive here to Spain as well: around 3 weeks more or less.
I also wrote a public transport app for SailfishOS last year but it turned to be ** quite ** complicated.
Now I'm thinking about uses for the devices. The S20 is controlling a lamp in the living room and I set it to be controlled with voice commands with a small script I built out from cmusphinx.
I would like to replace my old thermostat with a wifi enabled one, the problem is that it must be fed with batteries and I don't think this can be done with ESP8266.
Projects, projects..... and no time to do them.:)

Regards.

Markkyboy 2019-03-29 12:52

Re: Sonoff basic switch with SailfishOS
 
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.

Markkyboy 2019-04-03 12:06

Re: Sonoff basic switch with SailfishOS
 
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;
        }
    }


Markkyboy 2019-04-18 16:30

Re: Sonoff basic switch with SailfishOS
 
Quote:

Originally Posted by Markkyboy (Post 1555887)
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 :/

coderus 2019-04-18 16:47

Re: Sonoff basic switch with SailfishOS
 
your timer hides label after 5 seconds

Thoke 2019-04-19 08:47

Re: Sonoff basic switch with SailfishOS
 
What @coderus said and to explain further the opacity is never set back to 1.0 so it will never return to be visible.

Markkyboy 2019-04-21 09:19

Re: Sonoff basic switch with SailfishOS
 
Quote:

Originally Posted by coderus (Post 1556215)
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.

Markkyboy 2019-04-21 09:27

Re: Sonoff basic switch with SailfishOS
 
Quote:

Originally Posted by Thoke (Post 1556222)
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.

coderus 2019-04-21 10:04

Re: Sonoff basic switch with SailfishOS
 
set text, set opacity to 1, start timer

Markkyboy 2019-05-02 10:41

Re: Sonoff basic switch with SailfishOS
 
Quote:

Originally Posted by coderus (Post 1556238)
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.

coderus 2019-05-02 10:44

Re: Sonoff basic switch with SailfishOS
 
assign id for your TImer, remove running: true, after mainText.text = line add mainText.opacity = 1.0 and yourTImerId.start()

coderus 2019-05-02 13:25

Re: Sonoff basic switch with SailfishOS
 
add
statusText.opacity = 1.0
timer.start()
after you received the response from server, not in the timer :)

Markkyboy 2019-05-02 17:53

Re: Sonoff basic switch with SailfishOS
 
Quote:

Originally Posted by coderus (Post 1556607)
add
statusText.opacity = 1.0
timer.start()
after you received the response from server, not in the timer :)

Nice one coderus, thank you.

Regards,


All times are GMT. The time now is 04:56.

vBulletin® Version 3.8.8