Perhaps we do. I took the use of node and input names as an obvious given and intended to alter this throughout emonhub core, not just in individual interfacers. I do not see this a huge problem, possibly a sizable job but not complicated. You have to remember emonhub was primarily handling JeeLib data and even emoncms restricted users to node ids of just 0-32 so it appeared to make sense at the time to handle the nodes as integers for better error control, in hind sight I regret that was done and look forward to undoing those restrictions. Even the socket interfacer would benefit from using a name rather than a nodeid. This will impact how the [nodes] section is used and I have thoughts on that for another discussion.
And that would be the correct way of doing it. If you want to buffer data whilst you change the node names you need to do that in the input stage not the output stages, emonhub should faithfully reflect the data as it was at that time. If the network is up 100% of the time the data will be posted before you change the names so I do not see why new changes should effect old data. The interfacers (and reporters) originally had âpauseâ settings sp you could pause either the input or output of any interfacer (or reporter).
No there is no real direct comparison between a interfacer and a reporter, remember reporters were threaded at an earlier date because OEMG was blocking serial data when the network was down. When I threaded the interfacers and made them bi-directional I made no/minimal changes to the reporters whilst we reviewed the interfacers.
The run method doesnât exist in the interfacers. Basically we do not need to store the cargo objects because what ever parsing the interfacer can do as date comes out of the buffer, it can do before it goes into the buffer, the way the methods are currently may need adjusting to suit the ideal solution, but I do not see an issue implementing the buffering, the bigger issue is deciding where,when and if buffering should be implemented.
Again I draw your attention to the distinction between a local/real-time/unbuffered/QoS1/key:value 2 way interfacer and a remote/confirmed_delivery/buffered/QoS2/indexed/timestamped/ reporter or reporter-like intefacer.
The use of the cargo object in the internal buffering allows all settings to be pulled in, as I have previously stated at some point, my long term goal was to perhaps move the process_rx and process_tx methods to the Cargo object so that there was a distinction between âinterfacingâ and âprocessingâ the naming and decoding etc as well as the routing is all part of âcore processingâ. This is just a design goal and doesnât need to be changed now, I only explain this to perhaps help you compartmentalize the emonhub structure in your mind.
yep. I got that, you may have mentioned it previously (a few thousand times
) but my opinion differs and so we need to asses it on other points too.
Great, we can at least then compare the options and movement in either direction will be smother as there will be existing examples to mimic.
I would need to look closer at your code to try and understand why that is happening. Yes there is one thread and either a delayed send/publish or read/subscribe could block the other but what are you going to send to if a website isnât available to read? likewise if canât publish to a topic what will you be listening to if the server isnât available?
That is not ideal as there should be default values to remove the necessity of defining everything explicitly.
In this instance that would be correct, they are both bi-directional interfacers and the mqtt should be unbuffered and âbroadcastâ locally on a per value QoS1 topic tree for local observation/consumption BUT IMO there should also be a mqtt reporter(-like interfacer) AND/OR a http reporter(-like interfacer) for buffering data and delivering both swiftly and concisely whilst ensuring no data loss.
Almost! as above I do not think they both need to be one way, there are 2 clearly different types of outgoing trafic, instantaneous, real-time âstatusâ and âhistoricalâ data to be processed and persisted by emoncms even if it is days old. The distinction is the type not the direction.
There could be dozens of different types for specific purposes once we break the restraints of a single http or mqtt interfacer to do everything. This is why we need to have the basic http request and mqtt connect subscribe and publish methods available to all interfacers and there should be a generic mqtt (and http) interfacer. A very basic example using a single mqtt interfacer INSTANCE you should be able to subscribe to /base/topicA, define the same channel in the subchannels and subchannels and republish that data to /base/topicB.
As a absolute minimum you would need to include all serial connections and most usb/serial connections such as bluetooth, modbus and inverters etc. I also believe the socket interfacer would fit in this âsetâ as you can open a single 2 way communication, listen and reply.
But I still donât see why mqtt and http interfacers canât be 2 way despite being seperate actions, but if we find it canât be done or that we need more threads we can explore that too, but for now I do not think it should be necessary.
As Iâve said above, I think emonhub should support the use of names throughout, the biggest hurdle there for me is that I must retain the ability to use indexed csv as Iâm looking to make the payloads as small as possible for efficiency with either GSM or LoRaWAN. I too would like to see the use of naming but not at the cast of doubling the memory used to buffer and the size of every request. In monetary terms it will costr twice as much to send key:values as indexed csv over GSM, If you roll out the use of named inputs with the bulk upload as the only option, that would force users like me to have to name out inputs as â1â, â2â â3â etc just so it will work, the requests will be double the size and we will no longer be able to tell what the inputs are by the emonhub.conf as the (currently unused in csv) input names would need replacing with numbers, (very messy). Alternatively a setting or test will be needed which could cause confusion or if used incorrectly create duplicate inputs.
The root of this issue pre-dates any emonhub version/variant. It lies in emoncms and the way that indexes and input names share the same field forcing a decision to use one or the other but never both. For these different formats to co-exist without splitting users into 2 separate camps there needs to be a âindexâ field added to the input table to allow any input to be referenced by either itâs name or itâs index, the default behaviour can continue as it is so that new and unnamed inputs have their ânameâ set to the same as their âindexâ until such time as a user changes it.
Once we have that we can streamline the interfacer to use indexed inputs and when ever a change is detected in emonhub.conf settings it could send a change of name rather than creating a new input, which is what you current implementation would do. eg changing
[[5]]
nodename = emonpi
[[[rx]]]
names = power1,power2,power1pluspower2,vrms,t1,t2,t3,t4,t5,t6,pulsecount
to
[[5]]
nodename = emonpi
[[[rx]]]
names = GRID,SOLAR,power1pluspower2,vrms,t1,t2,t3,t4,t5,t6,pulsecount
using your planned method will cause 2 new inputs to be created and all the processing and feed updates are disconnected.
If there was an index ref in the input table, the change detected in emonhub.conf could trigger a (new) api call to send
https://emoncms.org/input/json?node="emonpi"&inputnames="GRID,SOLAR,power1pluspower2,vrms,t1,t2,t3,t4,t5,t6,pulsecount"&apikey=abc123
which would preserve the feeds and the processing. An example of this type of action can be seen in Stuarts emonNotify, that too sends input names to his device only on change.
Please consider looking at emoncms to allow key:value and indexed csv to be used together at the same time. I am not trying to make indexed csv the only choice, or even the default or prefered choice, I just see the benefits of both and I want both, if forced to choose, csv wins hands down, which is why we will never agree on key:value only. I feel you are so invested in one specific approach that it doesnât even occur to you that others may have a different opinion, application or requirements, and that there might actually be good reason for that.