March 24, 2020 at 7:40 am #64774
OSPI with gpio setup to control relays
16 virtual stations
master station is an http station that turns on a sonoff controller running tasmota and receives http commands, and has an api of its own.
currently using the above, and i wish to setup my virtual stations via http api commands.
this is currently my steps and the issues im encountering..
when i add more stations to my open sprinkler via the options screen, the virtual stations appear, and i can click them individually to set them up. they all work normal as intended when i set them up manually.
when i try to set them up via http api, i have some issues.
When i send the command, the station type is not changed, and nothing besides the name is changed when i send my http request.
After that, I click the station, and ONLY change the station type to http, and then save.
I send the command again, and the information is posted to the station settings, except that I can not set the master flag, and
also im having an issue with sending the ‘on’ and ‘off’ commands correctly.
my tasmota controller works with the following url sent to it, but when I send the http api request to opensprinkler, my ‘on’ command only turns to ‘cm’ and my ‘off’ command says ‘undefined’
the bit/dividing/comprehension level needed to make a station use ‘master1’ or ‘master2’ is rubbish.
trying different master flag values ive unknowingly changed master station settings for other zones, and have wasted enough time trying to figure this out on my own and would love for anyone to chime in, and would be greatly appreciated.
mattMarch 24, 2020 at 7:42 am #64776
Why did you have to use API to set these attributes? Why not just use the UI to set them?March 24, 2020 at 10:40 am #64785
The 16 virtual stations, are intended to be the original 8 stations, but each station in the first 8 using the master1 valve (tasmota switch) and the second set of 8 using master2 valve.
After searching the forums for ‘master station’ and reading for 5 hours after I posted my question, I have seen you have replied to many people, many times, explaining that making a program that runs as the ‘master station’ as the same time as a programmed station. This is *not* an option for me, and the method ive described is much easier to manage using a zone when I need it, with whatever pump i need without any disabled configured programs or headaches
Especially when I want to run one single station for an extra 10 seconds, Im not trying to make individual programs just for each zone to run the master station.
In my opinion Ive found the best way to utilize this option, I have a few dozen controllers to implement this to, and would prefer to speed the process up some.
Please, help me with any info you can, would greatly appreciate it.March 24, 2020 at 12:52 pm #64787
discovered an issue with what i trying to accomplish. will update when back at computerMarch 24, 2020 at 10:10 pm #64789
So I realized I was trying to do too many things at once trying to figure out how to use the api correctly.
Setting up a http station, using the url style shown with special characters, that is still a problem for me.
However, in the example above I was trying to enable the master station, but this is not the case.
The Url command is actually to make the setting necessary, for that station to be used as the master station.
After that, I go on to change the master1 and master2 station index via API (that works!)
Then finally, I send an http request to setup a virtual zone as the *GPIO* settings I need, Which also work!
However, in the following url I still for the life of me cannot figure out how to enable the master1/master2 flags, and enable sequential.
link example there sets up the station using gpio20 as active low.
Any advice on correctly formed URL for setting up the master stations?
Any corrections needed while setting up the additional virtual stations to get the master station and sequential flags enabled?
mattMarch 24, 2020 at 10:22 pm #64796
First, I suggest that you split your command into separate commands. There is no need to put all changes in one command. You can do:
first to set the special station attribute of that zone
and in a separate command you can do:
to set sequential bitfields, and master operation bitfield. Please note that the /cs command has no parameters named ‘stn_seq’. The parameter you should be using is q0, and it’s a bit-field (i.e. it sets sequential bits for a set of 8 zones at a time). Check the API document to see the available parameters:
You said you “cannot figure out how to enable the master1/master2 flags”, can you be more specific about what’s the symptom? What’s the result you get when you run the command. If it’s successful, what did it end up changing and how does it differ from what you intended?
March 25, 2020 at 12:55 pm #64807
- This reply was modified 3 days, 17 hours ago by Ray.
Section 10 of the API Document says ‘See Section 8’ when referring to ‘masop’ while trying to determine how i can set up the masterzone use. Again in the ‘sid,st,sd’ line it refers to ‘see section 8’ — with the references to section 8 so much, i figured all variables, or the most likely ones would still be able to modified with the ‘cs’ change station parameters.
obviously not maxlen but there isnt a clear explanation for stn_seq parameter. In the API there is a typo and its referred to as well “snt_seq” and i also tried that parameter with no success.
the parameter of ‘q0’ and or ‘qO’ is not in the api document at all.
I have sent the url ‘cs?pw=password&sid=20&m0=01&st=3&sd=200’
as well as m0=126 m0=128 m0=112 because the jn? command gives me these results for masop
when i try m0=01 nothing changed.
anything ive sent has given me a response of ‘result:1’
before sending any http commands, i manually set stations 1-8 with ‘Use Master 1’ (enabled, checked, etc)
after sending different numbers, different stations ‘Use master 1’ become unchecked, and which disable, changes with each number attempt sent via http.
I see you said m0=xx making me assume itll be 2 bytes.
All I want is to setup the virtual zone (station 20) as gpio, then enable the ‘sequential’ option, and ultimately find out what parameter i need to send, to change a station from using master1, master2, or no master, and not have it apply to all zones in a group, or a complex riddle, just the ability to understand what sends what while trying to change station settings.
I really do appreciate you taking the time to follow up. Hoping quarantine improves my odds of figuring this out.March 26, 2020 at 8:20 am #64819
Please, take a look at the API document:
page 5, section 10, where it explains the /cs command. It clearly says there are parameters such as q? (i.e. q0, q1, q2…). And it gave a few examples such as setting m0 (the bit fields for the first 8 zones). I don’t know how to continue explain this if you don’t read that section carefully.
xx in my post just means a placeholder — it’s an integer, it could be anywhere from 0 to 3 digits long (0 to 255). It doesn’t mean two bytes.
As the API document clearly shows, the JSON variable names returned by /jn and the parameters you set through /cs do NOT have the same names. For example, the master operation bit fields returned by /jn is named “masop”, but to set this through /cs, you use m? (e.g. m0, m1, m2…). The reason they are not the same is due to backward compatibility reasons — the names were like this from several firmwares ago and we didn’t want to change them completely to break the previous versions of hardware and firmware.
In your example, the result of settings m0=1 is to set the first zone’s master operation bit to 1 (enabled), and the other 7 zones to 0. Similarly, if you do m0=255, it will sets the master operation bits for all first 8 zones to 1.March 26, 2020 at 1:58 pm #64827
so basically there is no way to change attributes to a single station?
and that functionality is lacking because of favoring legacy devices? can legacy devices even update to the latest firmware without sdcard?
i seen posts from 2015/2016 questioning this and figure it would be implemented by now
and basically i’m outta luck from what i understand because there isn’t a way to parse the current values of a single station and make changes to that single station?
instead it’s make changes to a group of 1-8 at a time and no way to parse, perform a math calculation to change hex 11110111 to 11111000 without additional programming to go from hex to bit?
would it be of any use to request that ability to modify single station properties? i imagine that’s the easiest way to solve the situation im in?March 27, 2020 at 10:38 am #64835
How do you think the UI allows you to change the attribute of a single station? It reads the current status (/jn), changes a bit of it, and sets it back (/cs). That’s how the UI does it. Rudimentary programming exercise. At the minimum, perhaps you can Google about “how to set a bit in an integer”? This is really basic programming stuff. If you insist on writing your own script to do it, then I would assume you have sufficient programming skills to implement this.
If you want to add the capability of changing a single attribute at a time, why not just change the firmware and add that feature. The source code is completely open, you can modify it any way you want.
- This reply was modified 1 day, 5 hours ago by Ray.
- You must be logged in to reply to this topic.