How to?, HTTP request to trigger PCF8574 switch input

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
hoeby
Normal user
Posts: 33
Joined: 19 Sep 2018, 21:03

How to?, HTTP request to trigger PCF8574 switch input

#1 Post by hoeby » 30 Sep 2019, 22:04

Hopefully somebody can help me, i can't find the solution.

When doing http://192.168.178.xxx/control?cmd=gpio,14,1
This sets GPIO switch on 1
This gives the answer:

Code: Select all

{
"log": "GPIO 5 Set to 0",
"plugin": 1,
"pin": 5,
"mode": "output",
"state": 1
}
I would like to have the same, but than for a PCF8574 input.
I tried http://192.168.178.xxx/control?cmd=pcfgpio,2,1
This gives the answer:

Code: Select all

{
"log": "GPIO OUTPUT 2 Set to 1",
"plugin": 19,
"pin": 2,
"mode": "output",
"state": 1
}
The log in the answer says it is GPIO output, but i would love it to be input.
Now the PCF switch input doesn't be set to 1, when giving this http command.

Is it not possible? Or is it me, doing something wrong?
Last edited by hoeby on 01 Oct 2019, 21:31, edited 2 times in total.

hoeby
Normal user
Posts: 33
Joined: 19 Sep 2018, 21:03

Re: How to?, HTTP request to trigger PCF8574 switch input

#2 Post by hoeby » 01 Oct 2019, 07:55

Found the answer.
Need to use taskvalueset

This works
It sets task 3, switch to 0

Code: Select all

http://192.168.178.XXX/control?cmd=taskvalueset,3,1,0
This sets task 3, switch to 1

Code: Select all

http://192.168.178.XXX/control?cmd=taskvalueset,3,1,1

Patou
Normal user
Posts: 106
Joined: 21 May 2018, 10:33

Re: Solved. How to?, HTTP request to trigger PCF8574 switch input

#3 Post by Patou » 01 Oct 2019, 17:36

Hello
Look at : https://www.letscontrolit.com/wiki/inde ... le=PCF8574
They are some specific commands for PCF8579

hoeby
Normal user
Posts: 33
Joined: 19 Sep 2018, 21:03

Re: Solved. How to?, HTTP request to trigger PCF8574 switch input

#4 Post by hoeby » 01 Oct 2019, 21:31

I found those commands.
But they are all triggering an output, and not the switch (when doing HTTP request).

I tried the taskvalueset by http
When doing that command, the switch changes from 0 to 1 (or backwards), but the rules is not triggered.
Then triggering the input by cable, the switch also changes from 0 to 1, but then it does trigger the rules.
Strange :roll:

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: How to?, HTTP request to trigger PCF8574 switch input

#5 Post by grovkillen » 01 Oct 2019, 21:38

You should always trigger things using events. That's the way to do it, least unintended consequences that way.

Thus trigger with command "event,..."
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

hoeby
Normal user
Posts: 33
Joined: 19 Sep 2018, 21:03

Re: How to?, HTTP request to trigger PCF8574 switch input

#6 Post by hoeby » 02 Oct 2019, 15:42

grovkillen wrote: 01 Oct 2019, 21:38 You should always trigger things using events.
The funny thing about it. After seeing that taskvalueset didn't worked i moved to the wiki. First reading the taskvalueset part, but then noticed the event part. :idea: :idea: :idea: a light went on between my ears. Modified the config and it Works for the part i needed. I also could drop the pcf8574, that was not necessary anymore. I used it to have extra inputs to trigger rules

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: How to?, HTTP request to trigger PCF8574 switch input

#7 Post by grovkillen » 02 Oct 2019, 15:50

Great to hear! :)
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests