Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hardware: add support for Gosund P1 Power Strip #2391

Merged
merged 1 commit into from
Nov 2, 2020
Merged

hardware: add support for Gosund P1 Power Strip #2391

merged 1 commit into from
Nov 2, 2020

Conversation

alextircovnicu
Copy link
Contributor

No description provided.

@mcspr mcspr merged commit 289c8cb into xoseperez:dev Nov 2, 2020
@mcspr
Copy link
Collaborator

mcspr commented Nov 2, 2020

Thanks!

I was wondering about the Tasmota implementation doing multiple analogRead calls and taking an average shifting the sum N times:
https://github.com/arendst/Tasmota/blob/3b432a58a3f0de1c1affedf9f894c2f0f4e1b8e1/tasmota/xsns_02_analog.ino#L234-L248
Buttons in the interface do it twice, rules example from the templates page does it 32 times every 0.25seconds. If what we do right now works, might not be a problem :) My guess the precision might be slightly off, sometimes (or never, hopefully).

(and, technically, Tasmota implementation is also missing out on the SDK function doing this specific thing... system_adc_read_fast, but it might not be really suited for using wifi at the same time)

@alextircovnicu
Copy link
Contributor Author

Sorry for being so late - you know, it is hard with two kids abroad while Europe is more or less in lock-down.
So, to the topic: Like I previously mentioned I had Tasmota running for a week, configured as explained on the template page.
Every 10 buttons presses it was behaving odd: turning ON two relays at once, turning ON another relay while I was turning off one. Also the button click it was not natural. I had to keep the button pressed more than a usual "button click" . Seeing now the implementation I guess all these behaviors make sense.

I think your implementation is the way to go here. Yes, for analog readings, I guess, getting more samples and shifting the sum may be a more logical approach. For this resistor ladder, you already know the expected values (which are about 20 ohms smaller than Tasmota uses). I have activated the analog sensor, to see the button values and the readings are pretty constant (never noticed a deviation bigger than 7 ohms).

I will update the Wiki in the upcoming days.

P.S. Tuya convert never worked for me with this Gosund devices and, which I think it is a little bit strange, the Tasmota minimal firmware (uploaded after espurna) always bricked my devices - I had use the uart programmer again on them.

@mcspr
Copy link
Collaborator

mcspr commented Nov 3, 2020

I meant to point out the buttons are seem to be configured similar to ours, through the GPIO config as analog button, although it is only available in the not-yet-released Tasmota 9.x version. So the script is kind of deprecated.
But, I have no idea what to do with the adcparam or whatever is used to configure them :)
About the minimal fw... that will probably never work, if this issue still applies:
#1663

Analog sensor does more than one analogRead btw, ref. ANALOG_SAMPLES defaulting to 10 times every ~1ms which adds each value then divides. If it is ok for ladder though, this can be just one read (meaning... two, including the debounce check that the value is still in range)

Stay safe! No worries.

mcspr pushed a commit to mcspr/espurna that referenced this pull request Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants