readFromJsonState()

I’m trying to do something I thought would be simple. Display on 4 line display that the WLED is in Live mode.

I found the below in the user mod example

  • readFromJsonState() can be used to receive data clients send to the /json/state part of the JSON API (state object).

and found “Live” in the json JSON API - WLED Project

So this is one of the version of code I tried:

If readFromJsonState(Live:true);{
drawString(1, 0, “LIVE”);}

I’ve tried what feels like 100 versions and I’m getting nowhere. Could someone please point me in the write direction? An example of how you read a state in Json…

readFromJsonState() is intended for usermod to interact with UI, not to gather information.

Use internal global varables in your loop().

Thank you.

Don’t suppose you know what global variable I need to use… Ie if receiving Sacn?

Not from the top of my head…
Check the wled.h file.

Thanks @blazoncek

So I think I’m getting closer after many hours. However…

it always say "overide " on my screen, no matter if e131.1 is transmitting.

Any suggestions to what I’m doing wrong?

Blockquote

if (e131NewData == true)
drawString(1, 0, "Overide :slight_smile: ");
if (e131NewData == false)
drawString(1,0, “WLED CTRL”);

Blockquote

also have tried just (e131newdata)

and if I add

else
Drawstring

it just writes ontop of “overide” so you get a mixes message

Hi

Thanks for your help on all of this. Slowly getting wear I want to be.

Seen you’ve done a lot of edit on the gIt hub for the 4-line user mod…

Wondered if you had any idea about this…

If I compile for a wemos D1 the auto cycle of information works. But if I do it on a wt32-eth01 its sits on brightness.

Any idea of why? It’s been driving me nuts.

I am sorry but I really do not have the time to check your code.

No worries. Was just checking if it was a know problem with that type of board