Comments (7)
I like that, it adds a nice scripting possibility to pyhaystack.
from pyhaystack.
If you can point us to documentation on how to do that, sure. We'll look at adding it.
At the moment, the only way I know of in nHaystack to edit the asset model is via the workbench, and I have no idea how entities get into SkySpark. The only implementation that I know of which supports this is WideSky.
from pyhaystack.
Related issue: #74
from pyhaystack.
@sjlongland You are probably right. I will reach out to SkySpark and see if it is even possible per #74
I'll close this issue for now
from pyhaystack.
Follow up to this, I was able to add new equipment points to our skyspark server using:
def _create_equipment_grid(self, equip_name, markers):
grid = hszinc.Grid()
grid.metadata['commit'] = 'add'
# grid.metadata['projName'] = 'Springfield'
grid.column['dis'] = {}
grid.column["equip"] = {}
grid.column["siteRef"] = {}
grid.column["navName"] = {}
#grid.column['disMacro'] = {}
g = {'dis': equip_name, 'navName': equip_name, 'equip': hszinc.MARKER, "siteRef": self._site.id}
for marker in markers:
grid.column[marker] = {}
g[marker] = hszinc.MARKER
grid.append(g)
return grid
and then passing the grid to PyHaystack's protected _post_grid method:
def _post_grid(self, g):
r = self.session._post_grid(grid=g, callback=None, uri='commit')
return r
I added measurement points in the same way:
def _create_measurement_grid(self, method, name, markers, unit, kind,):
grid = hszinc.Grid()
grid.metadata['commit'] = 'add'
# grid.column['dis'] = {}
grid.column['navName'] = {}
grid.column['disMacro'] = {}
grid.column["siteRef"] = {}
grid.column["equipRef"] = {}
grid.column["tz"] = {}
grid.column["kind"] = {}
g = {'navName': name, 'disMacro': '$equipRef $navName', "siteRef": self._site.id, "equipRef": self._equip.id,
'unit': unit, 'tz': str(self._site.hs_tz), 'kind': kind}
for marker in markers:
grid.column[marker] = {}
g[marker] = hszinc.MARKER
grid.append(g)
return grid
where method is 'add'
from pyhaystack.
This is an interesting development indeed.
To achieve parity with what WideSky permits, we'd need the ability to:
- add new entities (
commit
endpoint looks to be the one that does this) - mutate entities (maybe doable via
commit
as well) by:- adding new tags
- changing the values of existing tags
- deleting tags
- delete entities
If we can do those things, say via curl
, we can most certainly implement it in pyhaystack
. The "CRUD" operations in WideSky would be a good starting point for implementing this.
from pyhaystack.
I have had success mutating existing entities in SkySpark using:
grid.metadata['commit'] = 'update'
instead of grid.metadata['commit'] = 'add'
. In both cases I used the commit
endpoint
I have used this to add new tags, though haven't tried to overwrite or remove existing tags.
We actually just ran into a use case where it would've been convenient to delete entities using pyhaystack
, but the low # of entities made it more efficient to just delete them using SkySparks UI
from pyhaystack.
Related Issues (20)
- Issue with NaN values HOT 3
- Retrieving point write status was broken in 3.0? HOT 6
- Implement __await__ on operation classes HOT 5
- Breaking change from SkySpark 3.0.27 to 3.0.28 HOT 15
- LDAP login on SkySpark 3.0.28 HOT 6
- Axon eval(hisClear) requires POST, not GET with skyspark HOT 2
- Why was the Haystack read Op split into get_entity and find_entity? HOT 2
- hszinc.zincparser.ZincParseException: Failed to parse: Expected end of text, found '"' (line:6, col:1) HOT 2
- Pint error? HOT 3
- Possible error while fetching data from a Niagara server hosted on HTTPS HOT 2
- Parsing issue evalOrReadAll(\"ruleSparkSwivel([@nav:equip.all], toSpan(\\\"yesterday\\\"), [], {})\") HOT 2
- Use query function for Naigara4 nHaystack Server HOT 4
- Project Haxall HOT 1
- pyhaystack.util.state.NotReadyError HOT 10
- Niagara 4.9 | Possible breaking change for login HOT 2
- SkySpark Authentication HOT 3
- Writing histories to SkySpark HOT 4
- Skyspark needs post requests instead of get requests for his_read HOT 12
- Watch_poll does not use argument refresh HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyhaystack.